JustinLin610 commited on
Commit
25e938c
1 Parent(s): 3a83d4d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -8
README.md CHANGED
@@ -1,23 +1,25 @@
1
  ---
2
- license: apache-2.0
3
  language:
4
  - en
5
  pipeline_tag: text-generation
6
  tags:
 
7
  - chat
 
8
  ---
9
 
10
  # Qwen2-0.5B-Instruct-GGUF
11
 
12
  ## Introduction
13
 
14
- Qwen2 is the new series of Qwen large language models. For Qwen2, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters, including a Mixture-of-Experts model. This repo contains the instruction-tuned 0.5B Qwen2 model.
15
 
16
  Compared with the state-of-the-art opensource language models, including the previous released Qwen1.5, Qwen2 has generally surpassed most opensource models and demonstrated competitiveness against proprietary models across a series of benchmarks targeting for language understanding, language generation, multilingual capability, coding, mathematics, reasoning, etc.
17
 
18
  For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2/), [GitHub](https://github.com/QwenLM/Qwen2), and [Documentation](https://qwen.readthedocs.io/en/latest/).
19
 
20
- In this repo, we provide `fp16` model and quantized models in the GGUF formats, including `q2_k`, `q3_k_m`, `q4_0`, `q4_k_m`, `q5_0`, `q5_k_m`, `q6_k` and `q8_0`.
 
21
 
22
  ## Model Details
23
  Qwen2 is a language model series including decoder language models of different model sizes. For each size, we release the base language model and the aligned chat model. It is based on the Transformer architecture with SwiGLU activation, attention QKV bias, group query attention, etc. Additionally, we have an improved tokenizer adaptive to multiple natural languages and codes.
@@ -27,18 +29,51 @@ We pretrained the models with a large amount of data, and we post-trained the mo
27
 
28
 
29
  ## Requirements
30
- We advise you to clone [`llama.cpp`](https://github.com/ggerganov/llama.cpp) and install it following the official guide.
 
31
 
32
 
33
  ## How to use
34
  Cloning the repo may be inefficient, and thus you can manually download the GGUF file that you need or use `huggingface-cli` (`pip install huggingface_hub`) as shown below:
35
  ```shell
36
- huggingface-cli download Qwen/Qwen2-0.5B-Instruct-GGUF qwen2-0_5b-instruct-q8_0.gguf --local-dir . --local-dir-use-symlinks False
37
  ```
38
 
39
- We demonstrate how to use `llama.cpp` to run Qwen2:
40
- ```shell
41
- ./main -m qwen2-0_5b-instruct-q8_0.gguf -n 512 --color -i -cml -f prompts/chat-with-qwen.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ```
43
 
44
  ## Citation
 
1
  ---
 
2
  language:
3
  - en
4
  pipeline_tag: text-generation
5
  tags:
6
+ - instruct
7
  - chat
8
+ license: apache-2.0
9
  ---
10
 
11
  # Qwen2-0.5B-Instruct-GGUF
12
 
13
  ## Introduction
14
 
15
+ Qwen2 is the new series of Qwen large language models. For Qwen2, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters, including a Mixture-of-Experts model (57B-A14B). This repo contains the instruction-tuned 0.5B Qwen2 model.
16
 
17
  Compared with the state-of-the-art opensource language models, including the previous released Qwen1.5, Qwen2 has generally surpassed most opensource models and demonstrated competitiveness against proprietary models across a series of benchmarks targeting for language understanding, language generation, multilingual capability, coding, mathematics, reasoning, etc.
18
 
19
  For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2/), [GitHub](https://github.com/QwenLM/Qwen2), and [Documentation](https://qwen.readthedocs.io/en/latest/).
20
 
21
+ In this repo, we provide quantized models in the GGUF formats, including `q2_k`, `q3_k_m`, `q4_0`, `q4_k_m`, `q5_0`, `q5_k_m`, `q6_k` and `q8_0`.
22
+
23
 
24
  ## Model Details
25
  Qwen2 is a language model series including decoder language models of different model sizes. For each size, we release the base language model and the aligned chat model. It is based on the Transformer architecture with SwiGLU activation, attention QKV bias, group query attention, etc. Additionally, we have an improved tokenizer adaptive to multiple natural languages and codes.
 
29
 
30
 
31
  ## Requirements
32
+ We advise you to clone [`llama.cpp`](https://github.com/ggerganov/llama.cpp) and install it following the official guide. We follow the latest version of llama.cpp.
33
+ In the following demonstration, we assume that you are running commands under the repository `llama.cpp`.
34
 
35
 
36
  ## How to use
37
  Cloning the repo may be inefficient, and thus you can manually download the GGUF file that you need or use `huggingface-cli` (`pip install huggingface_hub`) as shown below:
38
  ```shell
39
+ huggingface-cli download Qwen/Qwen2-0.5B-Instruct-GGUF qwen2-0.5b-instruct-q5_k_m.gguf --local-dir . --local-dir-use-symlinks False
40
  ```
41
 
42
+ With the upgrade of APIs of llama.cpp, `llama-gguf-split` is equivalent to the previous `gguf-split`.
43
+ For the arguments of this command, the first is the path to the first split GGUF file, and the second is the path to the output GGUF file.
44
+
45
+
46
+ To run Qwen2, you can use `llama-cli` (the previous `main`) or `llama-server` (the previous `server`).
47
+ We recommend using the `llama-server` as it is simple and compatible with OpenAI API. For example:
48
+
49
+ ```bash
50
+ ./llama-server -m qwen2-0.5b-instruct-q5_k_m.gguf
51
+ ```
52
+
53
+ Then it is easy to access the deployed service with OpenAI API:
54
+
55
+ ```python
56
+ import openai
57
+
58
+ client = openai.OpenAI(
59
+ base_url="http://localhost:8080/v1", # "http://<Your api-server IP>:port"
60
+ api_key = "sk-no-key-required"
61
+ )
62
+
63
+ completion = client.chat.completions.create(
64
+ model="qwen",
65
+ messages=[
66
+ {"role": "system", "content": "You are a helpful assistant."},
67
+ {"role": "user", "content": "tell me something about michael jordan"}
68
+ ]
69
+ )
70
+ print(completion.choices[0].message.content)
71
+ ```
72
+
73
+ If you choose to use `llama-cli`, pay attention to the removal of `-cml` for the ChatML template. Instead you should use `--in-prefix` and `--in-suffix` to tackle this problem.
74
+
75
+ ```bash
76
+ ./llama-cli -m qwen2-0.5b-instruct-q5_k_m.gguf -n 512 -co -i -if -f prompts/chat-with-qwen.txt --in-prefix "<|im_start|>user\n" --in-suffix "<|im_end|>\n<|im_start|>assistant\n"
77
  ```
78
 
79
  ## Citation