Instructions to use jinaai/xlm-roberta-flash-implementation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jinaai/xlm-roberta-flash-implementation with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("jinaai/xlm-roberta-flash-implementation", dtype="auto") - Notebooks
- Google Colab
- Kaggle
`XLMRobertaLoRA.__init__` missing `self.post_init()` causes `AttributeError` with transformers >= 5.0
Description
Loading jinaai/jina-embeddings-v3 with transformers >= 5.0 raises an AttributeError immediately on model load:
AttributeError: 'XLMRobertaLoRA' object has no attribute 'all_tied_weights_keys'
Key lines from the traceback:
File ".../transformers/modeling_utils.py", line 4776, in _move_missing_keys_from_meta_to_device
for key in missing_keys - self.all_tied_weights_keys.keys()
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'XLMRobertaLoRA' object has no attribute 'all_tied_weights_keys'. Did you mean: '_tied_weights_keys'?
Steps to Reproduce
from transformers import AutoModel
model = AutoModel.from_pretrained("jinaai/jina-embeddings-v3", trust_remote_code=True)
Requires: transformers >= 5.0.0
Confirmed broken on transformers==5.13.0 with the latest revision of this repo (845308d0).
Root Cause
transformers 5.x moved the initialization of all_tied_weights_keys out of the class body and into PreTrainedModel.post_init() (see modeling_utils.py ~line 1413). Any subclass that overrides __init__ must call self.post_init() at the end, or this attribute never gets set on the instance.
Commit 845308d0 ("Fixup post init (for v5 remot compatibility)") added self.post_init() calls to several classes in modeling_xlm_roberta.py, but XLMRobertaLoRA in modeling_lora.py was missed. Its __init__ currently ends after:
self.main_params_trainable = config.lora_main_params_trainable
# <-- self.post_init() is not called here
Other classes in the same file, such as XLMRobertaModel, already call self.post_init() correctly.
Proposed Fix
Add one line at the end of XLMRobertaLoRA.__init__ in modeling_lora.py, after self.main_params_trainable = config.lora_main_params_trainable:
self.post_init()
This mirrors what XLMRobertaModel and the other fixed classes already do, and is consistent with the intent of commit 845308d0.