Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
004a62c
chore: initial commit
ariG23498 Mar 18, 2024
ab92add
chore: adding imports and inits
ariG23498 Mar 18, 2024
c324450
chore: adding the causal and classification code
ariG23498 Mar 19, 2024
80903db
chore: adding names to the layers
ariG23498 Mar 19, 2024
efde147
Merge branch 'main' into aritra/tf-mistral
ariG23498 Mar 20, 2024
49c62a4
Merge branch 'main' into aritra/tf-mistral
ariG23498 Mar 22, 2024
0ddb736
chore: using single self attn layer
ariG23498 Mar 22, 2024
47f6dc9
Merge branch 'main' into aritra/tf-mistral
ariG23498 Mar 26, 2024
e0cab13
chore: built the model and layers
ariG23498 Mar 26, 2024
71d2cc1
Merge branch 'main' into aritra/tf-mistral
ariG23498 Mar 27, 2024
e047566
chore: start with testing
ariG23498 Mar 27, 2024
030822f
chore: docstring change, transpose fix
ariG23498 Mar 27, 2024
8d8b123
fix: rotary embedding
ariG23498 Mar 28, 2024
73c53c4
Merge branch 'main' into aritra/tf-mistral
ariG23498 Mar 28, 2024
8fbbd8a
Merge branch 'main' into aritra/tf-mistral
ariG23498 Apr 8, 2024
489f455
chore: adding cache implementation
ariG23498 Apr 9, 2024
78f43a2
remove unused torch
ariG23498 Apr 9, 2024
116ec45
Merge branch 'main' into aritra/tf-mistral
ariG23498 Apr 23, 2024
bb87ec9
Merge branch 'main' into aritra/tf-mistral
ariG23498 Apr 25, 2024
9d23764
chore: fixing the indexing issue
ariG23498 Apr 25, 2024
7a248a4
make fix-copies
Rocketknight1 Apr 25, 2024
9cacb1b
Use modeling_tf_utils.keras
Rocketknight1 Apr 25, 2024
973dfd8
make fixup
Rocketknight1 Apr 25, 2024
e2820aa
Merge branch 'main' into aritra/tf-mistral
ariG23498 Apr 26, 2024
9f85298
chore: fixing tests
ariG23498 Apr 26, 2024
e987cce
Merge branch 'main' into aritra/tf-mistral
ariG23498 Apr 28, 2024
c105374
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 1, 2024
bf2253c
chore: adding past key value logic
ariG23498 May 1, 2024
236c5d7
chore: adding multi label classfication test
ariG23498 May 1, 2024
a133bb3
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 2, 2024
0777efd
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 7, 2024
aae1743
fix: switching on the built parameters in the layers
ariG23498 May 7, 2024
3306e24
fixing repo consistency
ariG23498 May 7, 2024
54b90fe
ruff formats
ariG23498 May 7, 2024
f006801
style changes
ariG23498 May 8, 2024
b3caa7e
fix: tf and pt equivalence
ariG23498 May 8, 2024
b4e223e
removing returns from docstrings
ariG23498 May 8, 2024
d417319
fix docstrings
ariG23498 May 8, 2024
204b16f
fix docstrings
ariG23498 May 9, 2024
b4e5076
removing todos
ariG23498 May 9, 2024
aece0bf
resolve conflict
ariG23498 May 9, 2024
4007594
fix copies
ariG23498 May 9, 2024
ba6a6b0
fix docstring
ariG23498 May 9, 2024
773e2d9
fix docstring
ariG23498 May 9, 2024
c2828ef
chore: using easier rotate_half
ariG23498 May 10, 2024
dafb337
adding integration tests
ariG23498 May 10, 2024
66470d0
chore: addressing review related to rotary embedding layer
ariG23498 May 10, 2024
93bf901
review changes
ariG23498 May 13, 2024
06edf0b
[run-slow] mistral
ariG23498 May 13, 2024
d5ce0f7
skip: test save load after resize token embedding
ariG23498 May 16, 2024
0801fd1
style
ariG23498 May 16, 2024
c8530e6
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 21, 2024
906975d
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 22, 2024
7b34955
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 22, 2024
5dcfb74
Merge branch 'main' into aritra/tf-mistral
ariG23498 May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Flax), PyTorch, and/or TensorFlow.
| [Megatron-BERT](model_doc/megatron-bert) | ✅ | ❌ | ❌ |
| [Megatron-GPT2](model_doc/megatron_gpt2) | ✅ | ✅ | ✅ |
| [MGP-STR](model_doc/mgp-str) | ✅ | ❌ | ❌ |
| [Mistral](model_doc/mistral) | ✅ | | ✅ |
| [Mistral](model_doc/mistral) | ✅ | | ✅ |
| [Mixtral](model_doc/mixtral) | ✅ | ❌ | ❌ |
| [mLUKE](model_doc/mluke) | ✅ | ❌ | ❌ |
| [MMS](model_doc/mms) | ✅ | ✅ | ✅ |
Expand Down
17 changes: 16 additions & 1 deletion docs/source/en/model_doc/mistral.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,19 @@ A list of official Hugging Face and community (indicated by 🌎) resources to h
## FlaxMistralForCausalLM

