使用modelscope、Qwen1.8B-chat 模型推理时报错编码错误

使用modelscope、Qwen1.8B-chat 模型推理时报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)

代码如下:

from modelscope import AutoModelForCausalLM, AutoTokenizer, GenerationConfig

tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-1_8B-Chat", revision='master', trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-1_8B-Chat", revision='master', device_map="auto", trust_remote_code=True).eval()

msg = "hello, who are you?"
response, history = model.chat(tokenizer, msg, history=None)
print(response)

报错如下图所示,且报错指向位置如箭头所示:

image.png

展开
收起
pklim101 2025-07-14 21:34:53 82 分享 版权
0 条回答
写回答
取消 提交回答

包含命名实体识别、文本分类、分词、关系抽取、问答、推理、文本摘要、情感分析、机器翻译等多个领域

热门讨论

热门文章

还有其他疑问?
咨询AI助理