QwenLM / qwen.cpp

C++ implementation of Qwen-LM
Other
506 stars 40 forks source link

[BUG] Qwen-1.8-Chat,用llama.cpp量化为f16,然后推理回答错乱,请问1.8在llama.cpp还不支持吗? #69

Open Lyzin opened 6 months ago

Lyzin commented 6 months ago

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

当前行为 | Current Behavior

使用llama.cpp项目先转化为f16 python3 convert-hf-to-gguf.py models/Qwen-1_8B-Chat/

然后推理 ./main -m ./models/Qwen-1_8B-Chat/ggml-model-f16.gguf -n 512 --color -i -cml -f prompts/chat-with-qwen.txt

但是回答错乱,1.8B是不支持llama.cpp量化吗? image

同样试了转为int4量化,也是出现回答错乱

期望行为 | Expected Behavior

期望可以正常回答

复现方法 | Steps To Reproduce

下载llama.cpp项目 下载Qwen-1_8B-Chat模型 转化模型为f16精度 再转为int4量化版本推理

推理出现回答错乱看不懂

运行环境 | Environment

- OS: macos
- Python: 3.9
- Transformers:
- PyTorch: 
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

Lyzin commented 6 months ago

我重新验证了下,因为llama.cpp在mac os默认开启了metal,然后llama.cpp编译的main推理时默认使用了mac os系统的显卡推理,就会出现回答看不懂的情况,但关闭macos的显卡推理,就回答一切正常,请官方也帮忙看看是不是有这个问题

完整启动命令

关闭mac os显卡推理,添加 -ngl 0参数

./main -m ./models/Qwen-1_8B-Chat/ggml-model-q4_0.gguf -n 512 --color -i -cml -ngl 0 -f prompts/chat-with-qwen.txt image

ban-shi-yi-sheng commented 6 months ago

你能转换成功也是nb 我这用llama的转换都不行 那边现在是gguf格式了 这边刚出来怎么qwen.cpp 转换的是ggml格式呢? 能不能无缝转成gguf格式啊 这样就能llama使用了 那边服务端也能运行了

ban-shi-yi-sheng commented 6 months ago

是我见识浅薄了 python3 convert-hf-to-gguf.py 用这个可以转 转完用q8_0量化 刚开始用确实有几次跟发神经似的 不过现在貌似好了 ....

./main -m /Users/xxxx/AI/Models/Qwen-14B-Chat/ggml-model-f16-q8_0.gguf \                                                          ─╯
--color -i -ngl 1 -c 4096 -t 8 --temp 0.5 --top_k 40 --top_p 0.9 --repeat_penalty 1.1 -f /Users/xxxxx/AI/llama.cpp/prompts/chat-with-qwen.txt -cml
image
100ZZ commented 1 month ago

是的,我试了qwen 0.5B,7B,14B,用llama.cpp转换F16的GGUF,回答还都是错乱的