Update README.md
Browse files
README.md
CHANGED
|
@@ -1,19 +1,17 @@
|
|
| 1 |
-
This model was exported using [GPTQModel](https://github.com/ModelCloud/GPTQModel).
|
| 2 |
|
| 3 |
-
##
|
| 4 |
-
```python
|
| 5 |
-
from gptqmodel import GPTQModel
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
# export to mlx model
|
| 12 |
-
GPTQModel.export(gptq_model_path, mlx_path, "mlx")
|
| 13 |
|
| 14 |
-
|
| 15 |
from mlx_lm import load, generate
|
| 16 |
|
|
|
|
| 17 |
mlx_model, tokenizer = load(mlx_path)
|
| 18 |
prompt = "The capital of France is"
|
| 19 |
|
|
@@ -23,4 +21,21 @@ prompt = tokenizer.apply_chat_template(
|
|
| 23 |
)
|
| 24 |
|
| 25 |
text = generate(mlx_model, tokenizer, prompt=prompt, verbose=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
```
|
|
|
|
| 1 |
+
This model was exported using [GPTQModel](https://github.com/ModelCloud/GPTQModel).
|
| 2 |
|
| 3 |
+
## How to run this model
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
```shell
|
| 6 |
+
# install mlx
|
| 7 |
+
pip install mlx_lm
|
| 8 |
+
```
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
```python
|
| 12 |
from mlx_lm import load, generate
|
| 13 |
|
| 14 |
+
mlx_path = "ModelCloud/Qwen2.5-Coder-32B-Instruct-gptqmodel-4bit-vortex-mlx-v1"
|
| 15 |
mlx_model, tokenizer = load(mlx_path)
|
| 16 |
prompt = "The capital of France is"
|
| 17 |
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
text = generate(mlx_model, tokenizer, prompt=prompt, verbose=True)
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
### Export gptq to mlx
|
| 27 |
+
```shell
|
| 28 |
+
# install gptqmodel with mlx
|
| 29 |
+
pip install gptqmodel[mlx] --no-build-isolation
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from gptqmodel import GPTQModel
|
| 34 |
+
|
| 35 |
+
# load gptq quantized model
|
| 36 |
+
gptq_model_path = "ModelCloud/Qwen2.5-Coder-32B-Instruct-gptqmodel-4bit-vortex-v1"
|
| 37 |
+
mlx_path = f"./vortex/ModelCloud/Qwen2.5-Coder-32B-Instruct-gptqmodel-4bit-vortex-mlx-v1"
|
| 38 |
+
|
| 39 |
+
# export to mlx model
|
| 40 |
+
GPTQModel.export(gptq_model_path, mlx_path, "mlx")
|
| 41 |
```
|