Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: license
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
---
|
| 6 |
+
<div align="center">
|
| 7 |
+
<h1>
|
| 8 |
+
Index-1.9B-Chat-GGUF
|
| 9 |
+
</h1>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
This repository is the GGUF version of [Index-1.9B-Chat](https://huggingface.co/IndexTeam/Index-1.9B-Chat), which adapts to llama.cpp and also provides ModelFile adaptation for Ollma.
|
| 13 |
+
|
| 14 |
+
For more details, see our [GitHub](https://github.com/bilibili/Index-1.9B) and [Index-1.9B Technical Report](https://github.com/bilibili/Index-1.9B/blob/main/Index-1.9B%20%E6%8A%80%E6%9C%AF%E6%8A%A5%E5%91%8A.pdf)
|
| 15 |
+
|
| 16 |
+
### LLAMA.CPP
|
| 17 |
+
```shell
|
| 18 |
+
# Install llama.cpp(https://github.com/ggerganov/llama.cpp)
|
| 19 |
+
git clone https://github.com/ggerganov/llama.cpp
|
| 20 |
+
cd llama.cpp
|
| 21 |
+
make
|
| 22 |
+
|
| 23 |
+
# Install llama-cpp-python(https://github.com/abetlen/llama-cpp-python)
|
| 24 |
+
pip install llama-cpp-python
|
| 25 |
+
```
|
| 26 |
+
llama.cpp terminal
|
| 27 |
+
```shell
|
| 28 |
+
./build/bin/llama-cli -m models/Index-1.9B-Chat/ggml-model-bf16.gguf --color -if
|
| 29 |
+
```
|
| 30 |
+
**Note!!** llama.cpp does not support custom chat_template, so you need to splice prompt yourself. The chat_template of Index-1.9B is
|
| 31 |
+
```shell
|
| 32 |
+
# The three delimiters are <unk>(token_id=0), reserved_0(token_id=3), reserved_1(token_id=4)
|
| 33 |
+
[<unk>]sytem_message[reserved_0]user_message[reserved_1]response
|
| 34 |
+
```
|
| 35 |
+
Use llama-cpp-python to support custom chat_template (already written to GGUF and can be used directly)
|
| 36 |
+
```python
|
| 37 |
+
from llama_cpp import Llama
|
| 38 |
+
|
| 39 |
+
model_path = "Index-1.9B-Chat-GGUF/ggml-model-Q6_K.gguf"
|
| 40 |
+
llm = Llama(model_path =model_path, verbose=True)
|
| 41 |
+
output = llm.create_chat_completion(
|
| 42 |
+
messages = [
|
| 43 |
+
{"role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"},
|
| 44 |
+
#{"role": "system", "content": "你需要扮演B站评论区老哥,用评论区阴阳怪气的话术回复,不要说你是AI"},
|
| 45 |
+
{"role": "user","content": "篮球和鸡有什么关系"}
|
| 46 |
+
]
|
| 47 |
+
)
|
| 48 |
+
print(output)
|
| 49 |
+
```
|
| 50 |
+
### OLLAMA
|
| 51 |
+
- Install [Ollama](https://github.com/ollama/ollama)
|
| 52 |
+
```shell
|
| 53 |
+
curl -fsSL https://ollama.com/install.sh | sh
|
| 54 |
+
```
|
| 55 |
+
```shell
|
| 56 |
+
# Start server
|
| 57 |
+
ollama serve
|
| 58 |
+
|
| 59 |
+
# Adaptation model, model file and System Message can be modified in OllamaModelFile
|
| 60 |
+
ollama create Index-1.9B-Chat -f Index-1.9B-Chat-GGUF/OllamaModelFile
|
| 61 |
+
|
| 62 |
+
# Start Terminal
|
| 63 |
+
ollama run Index-1.9B-Chat
|
| 64 |
+
|
| 65 |
+
# System Message can be specified dynamically
|
| 66 |
+
curl http://localhost:11434/api/chat -d '{
|
| 67 |
+
"model": "Index-1.9B-Chat",
|
| 68 |
+
"messages": [
|
| 69 |
+
{ "role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。" },
|
| 70 |
+
{ "role": "user", "content": "续写 金坷垃" }
|
| 71 |
+
]
|
| 72 |
+
}'
|
| 73 |
+
```
|