Create README.md
#1
by
zx-modelcloud
- opened
README.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This model was exported using [GPTQModel](https://github.com/ModelCloud/GPTQModel). Below is example code for exporting a model from GPTQ format to MLX format.
|
2 |
+
|
3 |
+
## Example:
|
4 |
+
```python
|
5 |
+
from gptqmodel import GPTQModel
|
6 |
+
|
7 |
+
# load gptq quantized model
|
8 |
+
gptq_model_path = "ModelCloud/Qwen2.5-Coder-32B-Instruct-gptqmodel-4bit-vortex-v1"
|
9 |
+
mlx_path = f"./vortex/ModelCloud/Qwen2.5-Coder-32B-Instruct-gptqmodel-4bit-vortex-mlx-v1"
|
10 |
+
|
11 |
+
# export to mlx model
|
12 |
+
GPTQModel.export(gptq_model_path, mlx_path, "mlx")
|
13 |
+
|
14 |
+
# load mlx model check if it works
|
15 |
+
from mlx_lm import load, generate
|
16 |
+
|
17 |
+
mlx_model, tokenizer = load(mlx_path)
|
18 |
+
prompt = "The capital of France is"
|
19 |
+
|
20 |
+
messages = [{"role": "user", "content": prompt}]
|
21 |
+
prompt = tokenizer.apply_chat_template(
|
22 |
+
messages, add_generation_prompt=True
|
23 |
+
)
|
24 |
+
|
25 |
+
text = generate(mlx_model, tokenizer, prompt=prompt, verbose=True)
|
26 |
+
```
|