iris-sfg commited on
Commit
29c8d08
·
verified ·
1 Parent(s): b93926f

Initial upload: Q4 fp16 voxtral realtime

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tekken.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Voxtral-Mini-4B-Realtime-2602
3
+ language:
4
+ - ar
5
+ - de
6
+ - en
7
+ - es
8
+ - fr
9
+ - hi
10
+ - it
11
+ - nl
12
+ - pt
13
+ - zh
14
+ - ja
15
+ - ko
16
+ - ru
17
+ library_name: mlx
18
+ license: apache-2.0
19
+ pipeline_tag: automatic-speech-recognition
20
+ tags:
21
+ - mlx
22
+ - mlx-audio
23
+ - speech-to-text
24
+ - streaming
25
+ - realtime
26
+ - voxtral
27
+ - fp16
28
+ ---
29
+
30
+ # Voxtral Mini 4B Realtime 4bit (float16)
31
+
32
+ This is a **4-bit quantized, float16-base** [MLX](https://github.com/ml-explore/mlx) conversion of [mistralai/Voxtral-Mini-4B-Realtime-2602](https://huggingface.co/mistralai/Voxtral-Mini-4B-Realtime-2602).
33
+
34
+ ## Which variant should you pick?
35
+
36
+ | Chip | Recommended | Why |
37
+ |----------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
38
+ | **M1 / M2** | **This repo (`-4bit-fp16`)** | Metal on M1/M2 has no native `bfloat16` ALU; bf16 ops fall back to a slower path. `float16` stays on the fast GPU path. |
39
+ | **M3 / M4+** | [`iris-sfg/Voxtral-Mini-4B-Realtime-2602-4bit`](https://huggingface.co/iris-sfg/Voxtral-Mini-4B-Realtime-2602-4bit) (bf16) | bf16 is natively supported and gives the same speed as fp16 with a wider dynamic range (slightly safer numerics). |
40
+
41
+ Only the non-quantized weights differ between the two repos (norms, biases, scales, some embeddings). The quantized mat-mul weights are bit-identical. Transcription output is byte-identical on a 20 s French clip at temperature 0 (verified locally).
42
+
43
+ ## Conversion
44
+
45
+ Source model:
46
+
47
+ - `mistralai/Voxtral-Mini-4B-Realtime-2602`
48
+
49
+ Local conversion command:
50
+
51
+ ```bash
52
+ python -m mlx_audio.convert \
53
+ --hf-path mistralai/Voxtral-Mini-4B-Realtime-2602 \
54
+ --mlx-path /path/to/Voxtral-Mini-4B-Realtime-2602-4bit-fp16 \
55
+ --quantize \
56
+ --q-group-size 64 \
57
+ --q-bits 4 \
58
+ --dtype float16 \
59
+ --model-domain stt
60
+ ```
61
+
62
+ Quantization config:
63
+
64
+ - bits: `4`
65
+ - group size: `64`
66
+ - mode: `affine`
67
+ - non-quant dtype: `float16`
68
+
69
+ ## Files
70
+
71
+ Only the MLX runtime artifacts needed for inference:
72
+
73
+ - `model.safetensors`
74
+ - `model.safetensors.index.json`
75
+ - `config.json`
76
+ - `generation_config.json`
77
+ - `params.json`
78
+ - `processor_config.json`
79
+ - `tekken.json`
80
+
81
+ ## Usage
82
+
83
+ ```bash
84
+ pip install "mlx-audio[stt]"
85
+ ```
86
+
87
+ ```python
88
+ from mlx_audio.stt.utils import load_model
89
+
90
+ model = load_model("iris-sfg/Voxtral-Mini-4B-Realtime-2602-4bit-fp16")
91
+ result = model.generate("audio.wav")
92
+ print(result.text)
93
+ ```
94
+
95
+ ## Notes
96
+
97
+ - Base model license remains Apache 2.0.
98
+ - On M3/M4, prefer the `-4bit` (bf16) repo; there is no speed benefit to fp16 there and bf16's wider exponent range is slightly more robust.
99
+ - Transcription quality was verified identical to the bf16 variant at `temperature=0` on a 20 s French parliamentary audio clip.
config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "VoxtralRealtimeForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "activation_function": "gelu",
7
+ "attention_dropout": 0.0,
8
+ "head_dim": 64,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 1280,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 5120,
13
+ "max_position_embeddings": 1500,
14
+ "model_type": "voxtral_realtime_encoder",
15
+ "num_attention_heads": 32,
16
+ "num_hidden_layers": 32,
17
+ "num_key_value_heads": 32,
18
+ "num_mel_bins": 128,
19
+ "rms_norm_eps": 1e-05,
20
+ "rope_parameters": {
21
+ "rope_theta": 1000000.0,
22
+ "rope_type": "default"
23
+ },
24
+ "sliding_window": 750,
25
+ "vocab_size": 131072
26
+ },
27
+ "audio_length_per_tok": 8,
28
+ "default_num_delay_tokens": 6,
29
+ "downsample_factor": 4,
30
+ "dtype": "float16",
31
+ "hidden_size": 3072,
32
+ "model_type": "voxtral_realtime",
33
+ "projector_hidden_act": "gelu",
34
+ "quantization": {
35
+ "group_size": 64,
36
+ "bits": 4,
37
+ "mode": "affine"
38
+ },
39
+ "quantization_config": {
40
+ "group_size": 64,
41
+ "bits": 4,
42
+ "mode": "affine"
43
+ },
44
+ "text_config": {
45
+ "attention_dropout": 0.0,
46
+ "bos_token_id": 1,
47
+ "eos_token_id": 2,
48
+ "head_dim": 128,
49
+ "hidden_act": "silu",
50
+ "hidden_size": 3072,
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 9216,
53
+ "max_position_embeddings": 131072,
54
+ "model_type": "voxtral_realtime_text",
55
+ "num_attention_heads": 32,
56
+ "num_hidden_layers": 26,
57
+ "num_key_value_heads": 8,
58
+ "pad_token_id": null,
59
+ "rms_norm_eps": 1e-05,
60
+ "rope_parameters": {
61
+ "rope_theta": 1000000.0,
62
+ "rope_type": "default"
63
+ },
64
+ "sliding_window": 8192,
65
+ "tie_word_embeddings": true,
66
+ "use_cache": true,
67
+ "vocab_size": 131072
68
+ },
69
+ "transformers_version": "5.2.0.dev0"
70
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "eos_token_id": 2,
4
+ "output_attentions": false,
5
+ "output_hidden_states": false,
6
+ "pad_token_id": 11,
7
+ "transformers_version": "5.2.0.dev0",
8
+ "use_cache": true
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ea4e642801c525a8b8f4d2ac4ee4685e649502e09b4cfa843fa819ced0be0f5
3
+ size 2507662237
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
params.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dim": 3072,
3
+ "n_layers": 26,
4
+ "head_dim": 128,
5
+ "hidden_dim": 9216,
6
+ "n_heads": 32,
7
+ "n_kv_heads": 8,
8
+ "use_biases": false,
9
+ "causal": true,
10
+ "rope_theta": 1000000.0,
11
+ "norm_eps": 1e-05,
12
+ "vocab_size": 131072,
13
+ "model_parallel": 1,
14
+ "tied_embeddings": true,
15
+ "sliding_window": 8192,
16
+ "model_max_length": 131072,
17
+ "multimodal": {
18
+ "whisper_model_args": {
19
+ "encoder_args": {
20
+ "audio_encoding_args": {
21
+ "sampling_rate": 16000,
22
+ "frame_rate": 12.5,
23
+ "num_mel_bins": 128,
24
+ "hop_length": 160,
25
+ "window_size": 400,
26
+ "chunk_length_s": null,
27
+ "global_log_mel_max": 1.5,
28
+ "transcription_format": "streaming"
29
+ },
30
+ "dim": 1280,
31
+ "n_layers": 32,
32
+ "head_dim": 64,
33
+ "hidden_dim": 5120,
34
+ "n_heads": 32,
35
+ "vocab_size": 131072,
36
+ "n_kv_heads": 32,
37
+ "use_biases": true,
38
+ "use_cache": false,
39
+ "rope_theta": 1000000.0,
40
+ "causal": true,
41
+ "norm_eps": 1e-05,
42
+ "pos_embed": "rope",
43
+ "max_source_positions": null,
44
+ "ffn_type": "swiglu",
45
+ "norm_type": "rms_norm",
46
+ "sliding_window": 750
47
+ },
48
+ "downsample_args": {
49
+ "downsample_factor": 4
50
+ }
51
+ }
52
+ },
53
+ "ada_rms_norm_t_cond": true,
54
+ "ada_rms_norm_t_cond_dim": 32
55
+ }
processor_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "feature_extractor": {
3
+ "feature_extractor_type": "VoxtralRealtimeFeatureExtractor",
4
+ "feature_size": 128,
5
+ "global_log_mel_max": 1.5,
6
+ "hop_length": 160,
7
+ "n_fft": 400,
8
+ "padding_side": "right",
9
+ "padding_value": 0.0,
10
+ "return_attention_mask": true,
11
+ "sampling_rate": 16000,
12
+ "win_length": 400
13
+ },
14
+ "processor_class": "VoxtralRealtimeProcessor"
15
+ }
tekken.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8434af1d39eba99f0ef46cf1450bf1a63fa941a26933a1ef5dbbf4adf0d00e44
3
+ size 14910348