Native transformers configs (huggingface/transformers#50393)

#1
by eustlb HF Staff - opened
Files changed (4) hide show
  1. chat_template.jinja +8 -0
  2. config.json +119 -204
  3. generation_config.json +15 -12
  4. processor_config.json +7 -8
chat_template.jinja CHANGED
@@ -215,4 +215,12 @@
215
  {%- endfor -%}
216
  {%- if add_generation_prompt -%}
217
  {{- "<|im_start|>assistant\n" -}}
 
 
 
 
 
 
 
 
218
  {%- endif -%}
 
215
  {%- endfor -%}
216
  {%- if add_generation_prompt -%}
217
  {{- "<|im_start|>assistant\n" -}}
218
+ {#- `generation_mode` opens the answer with its marker; omitted or "text", the model picks the mode itself -#}
219
+ {%- if generation_mode == "audio" -%}
220
+ {{- "<|audio_start|>" -}}
221
+ {%- elif generation_mode == "interleaved" -%}
222
+ {{- "<|mixed_start|>" -}}
223
+ {%- elif generation_mode is defined and generation_mode not in ["text", none] -%}
224
+ {{- raise_exception("generation_mode must be \"text\", \"audio\" or \"interleaved\", got " ~ generation_mode) -}}
225
+ {%- endif -%}
226
  {%- endif -%}
config.json CHANGED
@@ -2,221 +2,119 @@
2
  "architectures": [
3
  "Lfm3AudioForConditionalGeneration"
4
  ],
5
- "model_type": "lfm3_audio",
6
- "format_version": 1,
7
- "codebooks": 12,
8
- "audio_vocab_size": 2017,
9
- "maskgit_steps": 3,
10
- "interleaved_n_text": 6,
11
- "interleaved_n_audio": 12,
12
- "preprocessor": {
13
- "feature_type": "log_mel",
14
- "sample_rate": 16000,
15
- "waveform_dtype": "float32",
16
- "channel_reduction": "mean",
17
- "n_mels": 128,
18
- "n_fft": 400,
19
- "win_length": 400,
20
- "hop_length": 160,
21
- "window": "hann",
22
- "window_periodic": true,
23
- "center": false,
24
- "normalized": false,
25
- "onesided": true,
26
- "power": 2.0,
27
- "f_min": 0.0,
28
- "f_max": 8000.0,
29
- "mel_scale": "slaney",
30
- "mel_norm": "slaney",
31
- "log_base": 10,
32
- "logmel_floor": -12.0,
33
- "normalization": {
34
- "type": "affine",
35
- "offset": 4.0,
36
- "divisor": 4.0
37
- },
38
- "padding": {
39
- "side": "right",
40
- "mode": "constant",
41
- "value": 0.0,
42
- "minimum_samples": 400,
43
- "length_alignment_offset": 400,
44
- "length_alignment_multiple": 160
45
- }
46
- },
47
- "tokenizer": {
48
- "repo_id": "LiquidAI/liquid7.1_tokenizer",
49
- "revision": "39badc470af6cdf6f6a6fbb4d6d1c4d1929b5b96"
50
- },
51
- "encoder": {
52
- "dim_in": 128,
53
- "dim_conv": 256,
54
- "dim_out": 768,
55
- "sliding_window": 32,
56
- "lfm": {
57
- "transformers_version": "5.19.0.dev0",
58
- "architectures": null,
59
- "output_hidden_states": false,
60
- "return_dict": true,
61
- "dtype": "float32",
62
- "chunk_size_feed_forward": 0,
63
- "is_encoder_decoder": false,
64
- "id2label": {
65
- "0": "LABEL_0",
66
- "1": "LABEL_1"
67
- },
68
- "label2id": {
69
- "LABEL_0": 0,
70
- "LABEL_1": 1
71
- },
72
- "problem_type": null,
73
- "vocab_size": 2,
74
- "hidden_size": 768,
75
- "intermediate_size": 2560,
76
- "num_hidden_layers": 17,
77
- "num_attention_heads": 8,
78
- "num_key_value_heads": 4,
79
- "max_position_embeddings": 128000,
80
- "initializer_range": 0.02,
81
- "norm_eps": 1e-05,
82
- "use_cache": true,
83
- "pad_token_id": 0,
84
- "bos_token_id": 1,
85
- "eos_token_id": null,
86
- "tie_word_embeddings": true,
87
- "rope_parameters": {
88
- "rope_theta": 1000000.0,
89
- "rope_type": "default"
90
- },
91
- "conv_bias": false,
92
- "conv_L_cache": 3,
93
- "block_multiple_of": 256,
94
- "block_ffn_dim_multiplier": 1.0,
95
- "block_auto_adjust_ff_dim": true,
96
- "full_attn_idxs": null,
97
- "layer_types": [
98
- "conv",
99
- "conv",
100
- "full_attention",
101
- "conv",
102
- "conv",
103
- "full_attention",
104
- "conv",
105
- "conv",
106
- "full_attention",
107
- "conv",
108
- "conv",
109
- "full_attention",
110
- "conv",
111
- "conv",
112
- "full_attention",
113
- "full_attention",
114
- "full_attention"
115
- ],
116
- "_name_or_path": "",
117
- "model_type": "lfm2",
118
- "output_attentions": false
119
- }
120
- },
121
- "depthformer": {
122
- "transformers_version": "5.19.0.dev0",
123
- "architectures": null,
124
- "output_hidden_states": false,
125
- "return_dict": true,
126
- "dtype": null,
127
- "chunk_size_feed_forward": 0,
128
- "is_encoder_decoder": false,
129
- "id2label": {
130
- "0": "LABEL_0",
131
- "1": "LABEL_1"
132
- },
133
- "label2id": {
134
- "LABEL_0": 0,
135
- "LABEL_1": 1
136
- },
137
- "problem_type": null,
138
- "vocab_size": 1,
139
- "hidden_size": 1024,
140
- "intermediate_size": 2816,
141
- "num_hidden_layers": 3,
142
- "num_attention_heads": 32,
143
- "num_key_value_heads": 8,
144
- "max_position_embeddings": 12,
145
  "initializer_range": 0.02,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  "norm_eps": 1e-05,
147
- "use_cache": false,
148
- "pad_token_id": null,
149
- "bos_token_id": null,
150
- "eos_token_id": null,
151
- "tie_word_embeddings": true,
152
  "rope_parameters": {
153
- "full_attention": {
154
- "rope_type": "default",
155
  "rope_theta": 1000000.0,
156
- "partial_rotary_factor": 1.0
157
  }
158
  },
159
- "conv_bias": false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  "conv_L_cache": 7,
 
 
 
 
 
161
  "layer_types": [
162
  "full_attention",
163
  "full_attention",
164
  "full_attention"
165
  ],
166
- "head_dim": 32,
167
- "sliding_window": 256,
168
- "use_sandwich_norm": false,
169
- "_name_or_path": "",
170
- "is_causal": false,
171
- "model_type": "lfm3",
172
- "output_attentions": false
173
- },
174
- "lfm": {
175
- "transformers_version": "5.19.0.dev0",
176
- "architectures": [
177
- "Lfm3ForCausalLM"
178
- ],
179
- "output_hidden_states": false,
180
- "return_dict": true,
181
- "dtype": "float32",
182
- "chunk_size_feed_forward": 0,
183
- "is_encoder_decoder": false,
184
- "id2label": {
185
- "0": "LABEL_0",
186
- "1": "LABEL_1"
187
- },
188
- "label2id": {
189
- "LABEL_0": 0,
190
- "LABEL_1": 1
191
- },
192
- "problem_type": null,
193
- "vocab_size": 128000,
194
- "hidden_size": 2048,
195
- "intermediate_size": 7680,
196
- "num_hidden_layers": 24,
197
- "num_attention_heads": 16,
198
- "num_key_value_heads": 4,
199
- "max_position_embeddings": 128000,
200
- "initializer_range": 0.02,
201
  "norm_eps": 1e-05,
202
- "use_cache": true,
203
- "pad_token_id": 124893,
204
- "bos_token_id": 124894,
205
- "eos_token_id": 124900,
206
- "tie_word_embeddings": true,
207
  "rope_parameters": {
208
  "full_attention": {
209
- "partial_rotary_factor": 0.5,
210
  "rope_theta": 1000000.0,
211
  "rope_type": "default"
212
- },
213
- "sliding_attention": {
214
- "rope_theta": 10000,
215
- "rope_type": "default"
216
  }
217
  },
218
- "conv_bias": false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  "conv_L_cache": 7,
 
 
 
 
 
 
220
  "layer_types": [
221
  "conv",
222
  "conv",
@@ -243,16 +141,33 @@
243
  "full_attention",
244
  "conv"
245
  ],
246
- "head_dim": 128,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  "sliding_window": 256,
 
 
 
248
  "use_sandwich_norm": true,
249
- "model_type": "lfm3",
250
- "output_attentions": false
251
  },
252
- "auto_map": {
253
- "AutoConfig": "configuration_lfm3_audio.Lfm3AudioConfig",
254
- "AutoModel": "modeling_lfm3_audio.Lfm3AudioModel",
255
- "AutoModelForMultimodalLM": "modeling_lfm3_audio.Lfm3AudioForConditionalGeneration",
256
- "AutoModelForSeq2SeqLM": "modeling_lfm3_audio.Lfm3AudioForConditionalGeneration"
257
- }
258
  }
 
2
  "architectures": [
3
  "Lfm3AudioForConditionalGeneration"
4
  ],
5
+ "audio_config": {
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "conv_L_cache": 3,
9
+ "conv_bias": false,
10
+ "head_dim": 96,
11
+ "hidden_size": 768,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  "initializer_range": 0.02,
13
+ "intermediate_size": 1792,
14
+ "layer_types": [
15
+ "conv",
16
+ "conv",
17
+ "sliding_attention",
18
+ "conv",
19
+ "conv",
20
+ "sliding_attention",
21
+ "conv",
22
+ "conv",
23
+ "sliding_attention",
24
+ "conv",
25
+ "conv",
26
+ "sliding_attention",
27
+ "conv",
28
+ "conv",
29
+ "sliding_attention",
30
+ "sliding_attention",
31
+ "sliding_attention"
32
+ ],
33
+ "max_position_embeddings": 128000,
34
+ "model_type": "lfm3_audio_audio",
35
  "norm_eps": 1e-05,
36
+ "num_attention_heads": 8,
37
+ "num_hidden_layers": 17,
38
+ "num_key_value_heads": 4,
39
+ "num_mel_bins": 128,
 
40
  "rope_parameters": {
41
+ "sliding_attention": {
 
42
  "rope_theta": 1000000.0,
43
+ "rope_type": "default"
44
  }
45
  },
46
+ "sliding_window": 32,
47
+ "subsampling_conv_channels": 256,
48
+ "subsampling_conv_kernel_size": 3,
49
+ "subsampling_conv_stride": 2,
50
+ "subsampling_factor": 8,
51
+ "use_attention_gate": false,
52
+ "use_cache": true,
53
+ "use_sandwich_norm": false
54
+ },
55
+ "audio_eos_code": 2016,
56
+ "audio_loss_weight": 1.0,
57
+ "audio_out_token_id": 125032,
58
+ "audio_start_token_id": 125012,
59
+ "audio_token_id": 125031,
60
+ "codebook_size": 2017,
61
+ "depth_decoder_config": {
62
+ "attention_bias": false,
63
+ "attention_dropout": 0.0,
64
  "conv_L_cache": 7,
65
+ "conv_bias": false,
66
+ "head_dim": 32,
67
+ "hidden_size": 1024,
68
+ "initializer_range": 0.02,
69
+ "intermediate_size": 2816,
70
  "layer_types": [
71
  "full_attention",
72
  "full_attention",
73
  "full_attention"
74
  ],
75
+ "max_position_embeddings": 12,
76
+ "model_type": "lfm3_audio_depth_decoder",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  "norm_eps": 1e-05,
78
+ "num_attention_heads": 32,
79
+ "num_hidden_layers": 3,
80
+ "num_key_value_heads": 8,
 
 
81
  "rope_parameters": {
82
  "full_attention": {
83
+ "partial_rotary_factor": 1.0,
84
  "rope_theta": 1000000.0,
85
  "rope_type": "default"
 
 
 
 
86
  }
87
  },
88
+ "sliding_window": null,
89
+ "use_attention_gate": true,
90
+ "use_cache": false,
91
+ "use_sandwich_norm": false
92
+ },
93
+ "dtype": "bfloat16",
94
+ "initializer_range": 0.02,
95
+ "interleaved_n_audio": 12,
96
+ "interleaved_n_text": 6,
97
+ "maskgit_schedule": [
98
+ 4,
99
+ 4,
100
+ 4
101
+ ],
102
+ "mixed_end_token_id": 125016,
103
+ "mixed_start_token_id": 125015,
104
+ "model_type": "lfm3_audio",
105
+ "num_codebooks": 12,
106
+ "projector_hidden_act": "gelu",
107
+ "text_config": {
108
+ "attention_bias": false,
109
+ "attention_dropout": 0.0,
110
+ "bos_token_id": 124894,
111
  "conv_L_cache": 7,
112
+ "conv_bias": false,
113
+ "eos_token_id": 124900,
114
+ "head_dim": 128,
115
+ "hidden_size": 2048,
116
+ "initializer_range": 0.02,
117
+ "intermediate_size": 7680,
118
  "layer_types": [
119
  "conv",
120
  "conv",
 
141
  "full_attention",
142
  "conv"
143
  ],
144
+ "max_position_embeddings": 128000,
145
+ "model_type": "lfm3",
146
+ "norm_eps": 1e-05,
147
+ "num_attention_heads": 16,
148
+ "num_hidden_layers": 24,
149
+ "num_key_value_heads": 4,
150
+ "pad_token_id": 124893,
151
+ "rope_parameters": {
152
+ "full_attention": {
153
+ "partial_rotary_factor": 0.5,
154
+ "rope_theta": 1000000.0,
155
+ "rope_type": "proportional"
156
+ },
157
+ "sliding_attention": {
158
+ "rope_theta": 10000.0,
159
+ "rope_type": "default"
160
+ }
161
+ },
162
  "sliding_window": 256,
163
+ "tie_word_embeddings": true,
164
+ "use_attention_gate": true,
165
+ "use_cache": true,
166
  "use_sandwich_norm": true,
167
+ "vocab_size": 128000
 
168
  },
169
+ "text_end_token_id": 125014,
170
+ "text_loss_weight": 1.0,
171
+ "tie_word_embeddings": true,
172
+ "transformers_version": "5.23.0.dev0"
 
 
173
  }
