Add MLX int4 variant
Browse files- .gitattributes +1 -0
- 1_8b/mlx/config.json +49 -0
- 1_8b/mlx/hy_mt2_1_8b_mlx_int4.pte +3 -0
- README.md +3 -1
.gitattributes
CHANGED
|
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da4w.pte filter=lfs diff=lfs merge=lfs -text
|
| 37 |
1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da8w.pte filter=lfs diff=lfs merge=lfs -text
|
| 38 |
1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 36 |
1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da4w.pte filter=lfs diff=lfs merge=lfs -text
|
| 37 |
1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da8w.pte filter=lfs diff=lfs merge=lfs -text
|
| 38 |
1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
1_8b/mlx/hy_mt2_1_8b_mlx_int4.pte filter=lfs diff=lfs merge=lfs -text
|
1_8b/mlx/config.json
CHANGED
|
@@ -60,6 +60,55 @@
|
|
| 60 |
"use_kv_cache": true,
|
| 61 |
"use_sdpa_with_kv_cache": true
|
| 62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
}
|
| 64 |
]
|
| 65 |
}
|
|
|
|
| 60 |
"use_kv_cache": true,
|
| 61 |
"use_sdpa_with_kv_cache": true
|
| 62 |
}
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"file": "hy_mt2_1_8b_mlx_int4.pte",
|
| 66 |
+
"precision": "int4",
|
| 67 |
+
"quantized": true,
|
| 68 |
+
"default": false,
|
| 69 |
+
"methods": {
|
| 70 |
+
"enable_dynamic_shape": true,
|
| 71 |
+
"forward": {
|
| 72 |
+
"inputs": [
|
| 73 |
+
{
|
| 74 |
+
"shape": [
|
| 75 |
+
1,
|
| 76 |
+
{
|
| 77 |
+
"min": 1,
|
| 78 |
+
"max": 1023
|
| 79 |
+
}
|
| 80 |
+
],
|
| 81 |
+
"dtype": "int64"
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"shape": [
|
| 85 |
+
1
|
| 86 |
+
],
|
| 87 |
+
"dtype": "int64"
|
| 88 |
+
}
|
| 89 |
+
],
|
| 90 |
+
"outputs": [
|
| 91 |
+
{
|
| 92 |
+
"shape": [
|
| 93 |
+
1,
|
| 94 |
+
120818
|
| 95 |
+
],
|
| 96 |
+
"dtype": "float32"
|
| 97 |
+
}
|
| 98 |
+
]
|
| 99 |
+
},
|
| 100 |
+
"get_bos_id": 120000,
|
| 101 |
+
"get_eos_ids": [
|
| 102 |
+
120020,
|
| 103 |
+
120001
|
| 104 |
+
],
|
| 105 |
+
"get_max_context_len": 1024,
|
| 106 |
+
"get_max_seq_len": 1024,
|
| 107 |
+
"get_n_layers": 32,
|
| 108 |
+
"get_vocab_size": 120818,
|
| 109 |
+
"use_kv_cache": true,
|
| 110 |
+
"use_sdpa_with_kv_cache": true
|
| 111 |
+
}
|
| 112 |
}
|
| 113 |
]
|
| 114 |
}
|
1_8b/mlx/hy_mt2_1_8b_mlx_int4.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5131e3ded8a26bdea6c39f9d920185ae96f2d041f46be5d9074951a31e71805
|
| 3 |
+
size 952007552
|
README.md
CHANGED
|
@@ -20,11 +20,13 @@ Upstream model: [tencent/Hy-MT2-1.8B](https://huggingface.co/tencent/Hy-MT2-1.8B
|
|
| 20 |
| `1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da4w.pte` | xnnpack | 8da4w |
|
| 21 |
| `1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da8w.pte` | xnnpack | 8da8w |
|
| 22 |
| `1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte` | mlx | int8 |
|
|
|
|
| 23 |
|
| 24 |
## Repository structure
|
| 25 |
|
| 26 |
```
|
| 27 |
1_8b/mlx/config.json 1.5 kB
|
|
|
|
| 28 |
1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte 1.8 GB
|
| 29 |
1_8b/tokenizer.json 5.2 MB
|
| 30 |
1_8b/tokenizer_config.json 166.5 kB
|
|
@@ -52,7 +54,7 @@ first.
|
|
| 52 |
|
| 53 |
XNNPACK uses dynamic int8 activations with int4 weights (group 32, the default)
|
| 54 |
or per-channel int8 weights; 4-bit costs 0.2-1.5 BLEU for 43% less size and
|
| 55 |
-
1.5x faster decode. MLX uses int8 weight-only. Prompt it as the model card does, with no
|
| 56 |
system prompt:
|
| 57 |
|
| 58 |
```
|
|
|
|
| 20 |
| `1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da4w.pte` | xnnpack | 8da4w |
|
| 21 |
| `1_8b/xnnpack/hy_mt2_1_8b_xnnpack_8da8w.pte` | xnnpack | 8da8w |
|
| 22 |
| `1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte` | mlx | int8 |
|
| 23 |
+
| `1_8b/mlx/hy_mt2_1_8b_mlx_int4.pte` | mlx | int4 |
|
| 24 |
|
| 25 |
## Repository structure
|
| 26 |
|
| 27 |
```
|
| 28 |
1_8b/mlx/config.json 1.5 kB
|
| 29 |
+
1_8b/mlx/hy_mt2_1_8b_mlx_int4.pte 952.0 MB
|
| 30 |
1_8b/mlx/hy_mt2_1_8b_mlx_int8.pte 1.8 GB
|
| 31 |
1_8b/tokenizer.json 5.2 MB
|
| 32 |
1_8b/tokenizer_config.json 166.5 kB
|
|
|
|
| 54 |
|
| 55 |
XNNPACK uses dynamic int8 activations with int4 weights (group 32, the default)
|
| 56 |
or per-channel int8 weights; 4-bit costs 0.2-1.5 BLEU for 43% less size and
|
| 57 |
+
1.5x faster decode. MLX uses int8 (default) or int4 (group 64) weight-only; int4 is ~35% faster on an iPhone 16 but loses 3.4 BLEU on en->zh. Prompt it as the model card does, with no
|
| 58 |
system prompt:
|
| 59 |
|
| 60 |
```
|