Code examples not working with transformers or sentence-transformers

#106
by anto5040 - opened

Hello,
I'm trying the block codes on the model card and I get the following error either by using Transformers or Sentence-Transformers:

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/cache/huggingface/modules/transformers_modules/jinaai/xlm-roberta-flash-implementation/2b6bc3f30750b3a9648fe9b63448c09920efe9be/block.py'

These are the relevant packages I have at the moment in my Python 3.12.7 environment:

einops==0.8.0
...
huggingface-hub==0.27.1
...
numpy==1.26.4
nvidia-cublas-cu12==12.4.5.8
nvidia-cuda-cupti-cu12==12.4.127
nvidia-cuda-nvrtc-cu12==12.4.127
nvidia-cuda-runtime-cu12==12.4.127
nvidia-cudnn-cu12==9.1.0.70
nvidia-cufft-cu12==11.2.1.3
nvidia-curand-cu12==10.3.5.147
nvidia-cusolver-cu12==11.6.1.9
nvidia-cusparse-cu12==12.3.1.170
nvidia-nccl-cu12==2.21.5
nvidia-nvjitlink-cu12==12.4.127
nvidia-nvtx-cu12==12.4.127
...
scipy==1.15.1
sentence-transformers==3.3.1
...
tokenizers==0.21.0
torch==2.5.1
...
transformers==4.48.0

Could this be resolved by using another version of one (I'm looking at you, transformers) or more packages?

Edit: I did manage to run the ONNX model by downloading the files in the onnx folder of the repo and changing the path of the .onnx model to mine in the example code but don't know how to adjust output's dimensions nor how to pass a certain task ('text-classification').

anto5040 changed discussion title from FileNotFoundError: [Errno 2] No such file or directory: '/mnt/cache/huggingface/modules/transformers_modules/jinaai/xlm-roberta-flash-implementation/2b6bc3f30750b3a9648fe9b63448c09920efe9be/block.py' to Code examples not working with transformers or sentence-transformers

I managed to make it work by manually download the files that were missing.
I went to the directory where they were supposed to be and then did the following commands in my terminal:

wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/.gitattributes
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/README.md
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/block.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/configuration_xlm_roberta.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/convert_roberta_weights_to_flash.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/embedding.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/mha.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/mlp.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/modeling_lora.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/modeling_xlm_roberta.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/rotary.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/stochastic_depth.py
wget https://huggingface.co/jinaai/xlm-roberta-flash-implementation/resolve/main/xlm_padding.py
anto5040 changed discussion status to closed
Your need to confirm your account before you can post a new comment.

Sign up or log in to comment