KeyError: 'default' with Python >= 3.11

#22
by sf7104 - opened

The usage example from the README.md fails with Python >= 3.11 (tested with 3.09, 3.11 and 3.12). 3.09 works without any problems. 3.11 and 3.12 yield the following traceback:

Traceback (most recent call last):
  File "[...]/test2.py", line 6, in <module>
    model = AutoModelForMaskedLM.from_pretrained(model_id, trust_remote_code=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/.venv11/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 365, in from_pretrained
    return model_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/.venv11/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4072, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/.cache/huggingface/modules/transformers_modules/EuroBERT/EuroBERT_hyphen_210m/39b51e15dd1f1a06f58b5cbf6a8a188cec60bd0e/modeling_eurobert.py", line 717, in __init__
    self.model = EuroBertModel(config)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "[...]/.cache/huggingface/modules/transformers_modules/EuroBERT/EuroBERT_hyphen_210m/39b51e15dd1f1a06f58b5cbf6a8a188cec60bd0e/modeling_eurobert.py", line 484, in __init__
    self.rotary_emb = EuroBertRotaryEmbedding(config=config)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/.cache/huggingface/modules/transformers_modules/EuroBERT/EuroBERT_hyphen_210m/39b51e15dd1f1a06f58b5cbf6a8a188cec60bd0e/modeling_eurobert.py", line 268, in __init__
    self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
                        ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'default'

Additionally, with 3.11 and 3.12, it seems that the trust_remote_code=True parameter is ignored. I'm not sure if this is the correct place to report this issue - sorry if I'm wrong.

Sign up or log in to comment