运行Chatglm2-6b-int4出错

我用的程序是:

from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("ZhipuAI/chatglm2-6b-int4", trust_remote_code=True)
model = AutoModel.from_pretrained("ZhipuAI/chatglm2-6b-int4", trust_remote_code=True).cuda()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
response, history = model.chat(tokenizer, "晚上睡不着应该怎么办", history=history)
print(response)

出的错误是:

File ~/.cache/huggingface/modules/transformers_modules/chatglm2-6b-int4/quantization.py:287, in extract_weight_to_half(weight, scale_list, source_bit_width)
285 func = kernels.int8WeightExtractionHalf
286 elif source_bit_width == 4:
--> 287 func = kernels.int4WeightExtractionHalf
288 else:
289 assert False, "Unsupported bit-width"

AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'

展开
收起
alicl 2023-08-07 20:47:05 401 分享 版权
1 条回答
写回答
取消 提交回答
  • 同问题,请问解决了嘛?

    2023-09-05 14:03:03
    赞同 展开评论

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352

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