generation_config.json CHANGED
@@ -1,16 +1,19 @@
1
  {
2
  "bos_token_id": 124894,
3
- "eos_token_id": [124900, 125014],
4
- "pad_token_id": 124893,
5
- "use_cache": true,
6
- "output_attentions": false,
7
- "output_hidden_states": false,
8
  "do_sample": false,
9
- "repetition_penalty": 1.0,
10
- "temperature": 0.0,
11
- "top_k": 1,
12
- "audio_temperature": 1.0,
13
- "audio_top_k": 128,
14
- "audio_repetition_penalty": 1.1,
15
- "audio_repetition_window": 4096
 
 
 
16
  }
 
1
  {
2
  "bos_token_id": 124894,
3
+ "depth_decoder_do_sample": true,
4
+ "depth_decoder_repetition_penalty": 1.1,
5
+ "depth_decoder_repetition_window": 4096,
6
+ "depth_decoder_temperature": 1.0,
7
+ "depth_decoder_top_k": 128,
8
  "do_sample": false,
9
+ "eos_token_id": [
10
+ 124900,
11
+ 124895,
12
+ 124899
13
+ ],
14
+ "max_new_tokens_last_audio_chunk": 96,
15
+ "max_new_tokens_per_audio_chunk": 48,
16
+ "pad_token_id": 124893,
17
+ "return_dict_in_generate": true,
18
+ "transformers_version": "5.23.0.dev0"
19
  }
processor_config.json CHANGED
@@ -1,6 +1,10 @@
1
  {
2
  "audio_out_token": "<|audio_out|>",
3
  "audio_token": "<|audio|>",
 
 
 
 
4
  "feature_extractor": {
5
  "encoder_stride": 8,
6
  "feature_extractor_type": "Lfm3AudioFeatureExtractor",
@@ -14,14 +18,9 @@
14
  "padding_value": 0.0,
15
  "return_attention_mask": true,
16
  "sampling_rate": 16000,
17
- "win_length": 400,
18
- "auto_map": {
19
- "AutoFeatureExtractor": "feature_extraction_lfm3_audio.Lfm3AudioFeatureExtractor"
20
- }
21
  },
22
  "processor_class": "Lfm3AudioProcessor",
23
- "auto_map": {
24
- "AutoProcessor": "processing_lfm3_audio.Lfm3AudioProcessor"
25
- },
26
- "audio_tokenizer_subfolder": "audio_tokenizer"
27
  }
 
1
  {
2
  "audio_out_token": "<|audio_out|>",
3
  "audio_token": "<|audio|>",
4
+ "audio_tokenizer": {
5
+ "audio_tokenizer_class": "LiquidCodecModel",
6
+ "audio_tokenizer_name_or_path": "eustlb/LFM3-Audio-2B-codec"
7
+ },
8
  "feature_extractor": {
9
  "encoder_stride": 8,
10
  "feature_extractor_type": "Lfm3AudioFeatureExtractor",
 
18
  "padding_value": 0.0,
19
  "return_attention_mask": true,
20
  "sampling_rate": 16000,
21
+ "win_length": 400
 
 
 
22
  },
23
  "processor_class": "Lfm3AudioProcessor",
24
+ "num_audio_tokens_per_chunk": 12,
25
+ "max_audio_chunks_per_context": 31
 
 
26
  }