[[autodoc]] FlaxMistralForCausalLM
- __call__
- __call__

## TFMistralModel

[[autodoc]] TFMistralModel
- call

## TFMistralForCausalLM

[[autodoc]] TFMistralForCausalLM
- call

## TFMistralForSequenceClassification

[[autodoc]] TFMistralForSequenceClassification
- call
9 changes: 9 additions & 0 deletions src/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3964,6 +3964,9 @@
_import_structure["models.mbart"].extend(
["TFMBartForConditionalGeneration", "TFMBartModel", "TFMBartPreTrainedModel"]
)
_import_structure["models.mistral"].extend(
["TFMistralForCausalLM", "TFMistralForSequenceClassification", "TFMistralModel", "TFMistralPreTrainedModel"]
)
_import_structure["models.mobilebert"].extend(
[
"TFMobileBertForMaskedLM",
Expand Down Expand Up @@ -8047,6 +8050,12 @@
TFMBartModel,
TFMBartPreTrainedModel,
)
from .models.mistral import (
TFMistralForCausalLM,
TFMistralForSequenceClassification,
TFMistralModel,
TFMistralPreTrainedModel,
)
from .models.mobilebert import (
TFMobileBertForMaskedLM,
TFMobileBertForMultipleChoice,
Expand Down
3 changes: 3 additions & 0 deletions src/transformers/models/auto/modeling_tf_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
("lxmert", "TFLxmertModel"),
("marian", "TFMarianModel"),
("mbart", "TFMBartModel"),
("mistral", "TFMistralModel"),
("mobilebert", "TFMobileBertModel"),
("mobilevit", "TFMobileViTModel"),
("mpnet", "TFMPNetModel"),
Expand Down Expand Up @@ -178,6 +179,7 @@
("gpt-sw3", "TFGPT2LMHeadModel"),
("gpt2", "TFGPT2LMHeadModel"),
("gptj", "TFGPTJForCausalLM"),
("mistral", "TFMistralForCausalLM"),
("openai-gpt", "TFOpenAIGPTLMHeadModel"),
("opt", "TFOPTForCausalLM"),
("rembert", "TFRemBertForCausalLM"),
Expand Down Expand Up @@ -320,6 +322,7 @@
("layoutlm", "TFLayoutLMForSequenceClassification"),
("layoutlmv3", "TFLayoutLMv3ForSequenceClassification"),
("longformer", "TFLongformerForSequenceClassification"),
("mistral", "TFMistralForSequenceClassification"),
("mobilebert", "TFMobileBertForSequenceClassification"),
("mpnet", "TFMPNetForSequenceClassification"),
("openai-gpt", "TFOpenAIGPTForSequenceClassification"),
Expand Down
34 changes: 33 additions & 1 deletion src/transformers/models/mistral/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
)


_import_structure = {
Expand Down Expand Up @@ -47,6 +53,19 @@
"FlaxMistralPreTrainedModel",
]

try:
if not is_tf_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
_import_structure["modeling_tf_mistral"] = [
"TFMistralModel",
"TFMistralForCausalLM",
"TFMistralForSequenceClassification",
"TFMistralPreTrainedModel",
]


if TYPE_CHECKING:
from .configuration_mistral import MistralConfig
Expand Down Expand Up @@ -77,6 +96,19 @@
FlaxMistralPreTrainedModel,
)

try:
if not is_tf_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
from .modeling_tf_mistral import (
TFMistralForCausalLM,
TFMistralForSequenceClassification,
TFMistralModel,
TFMistralPreTrainedModel,
)


else:
import sys
Expand Down
Loading