SJTU-IPADS / PowerInfer

High-speed Large Language Model Serving on PCs with Consumer-grade GPUs
MIT License
7.9k stars 405 forks source link

对稠密激活Llama模型的兼容性问题 Compatibility issue with densely activated Llama models #100

Open 1562668477 opened 9 months ago

1562668477 commented 9 months ago

运行的指令如下: ./main -m ./models/ReluLLaMA-13B/ggml-model-f16.gguf -n 128 -t 8 -p "Once upon a time"

1562668477 commented 9 months ago

这里的 models/ReluLLaMA-13B/ggml-model-f16.gguf 是由 SparseLLM/ReluLLaMA-13B (https://huggingface.co/SparseLLM/ReluLLaMA-13B) 使用 llama.cpp 的 convert.py 转换得到的,在 llama.cpp 上 测试是可以正常运行的,在 PowerInfo 上会出现 coredump。PowerInfer/ReluLLaMA-13B-Predictor](https://huggingface.co/PowerInfer/ReluLLaMA-13B-Predictor) 这个model 在 powerInfo 上测试是可以正常运行的。

hodlen commented 9 months ago

这是预期之内的错误。请参考README中的Converting weights部分,并使用PowerInfer仓库中的/convert.py进行转换。需要注意的是,这个转换脚本与llama.cpp中的convert.py在运作方式和参数上都有所不同。

使用llama.cpp的convert.py并不能使模型以稀疏激活模式运行,而只能以稠密激活的兼容模式运行。这样做无法发挥 PowerInfer 带来的速度优势。你提到的coredump应该是我们在兼容此类模型时尚未解决的bug。感谢你的尝试,我们会在本 issue 中跟踪这个bug。


This error is within our expectations. Please refer to the Converting weights section in the README and use the /convert.py script from the PowerInfer repository for conversion. It operates differently from the convert.py in llama.cpp, both in terms of functionality and parameters.

Using convert.py from llama.cpp will not enable the model to run in sparse activation mode, but rather in dense activation mode. So it cannot leverage the speed advantages of PowerInfer. The coredump issue you mentioned is likely an unresolved bug in our compatibility with such models. Thank you for your attempt; we will continue to track the bug in this thread.

hodlen commented 9 months ago

此外,llama.cpp能够运行上游的ReluLLaMA-13B不是预期之内的正常现象。这是因为模型的权重是经过了ReLU激活函数微调,而llama.cpp对于LLaMA类模型依然使用SiLU激活函数,这导致激活函数不匹配。


Additionally, the fact that llama.cpp can run the upstream ReluLLaMA-13B model is not an expected normal behaviour. This is because the weights of the model have been fine-tuned with the ReLU activation function, while llama.cpp still uses the SiLU activation function for LLaMA-class models, leading to a mismatch in activation functions.

1562668477 commented 9 months ago

哦哦,理解了。也就是说 ReluLLaMA-13B 这个model 目前只有在和 predictor weights 一起经过 powerInfo 的 convert.py 之后才能运行。 目前的 powerInfo 和 llama.cpp ( llama.cpp 可以跑,但是流程有问题)对 original ReluLLaMA-13B 都不支持。powerInfo 需要对稠密激活 Llama 模型做兼容适配。

hodlen commented 9 months ago

也就是说 ReluLLaMA-13B 这个model 目前只有在和 predictor weights 一起经过 powerInfo 的 convert.py 之后才能运行。

对于目前PowerInfer支持的所有模型都是如此。

目前的 powerInfo 和 llama.cpp ( llama.cpp 可以跑,但是流程有问题)对 original ReluLLaMA-13B 都不支持。powerInfo 需要对稠密激活 Llama 模型做兼容适配。

是的。llama.cpp是不支持ReLU激活函数的Llama模型的。PowerInfer做过稠密激活模型的兼容性支持,但是可能某个时刻代码中引入了一个bug,导致了目前你看到的问题。

1562668477 commented 8 months ago

请问 PowerInfer/ReluLLaMA-13B-PowerInfer-GGUF(https://huggingface.co/PowerInfer/ReluLLaMA-13B-PowerInfer-GGUF 这个 model 对应的 chat 模板是什么?(不是 Alpaca 系列模板?)原始模型对应着哪个具体版本(meta llama)?