Fixes import error for this function `create_position_ids_from_input_ids` in transformers V5.

#59

Right now, With Transformers V5.0 version, If we try to load the jinaai/jina-embeddings-v3 model, we are getting this Error: ImportError: cannot import name 'create_position_ids_from_input_ids' from 'transformers.models.xlm_roberta.modeling_xlm_roberta'

The function is now kept as a staticmethod in the file: (transformers.models.xlm_roberta.modeling_xlm_roberta). This PR will make sure that it will now work in both Transformers V5 and older v4.57.x versions. Link to the staticmethod: https://github.com/huggingface/transformers/blob/7769f660935b5d48b73bf6711d0a78b6f8f98739/src/transformers/models/xlm_roberta/modeling_xlm_roberta.py#L145

@jupyterjazz @michael-guenther @gmastrapas Can you please merge/fix this as soon as possible. This model (jinaai/jina-embeddings-v3) has > 5M downloads per month. Now that transformers V5 is released, It is the default version of transformers in Colab as well. So, this needs to be fixed. If one wants to use the model through transformers package now.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment