Open BoyuanJackChen opened 3 months ago
@BoyuanJackChen Could you please provide more information about your environment and your server? I haven't encountered this question. You can run the following code to check if your gtr-x5-xl model structure is consistent with the structure in the figure.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('$HOME/huggingface_cache/models--sentence-transformers--gtr-t5-xl/snapshots/_')
print(model)
In my opinion, the Dense layer may disappear in your model. You can redownload this model with the following code and save it locally:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/gtr-t5-xl')
model.save('<your_local_path>')
After that, replace '--EMBED_PATH' with this path will be fine.
Besides, my conda environment is shown below:
@yuxili19 Thanks for the reply above! I got the code running! Below are the changes I made:
model.save('<your_local_path>')
, and it worked like a charm!core.py
, input_ids is on cpu rather than gpu. Directly running the current version would lead to error. Hence, I added .to(model.device)
after input_ids = tokenizer.encode(sen1+sen2+sen3+sen4+sen5+sen6+sen7, return_tensors='pt')
I'm trying to reproduce the results with Llama-2-7b-chat-hf, but I had the following error. I wonder if there was a mismatch in the expected model. Below is my command line:
And this is the error I received: