vanch007 commited on
Commit
d42a296
·
verified ·
1 Parent(s): 9856d70

Upload converted MLX MOSS-Transcribe-Diarize model

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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: mlx
4
+ tags:
5
+ - mlx
6
+ - int4
7
+ - automatic-speech-recognition
8
+ - speaker-diarization
9
+ base_model:
10
+ - vanch007/mlx-MOSS-Transcribe-Diarize
11
+ pipeline_tag: automatic-speech-recognition
12
+ ---
13
+
14
+ # mlx-MOSS-Transcribe-Diarize 4bit
15
+
16
+ 4bit MLX weight-only quantized variant of `vanch007/mlx-MOSS-Transcribe-Diarize`.
17
+
18
+ Quantization uses MLX affine quantization with `bits=4` and `group_size=64` on the text backbone, excluding the Whisper audio encoder and VQ adaptor.
19
+
20
+ ```bash
21
+ python -m moss_transcribe_diarize.mlx.cli /path/to/input.wav \
22
+ --model vanch007/mlx-MOSS-Transcribe-Diarize-4bit \
23
+ --out-dir runs/mlx_4bit_example
24
+ ```
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
chat_template.jinja ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro render_content(content) -%}
2
+ {%- if content is string -%}
3
+ {{- content -}}
4
+ {%- else -%}
5
+ {%- for item in content -%}
6
+ {%- if item.type == 'audio' or 'audio' in item or 'audio_url' in item -%}
7
+ {{- '<|audio_start|><|audio_pad|><|audio_end|>\n' -}}
8
+ {%- elif item.type == 'text' -%}
9
+ {{- item.text -}}
10
+ {%- endif -%}
11
+ {%- endfor -%}
12
+ {%- endif -%}
13
+ {%- endmacro -%}
14
+ {%- if tools %}
15
+ {{- '<|im_start|>system\n' }}
16
+ {%- if messages[0].role == 'system' %}
17
+ {{- render_content(messages[0].content) + '\n\n' }}
18
+ {%- else %}
19
+ {{- 'You are a helpful assistant.\n\n' }}
20
+ {%- endif %}
21
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
22
+ {%- for tool in tools %}
23
+ {{- "\n" }}
24
+ {{- tool | tojson }}
25
+ {%- endfor %}
26
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
27
+ {%- else %}
28
+ {%- if messages[0].role == 'system' %}
29
+ {{- '<|im_start|>system\n' + render_content(messages[0].content) + '<|im_end|>\n' }}
30
+ {%- else %}
31
+ {{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
32
+ {%- endif %}
33
+ {%- endif %}
34
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
35
+ {%- for message in messages[::-1] %}
36
+ {%- set index = (messages|length - 1) - loop.index0 %}
37
+ {%- set content = render_content(message.content) %}
38
+ {%- if ns.multi_step_tool and message.role == "user" and content is string and not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
39
+ {%- set ns.multi_step_tool = false %}
40
+ {%- set ns.last_query_index = index %}
41
+ {%- endif %}
42
+ {%- endfor %}
43
+ {%- for message in messages %}
44
+ {%- set content = render_content(message.content) %}
45
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>\n' }}
47
+ {%- elif message.role == "assistant" %}
48
+ {%- set reasoning_content = '' %}
49
+ {%- if message.reasoning_content is string %}
50
+ {%- set reasoning_content = message.reasoning_content %}
51
+ {%- else %}
52
+ {%- if '</think>' in content %}
53
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
54
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
55
+ {%- endif %}
56
+ {%- endif %}
57
+ {%- if loop.index0 > ns.last_query_index %}
58
+ {%- if loop.last or (not loop.last and reasoning_content) %}
59
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
60
+ {%- else %}
61
+ {{- '<|im_start|>' + message.role + '\n' + content }}
62
+ {%- endif %}
63
+ {%- else %}
64
+ {{- '<|im_start|>' + message.role + '\n' + content }}
65
+ {%- endif %}
66
+ {%- if message.tool_calls %}
67
+ {%- for tool_call in message.tool_calls %}
68
+ {%- if (loop.first and content) or (not loop.first) %}
69
+ {{- '\n' }}
70
+ {%- endif %}
71
+ {%- if tool_call.function %}
72
+ {%- set tool_call = tool_call.function %}
73
+ {%- endif %}
74
+ {{- '<tool_call>\n{"name": "' }}
75
+ {{- tool_call.name }}
76
+ {{- '", "arguments": ' }}
77
+ {%- if tool_call.arguments is string %}
78
+ {{- tool_call.arguments }}
79
+ {%- else %}
80
+ {{- tool_call.arguments | tojson }}
81
+ {%- endif %}
82
+ {{- '}\n</tool_call>' }}
83
+ {%- endfor %}
84
+ {%- endif %}
85
+ {{- '<|im_end|>\n' }}
86
+ {%- elif message.role == "tool" %}
87
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
88
+ {{- '<|im_start|>user' }}
89
+ {%- endif %}
90
+ {{- '\n<tool_response>\n' }}
91
+ {{- content }}
92
+ {{- '\n</tool_response>' }}
93
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
94
+ {{- '<|im_end|>\n' }}
95
+ {%- endif %}
96
+ {%- endif %}
97
+ {%- endfor %}
98
+ {%- if add_generation_prompt %}
99
+ {{- '<|im_start|>assistant\n' }}
100
+ {%- if enable_thinking is defined and enable_thinking is false %}
101
+ {{- '<think>\n\n</think>\n\n' }}
102
+ {%- endif %}
103
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MossTranscribeDiarizeForConditionalGeneration"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_moss_transcribe_diarize.MossTranscribeDiarizeConfig",
7
+ "AutoModel": "modeling_moss_transcribe_diarize.MossTranscribeDiarizeModel",
8
+ "AutoModelForCausalLM": "modeling_moss_transcribe_diarize.MossTranscribeDiarizeForConditionalGeneration",
9
+ "AutoProcessor": "processing_moss_transcribe_diarize.MossTranscribeDiarizeProcessor"
10
+ },
11
+ "model_type": "moss_transcribe_diarize",
12
+ "dtype": "bfloat16",
13
+ "text_config": {
14
+ "model_type": "qwen3",
15
+ "vocab_size": 151936,
16
+ "hidden_size": 1024,
17
+ "intermediate_size": 3072,
18
+ "num_hidden_layers": 28,
19
+ "num_attention_heads": 16,
20
+ "num_key_value_heads": 8,
21
+ "head_dim": 128,
22
+ "hidden_act": "silu",
23
+ "max_position_embeddings": 131072,
24
+ "initializer_range": 0.02,
25
+ "rms_norm_eps": 1e-06,
26
+ "tie_word_embeddings": true,
27
+ "rope_theta": 1000000,
28
+ "attention_bias": false,
29
+ "attention_dropout": 0.0,
30
+ "layer_types": [
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention",
56
+ "full_attention",
57
+ "full_attention",
58
+ "full_attention"
59
+ ],
60
+ "pad_token_id": 151643,
61
+ "bos_token_id": null,
62
+ "eos_token_id": null
63
+ },
64
+ "audio_config": {
65
+ "model_type": "whisper",
66
+ "num_mel_bins": 80,
67
+ "d_model": 1024,
68
+ "encoder_layers": 24,
69
+ "encoder_attention_heads": 16,
70
+ "encoder_ffn_dim": 4096,
71
+ "max_source_positions": 1500,
72
+ "dropout": 0.0,
73
+ "attention_dropout": 0.0,
74
+ "activation_dropout": 0.0,
75
+ "activation_function": "gelu",
76
+ "encoder_layerdrop": 0.0,
77
+ "scale_embedding": false
78
+ },
79
+ "audio_token_id": 151671,
80
+ "audio_merge_size": 4,
81
+ "adaptor_input_dim": 4096,
82
+ "tie_word_embeddings": true,
83
+ "pad_token_id": 151643,
84
+ "quantization": {
85
+ "bits": 4,
86
+ "group_size": 64,
87
+ "mode": "affine",
88
+ "scope": "text_backbone_only",
89
+ "excluded_prefixes": [
90
+ "model.whisper_encoder",
91
+ "model.vq_adaptor"
92
+ ]
93
+ }
94
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "eos_token_id": 151645,
4
+ "pad_token_id": 151643,
5
+ "max_new_tokens": 5120
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
mlx_conversion.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "pretrained/mlx-moss-transcribe-diarize",
3
+ "format": "mlx-safetensors",
4
+ "model_type": "moss_transcribe_diarize",
5
+ "quantization": {
6
+ "bits": 4,
7
+ "group_size": 64,
8
+ "mode": "affine",
9
+ "scope": "text_backbone_only",
10
+ "excluded_prefixes": [
11
+ "model.whisper_encoder",
12
+ "model.vq_adaptor"
13
+ ]
14
+ }
15
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0483be31b7adaa81ff6f94da3eb4c61a993e29b2fe2c3ba07827fbd00494a3c4
3
+ size 960434705
preprocessor_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "chunk_length": 30,
3
+ "dither": 0.0,
4
+ "feature_extractor_type": "WhisperFeatureExtractor",
5
+ "feature_size": 80,
6
+ "hop_length": 160,
7
+ "n_fft": 400,
8
+ "n_samples": 480000,
9
+ "nb_max_frames": 3000,
10
+ "padding_side": "right",
11
+ "padding_value": 0.0,
12
+ "return_attention_mask": false,
13
+ "sampling_rate": 16000
14
+ }
processor_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "MossTranscribeDiarizeProcessor",
3
+ "auto_map": {
4
+ "AutoProcessor": "processing_moss_transcribe_diarize.MossTranscribeDiarizeProcessor"
5
+ },
6
+ "audio_tokens_per_second": 12.5,
7
+ "audio_merge_size": 4,
8
+ "time_marker_every_seconds": 5,
9
+ "enable_time_marker": true
10
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcf03774334462d6e34b5005cb11120a62275f146ee2953e68731ecdbce84fbb
3
+ size 11423222
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|audio_start|>",
10
+ "<|audio_end|>",
11
+ "<|audio_pad|>"
12
+ ],
13
+ "is_local": true,
14
+ "local_files_only": false,
15
+ "model_max_length": 131072,
16
+ "pad_token": "<|endoftext|>",
17
+ "split_special_tokens": false,
18
+ "tokenizer_class": "Qwen2Tokenizer",
19
+ "unk_token": null
20
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff