Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(openllama): support openllama-3B #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xingchensong
Copy link
Contributor

Brief Intro

This PR provides a guide to quantize and run openllama-3B.

The reasons why we need openllama-3B:

  1. The 7B is still too large for edge devices like Raspberry Pi which typically has less than 4GB of RAM. 3B makes it possible to run LLM on Raspberry Pi at a practical speed.
  2. We can move beyond the leaked Llama into a truly opened model (apache-2.0 license) while keeping the existing InferLLM code and applications.

Initial Result

image

The answer looks good to me

TODO

  • add demo.gif (in next pr)
  • upload a pre-quantized int4.bin to huggingface

./build/bin/quantize ${PATH_TO_HUGGINGFACE_OPENLLAMA}/ggml-model-f16.bin ggml-model-q4_0.bin q4_0
```

- 克隆仓库后,需要将 commit 回退到 b608b55,因为 InferLLM 最高只支持 ggjt.v1 格式的模型,而 llama.cpp 目前 (commit: 7552ac586380f202b75b18aa216ecfefbd438d94) 已更新到 ggjt.v3 且不向前兼容
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

模型格式是可以自定义的,ChatGLM 中就是自定义的模型格式,自定义的模型格式需要在graph中加对应的解析方法就可以

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get

@@ -0,0 +1,142 @@
diff --git a/convert.py b/convert.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接在 InferLLM 中添加一个convert.py 以及量化的cpp吗?这样就不依赖于llama.cpp这个工程了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,本来的确是这么想的,但是需要一些工作量,所以偷懒用现在这种方式了

@chenqy4933
Copy link
Collaborator

赞,非常好的想法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants