sucream commited on
Commit
1a3c5b7
β€’
1 Parent(s): a8a63e0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -86
README.md CHANGED
@@ -1,86 +1,86 @@
1
- ---
2
- language:
3
- - ko
4
- - en
5
- license: apache-2.0
6
- tags:
7
- - text-generation
8
- - qwen2.5
9
- - korean
10
- - instruct
11
- - mlx
12
- - 8bit
13
- pipeline_tag: text-generation
14
- ---
15
-
16
- ## Qwen2.5-7B-Instruct-kowiki-qa-8bit mlx convert model
17
- - Original model is [beomi/Qwen2.5-7B-Instruct-kowiki-qa](https://huggingface.co/beomi/Qwen2.5-7B-Instruct-kowiki-qa)
18
-
19
-
20
- ## Requirement
21
- - `pip install mlx-lm`
22
-
23
- ## Usage
24
- - [Generate with CLI](https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md#command-line)
25
- ```bash
26
- mlx_lm.generate --model sucream/Qwen2.5-7B-Instruct-kowiki-qa-8bit --prompt "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
27
- ```
28
-
29
- - [In Python](https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md#python-api)
30
- ```python
31
- from mlx_lm import load, generate
32
-
33
- model, tokenizer = load(
34
- "sucream/Qwen2.5-7B-Instruct-kowiki-qa-8bit",
35
- tokenizer_config={"trust_remote_code": True},
36
- )
37
-
38
- prompt = "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
39
-
40
- messages = [
41
- {"role": "system", "content": "당신은 μΉœμ² ν•œ μ±—λ΄‡μž…λ‹ˆλ‹€."},
42
- {"role": "user", "content": prompt},
43
- ]
44
- prompt = tokenizer.apply_chat_template(
45
- messages,
46
- tokenize=False,
47
- add_generation_prompt=True,
48
- )
49
-
50
- text = generate(
51
- model,
52
- tokenizer,
53
- prompt=prompt,
54
- # verbose=True,
55
- # max_tokens=8196,
56
- # temp=0.0,
57
- )
58
- ```
59
-
60
- - [OpenAI Compitable HTTP Server](https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/SERVER.md)
61
- ```bash
62
- mlx_lm.server --model sucream/Qwen2.5-7B-Instruct-kowiki-qa-8bit --host 0.0.0.0
63
- ```
64
-
65
- ```python
66
- import openai
67
-
68
-
69
- client = openai.OpenAI(
70
- base_url="http://localhost:8080/v1",
71
- )
72
-
73
- prompt = "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
74
-
75
- messages = [
76
- {"role": "system", "content": "당신은 μΉœμ ˆν•œ μ±—λ΄‡μž…λ‹ˆλ‹€.",},
77
- {"role": "user", "content": prompt},
78
- ]
79
- res = client.chat.completions.create(
80
- model='sucream/Qwen2.5-7B-Instruct-kowiki-qa-8bit',
81
- messages=messages,
82
- temperature=0.2,
83
- )
84
-
85
- print(res.choices[0].message.content)
86
- ```
 
1
+ ---
2
+ language:
3
+ - ko
4
+ - en
5
+ license: apache-2.0
6
+ tags:
7
+ - text-generation
8
+ - qwen2.5
9
+ - korean
10
+ - instruct
11
+ - mlx
12
+ - 8bit
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ ## Qwen2.5-7B-Instruct-kowiki-qa-8bit mlx convert model
17
+ - Original model is [beomi/Qwen2.5-7B-Instruct-kowiki-qa](https://huggingface.co/beomi/Qwen2.5-7B-Instruct-kowiki-qa)
18
+
19
+
20
+ ## Requirement
21
+ - `pip install mlx-lm`
22
+
23
+ ## Usage
24
+ - [Generate with CLI](https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md#command-line)
25
+ ```bash
26
+ mlx_lm.generate --model mlx-community/Qwen2.5-7B-Instruct-kowiki-qa-8bit --prompt "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
27
+ ```
28
+
29
+ - [In Python](https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md#python-api)
30
+ ```python
31
+ from mlx_lm import load, generate
32
+
33
+ model, tokenizer = load(
34
+ "mlx-community/Qwen2.5-7B-Instruct-kowiki-qa-8bit",
35
+ tokenizer_config={"trust_remote_code": True},
36
+ )
37
+
38
+ prompt = "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
39
+
40
+ messages = [
41
+ {"role": "system", "content": "당신은 μΉœμ² ν•œ μ±—λ΄‡μž…λ‹ˆλ‹€."},
42
+ {"role": "user", "content": prompt},
43
+ ]
44
+ prompt = tokenizer.apply_chat_template(
45
+ messages,
46
+ tokenize=False,
47
+ add_generation_prompt=True,
48
+ )
49
+
50
+ text = generate(
51
+ model,
52
+ tokenizer,
53
+ prompt=prompt,
54
+ # verbose=True,
55
+ # max_tokens=8196,
56
+ # temp=0.0,
57
+ )
58
+ ```
59
+
60
+ - [OpenAI Compitable HTTP Server](https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/SERVER.md)
61
+ ```bash
62
+ mlx_lm.server --model mlx-community/Qwen2.5-7B-Instruct-kowiki-qa-8bit --host 0.0.0.0
63
+ ```
64
+
65
+ ```python
66
+ import openai
67
+
68
+
69
+ client = openai.OpenAI(
70
+ base_url="http://localhost:8080/v1",
71
+ )
72
+
73
+ prompt = "ν•˜λŠ˜μ΄ νŒŒλž€ μ΄μœ κ°€ 뭐야?"
74
+
75
+ messages = [
76
+ {"role": "system", "content": "당신은 μΉœμ ˆν•œ μ±—λ΄‡μž…λ‹ˆλ‹€.",},
77
+ {"role": "user", "content": prompt},
78
+ ]
79
+ res = client.chat.completions.create(
80
+ model='mlx-community/Qwen2.5-7B-Instruct-kowiki-qa-8bit',
81
+ messages=messages,
82
+ temperature=0.2,
83
+ )
84
+
85
+ print(res.choices[0].message.content)
86
+ ```