Skip to content

Commit

Permalink
bettertransformers fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Sep 27, 2024
1 parent d6e97cf commit 0e2ed87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions optimum/bettertransformer/models/decoder_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def __init__(self, layer: "nn.Module", config: "PretrainedConfig"):
submodules = ["attn_dropout", "resid_dropout", "k_proj", "v_proj", "q_proj", "out_proj", "bias", "masked_bias"]

# Attribute only for transformers>=4.45
if hasattr(layer, "layer_idx"):
submodules.append("layer_idx")
if hasattr(layer, "layer_id"):
submodules.append("layer_id")

for attr in submodules:
setattr(self, attr, getattr(layer, attr))
Expand Down
4 changes: 2 additions & 2 deletions tests/bettertransformer/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
# "llama": "fxmarty/tiny-llama-fast-tokenizer",
# "llama-gqa": "noamwies/llama-test-gqa-with-better-transformer",
"m2m_100": "hf-internal-testing/tiny-random-nllb",
"marian": "fxmarty/tiny-marian", # the other tiny ones have a too small max_position_embeddings
"marian": "optimum-internal-testing/tiny-random-marian", # the other tiny ones have a too small max_position_embeddings
"markuplm": "hf-internal-testing/tiny-random-MarkupLMModel",
"mbart": "hf-internal-testing/tiny-random-mbart",
"opt": "hf-internal-testing/tiny-random-OPTModel",
"pegasus": "hf-internal-testing/tiny-random-PegasusModel",
"prophetnet": "hirotasoshu/tiny-random-prophetnet", # the other tiny ones have a too small max_position_embeddings
"prophetnet": "optimum-internal-testing/tiny-random-prophetnet", # the other tiny ones have a too small max_position_embeddings
"rembert": "hf-internal-testing/tiny-random-RemBertModel",
"roberta": "hf-internal-testing/tiny-random-RobertaModel",
"rocbert": "hf-internal-testing/tiny-random-RoCBertModel",
Expand Down

0 comments on commit 0e2ed87

Please sign in to comment.