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

AttributeError: 'Qwen2Model' object has no attribute 'encode' #774

Open
ChiZhang-bit opened this issue May 13, 2024 · 1 comment
Open

AttributeError: 'Qwen2Model' object has no attribute 'encode' #774

ChiZhang-bit opened this issue May 13, 2024 · 1 comment

Comments

@ChiZhang-bit
Copy link

在模型调用的时候,会出现没有encode方法的报错。使用的是QWen0.5B模型:
Error while evaluating CmedqaRetrieval: 'Qwen2Model' object has no attribute 'encode' Traceback (most recent call last): File "/data2/mteb/zhangchi/mteb_eval/run_mteb_chinese.py", line 266, in <module> evaluation.run(model, output_folder=f"qwen/qwen_MNR_supervised_v1") File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/mteb/evaluation/MTEB.py", line 271, in run raise e File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/mteb/evaluation/MTEB.py", line 253, in run results = task.evaluate(model, split, **kwargs) File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/mteb/abstasks/AbsTaskRetrieval.py", line 101, in evaluate results = retriever.retrieve(corpus, queries) File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/beir/retrieval/evaluation.py", line 20, in retrieve return self.retriever.search(corpus, queries, self.top_k, self.score_function, **kwargs) File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/beir/retrieval/search/dense/exact_search.py", line 42, in search query_embeddings = self.model.encode_queries( File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/mteb/abstasks/AbsTaskRetrieval.py", line 154, in encode_queries return self.model.encode(queries, batch_size=batch_size, **kwargs) File "/home/zhouzhou/anaconda3/envs/llm2vec/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__ raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") AttributeError: 'Qwen2Model' object has no attribute 'encode'

@staoxiao
Copy link
Collaborator

Qwen2Model is not an embedding model, so it cannot be used to evaluate C-METB.

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

2 participants