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: function_call` #17

Open
wupaopao123 opened this issue Jul 2, 2024 · 0 comments
Open

报错信息:AttributeError: function_call` #17

wupaopao123 opened this issue Jul 2, 2024 · 0 comments

Comments

@wupaopao123
Copy link

请问下述报错是怎么回事?

Traceback (most recent call last): File "/home/guan/shared/StableToolBench/toolbench/tooleval/eval_pass_rate.py", line 100, in <module> example, File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 433, in result return self.__get_result() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result raise self._exception File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry ret = target(*args, **kwargs) File "/home/guan/shared/StableToolBench/toolbench/tooleval/eval_pass_rate.py", line 57, in compute_pass_rate answer_steps, final_step = get_steps(example) File "/home/guan/shared/StableToolBench/toolbench/tooleval/evaluators/registered_cls/rtl.py", line 72, in check_is_solved ret = self.function_call( File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 330, in wrapped_f return self(f, *args, **kw) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 467, in __call__ do = self.iter(retry_state=retry_state) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 368, in iter result = action(retry_state) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 410, in exc_check raise retry_exc.reraise() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 183, in reraise raise self.last_attempt.result() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 433, in result return self.__get_result() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result raise self._exception File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/tenacity/__init__.py", line 470, in __call__ result = fn(*args, **kwargs) File "/home/guan/shared/StableToolBench/toolbench/tooleval/evaluators/registered_cls/tooleval.py", line 100, in function_call ret = json.loads(res.choices[0].message.function_call.arguments) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/openai/openai_object.py", line 61, in __getattr__ raise AttributeError(*err.args) AttributeError: function_call

我打印了一下res的结果,确实没有function_call这个参数:

res = { "id": "chatcmpl-UmkknmfVagXcrYdFaqvkRP", "object": "chat.completion", "created": 1719910808, "model": "Meta-Llama-3-8B-Instruct", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Here is the JSON response:\n\n```\n{\n \"content\": \"The answer provides the channel clips and channel details, including the channel's current live stream, number of viewers and followers, and category. The answer is informative and provides a good overview of the channel. However, it does not explicitly state whether the answer solves the query or not, leaving some uncertainty.\",\n \"answer_status\": \"Unsolved\"\n}\n```\n\nThe answer is informative and provides some details about the channel, but it does not explicitly state whether it solves the query or not. Therefore, I would classify it as \"Unsolved\"." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 374, "total_tokens": 499, "completion_tokens": 125 } }

我修改为如下格式:
ret = res.choices[0].message

但是报错:
Traceback (most recent call last): File "/home/guan/shared/StableToolBench/toolbench/tooleval/eval_pass_rate.py", line 105, in <module> query_id, is_solved, evaluate_time = thd.result() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 433, in result return self.__get_result() File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result raise self._exception File "/root/anaconda3/envs/StableToolBench/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/envs/StableToolBench/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry ret = target(*args, **kwargs) File "/home/guan/shared/StableToolBench/toolbench/tooleval/eval_pass_rate.py", line 62, in compute_pass_rate is_solved, is_solved_reason = evaluator.check_is_solved( File "/home/guan/shared/StableToolBench/toolbench/tooleval/evaluators/registered_cls/rtl.py", line 80, in check_is_solved answer_status = AnswerStatus(ret['answer_status']) KeyError: 'answer_status'

openai版本为0.28.0,使用的本地vllm部署的Meta-Llama-3-8B-Instruct模型

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