BitVoyage commited on
Commit
096602d
1 Parent(s): 80aff33

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -5
README.md CHANGED
@@ -1,5 +1,75 @@
1
- ---
2
- license: other
3
- license_name: license
4
- license_link: LICENSE
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
13
+ 此为[Index-1.9B-Chat](https://huggingface.co/IndexTeam/Index-1.9B-Chat)的GGUF版本,适配llama.cpp,同时提供了Ollma的ModelFile适配。
14
+
15
+
16
+ 更多细节详见我们的[GitHub](https://github.com/bilibili/Index-1.9B)和[Index-1.9B技术报告](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)
17
+
18
+ ### LLAMA.CPP
19
+ ```shell
20
+ # 安装llama.cpp(https://github.com/ggerganov/llama.cpp)
21
+ git clone https://github.com/ggerganov/llama.cpp
22
+ cd llama.cpp
23
+ make
24
+
25
+ # 安装llama-cpp-python(https://github.com/abetlen/llama-cpp-python)
26
+ pip install llama-cpp-python
27
+ ```
28
+ llama.cpp终端交互
29
+ ```shell
30
+ ./build/bin/llama-cli -m models/Index-1.9B-Chat/ggml-model-bf16.gguf --color -if
31
+ ```
32
+ **注意!!** llama.cpp并不支持自定义chat_template, 故而需要自己拼接prompt,Index-1.9B的chat_template(示意)为
33
+ ```shell
34
+ # 三个分隔符为 <unk>, reserved_0, reserved_1
35
+ [<unk>]sytem_message[reserved_0]user_message[reserved_1]response
36
+ ```
37
+ 使用llama-cpp-python可支持自定义的chat_template(已写入GGUF,可直接使用)
38
+ ```python
39
+ from llama_cpp import Llama
40
+
41
+ model_path = "Index-1.9B-Chat-GGUF/ggml-model-Q6_K.gguf"
42
+ llm = Llama(model_path =model_path, verbose=True)
43
+ output = llm.create_chat_completion(
44
+ messages = [
45
+ {"role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"},
46
+ #{"role": "system", "content": "你需要扮演B站评论区老哥,用评论区阴阳怪气的话术回复,不要说你是AI"},
47
+ {"role": "user","content": "篮球和鸡有什么关系"}
48
+ ]
49
+ )
50
+ print(output)
51
+ ```
52
+ ### OLLAMA
53
+ - 安装[Ollama](https://github.com/ollama/ollama)
54
+ ```shell
55
+ curl -fsSL https://ollama.com/install.sh | sh
56
+ ```
57
+ ```shell
58
+ # 启动server
59
+ ollama serve
60
+
61
+ # 适配模型, OllamaModelFile中可修改模型文件和System Message
62
+ ollama create Index-1.9B-Chat -f Index-1.9B-Chat-GGUF/OllamaModelFile
63
+
64
+ # 启动终端
65
+ ollama run Index-1.9B-Chat
66
+
67
+ # web调用,可以动态指定System Message
68
+ curl http://localhost:11434/api/chat -d '{
69
+ "model": "Index-1.9B-Chat",
70
+ "messages": [
71
+ { "role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。" },
72
+ { "role": "user", "content": "续写 金坷垃" }
73
+ ]
74
+ }'
75
+ ```