ztxz16 / fastllm

纯c++的全平台llm加速库,支持python调用,chatglm-6B级模型单卡可达10000+token / s,支持glm, llama, moss基座,手机端流畅运行
Apache License 2.0
3.28k stars 332 forks source link

在macos intel平台上使用报错 #405

Closed aofengdaxia closed 7 months ago

aofengdaxia commented 7 months ago

直接执行

执行代码

./main -p chatglm3-6b-int4.flm  -l

报错如下:

libc++abi: terminating due to uncaught exception of type std::bad_alloc: std::bad_alloc

python执行

同一台电脑,使用Python测试,代码如下

from fastllm_pytools import llm
from transformers import AutoTokenizer, AutoModel

model = llm.model("./chatglm3-6b-int4.flm")

print(model.response("你好"))

报错信息如下:

FastLLM Error: FileBuffer.ReadString error.

libc++abi: terminating due to uncaught exception of type std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>

电脑硬件,2019年最后一批intel macbook pro ,内存16G

TylunasLi commented 7 months ago

FileBuffer.ReadString error std::bad_alloc 有可能是chatglm3-6b-int4.flm文件错误导致的, 但不能排除 big endian / little endian 或其他原因。 为排除文件影响错误,可以试下这个版本: 链接: https://caiyun.139.com/m/i?115CejW9DWMfy 提取码: vzgL

aofengdaxia commented 7 months ago

我使用LLaMA-factory在双卡4090上把cut_len调整为2048后,就很容易出现这个情况,但是如果在单卡L40上,就没有出现类似问题。不知道是fastllm的问题,还是LLaMA-factory的问题

aofengdaxia commented 7 months ago

我使用chatGLM的transformers代码进行推理,没有报错。