huybery commited on
Commit
42d944c
1 Parent(s): 9c81b3c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +69 -3
README.md CHANGED
@@ -1,3 +1,69 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - chat
8
+ ---
9
+
10
+ # Qwen2-1.5B-Instruct-MLX
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/) and [GitHub](https://github.com/QwenLM/Qwen2). This is the MLX quantized model of Qwen2-1.5B-Instruct.
19
+ <br>
20
+
21
+ ## Model Details
22
+ 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.
23
+
24
+ ## Training details
25
+ We pretrained the models with a large amount of data, and we post-trained the models with both supervised finetuning and direct preference optimization.
26
+
27
+
28
+ ## Requirements
29
+
30
+ Run the following commands to install the required MLX packages.
31
+
32
+ ```
33
+ pip install mlx-lm mlx -U
34
+ ```
35
+
36
+
37
+ ## Quickstart
38
+
39
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
40
+
41
+ ```python
42
+ from mlx_lm import load, generate
43
+
44
+ model, tokenizer = load('Qwen/Qwen2-1.5B-Instruct-MLX', tokenizer_config={"eos_token": "<|im_end|>"})
45
+
46
+ prompt = "Give me a short introduction to large language model."
47
+ messages = [
48
+ {"role": "system", "content": "You are a helpful assistant."},
49
+ {"role": "user", "content": prompt}
50
+ ]
51
+ text = tokenizer.apply_chat_template(
52
+ messages,
53
+ tokenize=False,
54
+ add_generation_prompt=True
55
+ )
56
+
57
+ response = generate(model, tokenizer, prompt=text, verbose=True, top_p=0.8, temp=0.7, repetition_penalty=1.05, max_tokens=512)
58
+ ```
59
+
60
+ ## Citation
61
+
62
+ If you find our work helpful, feel free to give us a cite.
63
+
64
+ ```
65
+ @article{qwen2,
66
+ title={Qwen2 Technical Report},
67
+ year={2024}
68
+ }
69
+ ```