Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问该项目不支持4.40.0以上的Transformers吗? #87

Open
cqdyf099 opened this issue Dec 19, 2024 · 0 comments
Open

请问该项目不支持4.40.0以上的Transformers吗? #87

cqdyf099 opened this issue Dec 19, 2024 · 0 comments

Comments

@cqdyf099
Copy link

cqdyf099 commented Dec 19, 2024

作者您好,我想在c_mteb(https://arxiv.org/abs/2309.07597)
上测试一下该模型的性能(一个词嵌入质量评估的benchmark),c_mteb库貌似在Transformers库低于4.40.0时就无法import,而在Transformers版本大于4.40.0的时候,也就是您requirements.txt中给到的4.33.2,就会在推理阶段报错(报错信息注释在代码行了)

import transformers
model_dir = 'path/to/the_model'
tokenizer = transformers.AutoTokenizer.from_pretrained(model_dir)
model = transformers.AutoModelForCausalLM.from_pretrained(model_dir,device_map="auto")
device = model.device

sentence = "喜欢唱跳rap篮球"
input_ids = tokenizer.encode(sentence, return_tensors='pt')
input_ids = input_ids.to(device)
print(input_ids)
out = model(input_ids, #报错行代码,只要把Transformers版本降到4.33.2后就不会报错了
output_hidden_states=True,
output_attentions=True
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant