You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
进行P-Tuning V2微调后推理时出现的问题:ValueError: not enough values to unpack (expected 2, got 1) #227
Traceback (most recent call last):
File "end_finally_test.py", line 80, in <module>
response, history = model.chat(tokenizer,MutilTalk_Prompt,history=[])
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/root/.cache/huggingface/modules/transformers_modules/chatglm3-6b-32k/modeling_chatglm.py", line 1042, in chat
response, history = self.process_response(response, history)
File "/root/.cache/huggingface/modules/transformers_modules/chatglm3-6b-32k/modeling_chatglm.py", line 1006, in process_response
metadata, content = response.split("\n", maxsplit=1)
ValueError: not enough values to unpack (expected 2, got 1)
Activity
mzh1996 commentedon Nov 9, 2023
看到有人说 在代码里加一个检查 如果response里没有"\n",就 response = "\n" + response
LittleGreenYuan commentedon Nov 9, 2023
非常感谢您的建议,我去尝试一些这种方法,同时也对微调的answer进行格式化处理~
SherryGiii commentedon Nov 9, 2023
请问你解决了吗?
LittleGreenYuan commentedon Nov 10, 2023
这种方法是可以的绕过这个错误的,
将下载模型文件夹中的modeling_chatglm.py文件,大约1006行的位置如下操作
修改成
相当于对产生的结果进行安全判断一次,但是这种情况出现的原因仍然没办法在微调后解决,即便已经输出的文本前添加了'\n'。