yujiepan commited on
Commit
849fafd
·
verified ·
1 Parent(s): f89b39f

Upload folder using huggingface_hub

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,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: any-to-any
4
+ inference: true
5
+ widget:
6
+ - text: Hello!
7
+ example_title: Hello world
8
+ group: Python
9
+ ---
10
+
11
+ This tiny model is for debugging. It is randomly initialized with the config adapted from [Qwen/Qwen2.5-Omni-7B](https://huggingface.co/Qwen/Qwen2.5-Omni-7B).
12
+
13
+ ### Example usage:
14
+
15
+ ```python
16
+ import soundfile as sf
17
+ from qwen_omni_utils import process_mm_info
18
+ from transformers import Qwen2_5OmniModel, Qwen2_5OmniProcessor
19
+
20
+ model_id = "tiny-random/qwen2.5-omni"
21
+ # model = Qwen2_5OmniModel.from_pretrained(model_id, torch_dtype="auto", device_map="auto").eval()
22
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving.
23
+ model = Qwen2_5OmniModel.from_pretrained(
24
+ model_id,
25
+ torch_dtype="auto",
26
+ device_map="auto",
27
+ attn_implementation="flash_attention_2",
28
+ ).eval()
29
+ processor = Qwen2_5OmniProcessor.from_pretrained(model_id)
30
+
31
+ conversation = [
32
+ {
33
+ "role": "system",
34
+ "content": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.",
35
+ },
36
+ {
37
+ "role": "user",
38
+ "content": [
39
+ {"type": "text", "text": "Hi, can you tell me a joke?"},
40
+ {"type": "audio", "audio": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Audio/glass-breaking-151256.mp3"},
41
+ {"type": "video", "video": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2.5-Omni/draw.mp4"},
42
+ {"type": "image", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
43
+ ],
44
+ },
45
+ ]
46
+
47
+ # Preparation for inference
48
+ text = processor.apply_chat_template(conversation, add_generation_prompt=True, tokenize=False)
49
+ audios, images, videos = process_mm_info(conversation, use_audio_in_video=True)
50
+ print('Audios:', audios)
51
+ print('Images:', images)
52
+ print('Videos:', videos)
53
+ inputs = processor(text=text, audios=audios, images=images, videos=videos, return_tensors="pt", padding=True)
54
+ inputs = inputs.to(model.device).to(model.dtype)
55
+
56
+ # Inference: Generation of the output text and audio
57
+ text_ids, audio = model.generate(
58
+ **inputs, use_audio_in_video=True,
59
+ thinker_max_new_tokens=16, talker_max_new_tokens=16,
60
+ )
61
+
62
+ text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
63
+ print(text, '\n' * 3)
64
+ sf.write(
65
+ "/tmp/output.wav",
66
+ audio.reshape(-1).detach().cpu().numpy(),
67
+ samplerate=24000,
68
+ )
69
+ ```
70
+
71
+ ### Codes to create this repo:
72
+
73
+ ```python
74
+ from pathlib import Path
75
+
76
+ import torch
77
+
78
+ from huggingface_hub import hf_hub_download
79
+ from transformers import (
80
+ AutoConfig,
81
+ AutoModelForCausalLM,
82
+ AutoTokenizer,
83
+ GenerationConfig,
84
+ Qwen2_5OmniModel,
85
+ Qwen2_5OmniProcessor,
86
+ pipeline,
87
+ set_seed,
88
+ )
89
+
90
+ source_model_id = "Qwen/Qwen2.5-Omni-7B"
91
+ save_folder = "/tmp/tiny-random/qwen2.5-omni"
92
+
93
+ processor = Qwen2_5OmniProcessor.from_pretrained(
94
+ source_model_id, trust_remote_code=True,
95
+ )
96
+ processor.save_pretrained(save_folder)
97
+
98
+ config = AutoConfig.from_pretrained(
99
+ source_model_id, trust_remote_code=True,
100
+ )
101
+ OUTPUT_DIM = 16
102
+ config.talker_config.num_hidden_layers = 1
103
+ config.talker_config.hidden_size = 16
104
+ config.talker_config.embedding_size = OUTPUT_DIM
105
+ config.talker_config.head_dim = 16
106
+ config.talker_config.num_attention_heads = 1
107
+ config.talker_config.num_key_value_heads = 1
108
+ config.talker_config.intermediate_size = 32
109
+ config.talker_config.rope_scaling['mrope_section'] = [2, 2, 4]
110
+ assert 2 * sum(config.talker_config.rope_scaling['mrope_section']
111
+ ) == config.talker_config.hidden_size / config.talker_config.num_attention_heads
112
+
113
+ config.thinker_config.audio_config.num_hidden_layers = 1
114
+ config.thinker_config.audio_config.encoder_layers = 1
115
+ config.thinker_config.audio_config.d_model = 16
116
+ config.thinker_config.audio_config.encoder_attention_heads = 1
117
+ config.thinker_config.audio_config.encoder_ffn_dim = 32
118
+ config.thinker_config.audio_config.output_dim = OUTPUT_DIM
119
+
120
+ config.thinker_config.text_config.num_hidden_layers = 1
121
+ config.thinker_config.text_config.hidden_size = OUTPUT_DIM
122
+ config.thinker_config.text_config.intermediate_size = 32
123
+ config.thinker_config.text_config.num_attention_heads = 1
124
+ config.thinker_config.text_config.num_key_value_heads = 1
125
+ config.thinker_config.text_config.rope_scaling['mrope_section'] = [2, 2, 4]
126
+ assert 2 * sum(config.thinker_config.text_config.rope_scaling['mrope_section']
127
+ ) == config.thinker_config.text_config.hidden_size / config.thinker_config.text_config.num_attention_heads
128
+
129
+ config.thinker_config.vision_config.depth = 2
130
+ config.thinker_config.vision_config.embed_dim = 16
131
+ config.thinker_config.vision_config.hidden_size = 16
132
+ config.thinker_config.vision_config.intermediate_size = 32
133
+ config.thinker_config.vision_config.out_hidden_size = OUTPUT_DIM
134
+ config.thinker_config.vision_config.num_heads = 1
135
+ config.thinker_config.vision_config.fullatt_block_indexes = [1]
136
+
137
+ config.token2wav_config.bigvgan_config.resblock_dilation_sizes = [[1, 3, 5]]
138
+ config.token2wav_config.bigvgan_config.resblock_kernel_sizes = [7]
139
+ config.token2wav_config.bigvgan_config.upsample_initial_channel = 32
140
+ config.token2wav_config.bigvgan_config.upsample_kernel_sizes = [11, 4]
141
+ config.token2wav_config.bigvgan_config.upsample_rates = [5, 2]
142
+
143
+ config.token2wav_config.dit_config.depth = 1
144
+ config.token2wav_config.dit_config.num_hidden_layers = 1
145
+ config.token2wav_config.dit_config.hidden_size = 16
146
+ config.token2wav_config.dit_config.dim = 16
147
+ config.token2wav_config.dit_config.emb_dim = 16
148
+ config.token2wav_config.dit_config.enc_attention_channels = 16
149
+ config.token2wav_config.dit_config.enc_channels = [32, 32, 32]
150
+ config.token2wav_config.dit_config.enc_dilations = [1, 3, 4]
151
+ config.token2wav_config.dit_config.enc_kernel_sizes = [5, 3, 1]
152
+ config.token2wav_config.dit_config.enc_dim = 16
153
+ config.token2wav_config.dit_config.enc_emb_dim = 16
154
+ config.token2wav_config.dit_config.enc_lin_neurons = 16
155
+ config.token2wav_config.dit_config.head_dim = 16
156
+ config.token2wav_config.dit_config.num_attention_heads = 1
157
+ config.token2wav_config.dit_config.heads = 1
158
+ # avoid mismatch in vocab size because this is random model!
159
+ config.token2wav_config.dit_config.num_embeds = config.talker_config.vocab_size
160
+ print(config)
161
+
162
+ spk_dict = torch.load(hf_hub_download(source_model_id, 'spk_dict.pt', repo_type='model'))
163
+ for _, info in spk_dict.items():
164
+ info['cond'] = info['cond'][:, :config.token2wav_config.dit_config.enc_emb_dim].clone()
165
+ torch.save(spk_dict, Path(save_folder, "spk_dict.pt"))
166
+
167
+ torch.set_default_dtype(torch.bfloat16)
168
+ model = Qwen2_5OmniModel(
169
+ config,
170
+ )
171
+ torch.set_default_dtype(torch.float32)
172
+ model.generation_config = GenerationConfig.from_pretrained(
173
+ source_model_id, trust_remote_code=True,
174
+ )
175
+ set_seed(42)
176
+ with torch.no_grad():
177
+ for name, p in sorted(model.named_parameters()):
178
+ torch.nn.init.normal_(p, 0, 0.5)
179
+ print(name, p.shape, p.dtype)
180
+ model.save_pretrained(save_folder)
181
+ ```
added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|AUDIO|>": 151646,
5
+ "<|IMAGE|>": 151655,
6
+ "<|VIDEO|>": 151656,
7
+ "<|audio_bos|>": 151647,
8
+ "<|audio_eos|>": 151648,
9
+ "<|box_end|>": 151649,
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
+ "<|quad_end|>": 151651,
19
+ "<|quad_start|>": 151650,
20
+ "<|repo_name|>": 151663,
21
+ "<|vision_bos|>": 151652,
22
+ "<|vision_eos|>": 151653,
23
+ "<|vision_pad|>": 151654
24
+ }
chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{% set audio_count = namespace(value=0) %}{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_bos|><|IMAGE|><|vision_eos|>{% elif content['type'] == 'audio' or 'audio' in content or 'audio_url' in content %}{% set audio_count.value = audio_count.value + 1 %}{% if add_audio_id %}Audio {{ audio_count.value }}: {% endif %}<|audio_bos|><|AUDIO|><|audio_eos|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_bos|><|VIDEO|><|vision_eos|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
3
+ }
config.json ADDED
@@ -0,0 +1,541 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2_5OmniModel"
4
+ ],
5
+ "enable_audio_output": true,
6
+ "enable_talker": true,
7
+ "model_type": "qwen2_5_omni",
8
+ "talker_config": {
9
+ "_attn_implementation_autoset": true,
10
+ "_name_or_path": "Qwen2.5-Omni-7B/talker",
11
+ "architectures": [
12
+ "Qwen2OmniTalkerForConditionalGeneration"
13
+ ],
14
+ "attention_dropout": 0.0,
15
+ "audio_end_token_id": 151648,
16
+ "audio_start_token_id": 151647,
17
+ "audio_token_index": 151646,
18
+ "embedding_size": 16,
19
+ "head_dim": 16,
20
+ "hidden_act": "silu",
21
+ "hidden_size": 16,
22
+ "image_token_index": 151655,
23
+ "init_std": 0.02,
24
+ "initializer_range": 0.02,
25
+ "intermediate_size": 32,
26
+ "max_position_embeddings": 32768,
27
+ "max_window_layers": 28,
28
+ "model_type": "qwen2_5_omni_talker",
29
+ "num_attention_heads": 1,
30
+ "num_hidden_layers": 1,
31
+ "num_key_value_heads": 1,
32
+ "position_id_per_seconds": 25,
33
+ "rms_norm_eps": 1e-06,
34
+ "rope_scaling": {
35
+ "mrope_section": [
36
+ 2,
37
+ 2,
38
+ 4
39
+ ],
40
+ "rope_type": "default",
41
+ "type": "default"
42
+ },
43
+ "rope_theta": 1000000.0,
44
+ "seconds_per_chunk": 2,
45
+ "sliding_window": 32768,
46
+ "spatial_merge_size": 2,
47
+ "torch_dtype": "bfloat16",
48
+ "tts_codec_end_token_id": 8294,
49
+ "tts_codec_mask_token_id": 8296,
50
+ "tts_codec_pad_token_id": 8292,
51
+ "tts_codec_start_token_id": 8293,
52
+ "tts_text_end_token_id": 151861,
53
+ "tts_text_pad_token_id": 151859,
54
+ "tts_text_start_token_id": 151860,
55
+ "use_cache": true,
56
+ "use_mrope": false,
57
+ "use_sliding_window": false,
58
+ "video_token_index": 151656,
59
+ "vision_end_token_id": 151653,
60
+ "vision_start_token_id": 151652,
61
+ "vocab_size": 8448
62
+ },
63
+ "thinker_config": {
64
+ "_attn_implementation_autoset": true,
65
+ "_name_or_path": "Qwen2.5-Omni-7B/thinker",
66
+ "architectures": [
67
+ "Qwen2OmniNaViTThinkerForConditionalGeneration"
68
+ ],
69
+ "audio_config": {
70
+ "_attn_implementation_autoset": true,
71
+ "_name_or_path": "",
72
+ "activation_dropout": 0.0,
73
+ "activation_function": "gelu",
74
+ "add_cross_attention": false,
75
+ "architectures": null,
76
+ "attention_dropout": 0.0,
77
+ "bad_words_ids": null,
78
+ "begin_suppress_tokens": null,
79
+ "bos_token_id": null,
80
+ "chunk_size_feed_forward": 0,
81
+ "cross_attention_hidden_size": null,
82
+ "d_model": 16,
83
+ "decoder_start_token_id": null,
84
+ "diversity_penalty": 0.0,
85
+ "do_sample": false,
86
+ "dropout": 0.0,
87
+ "early_stopping": false,
88
+ "encoder_attention_heads": 1,
89
+ "encoder_ffn_dim": 32,
90
+ "encoder_layerdrop": 0.0,
91
+ "encoder_layers": 1,
92
+ "encoder_no_repeat_ngram_size": 0,
93
+ "eos_token_id": null,
94
+ "exponential_decay_length_penalty": null,
95
+ "finetuning_task": null,
96
+ "forced_bos_token_id": null,
97
+ "forced_eos_token_id": null,
98
+ "id2label": {
99
+ "0": "LABEL_0",
100
+ "1": "LABEL_1"
101
+ },
102
+ "init_std": 0.02,
103
+ "is_decoder": false,
104
+ "is_encoder_decoder": false,
105
+ "label2id": {
106
+ "LABEL_0": 0,
107
+ "LABEL_1": 1
108
+ },
109
+ "length_penalty": 1.0,
110
+ "max_length": 20,
111
+ "max_source_positions": 1500,
112
+ "min_length": 0,
113
+ "model_type": "qwen2_5_omni_audio_encoder",
114
+ "n_window": 100,
115
+ "no_repeat_ngram_size": 0,
116
+ "num_beam_groups": 1,
117
+ "num_beams": 1,
118
+ "num_hidden_layers": 1,
119
+ "num_mel_bins": 128,
120
+ "num_return_sequences": 1,
121
+ "output_attentions": false,
122
+ "output_dim": 16,
123
+ "output_hidden_states": false,
124
+ "output_scores": false,
125
+ "pad_token_id": null,
126
+ "prefix": null,
127
+ "problem_type": null,
128
+ "pruned_heads": {},
129
+ "remove_invalid_values": false,
130
+ "repetition_penalty": 1.0,
131
+ "return_dict": true,
132
+ "return_dict_in_generate": false,
133
+ "scale_embedding": false,
134
+ "sep_token_id": null,
135
+ "suppress_tokens": null,
136
+ "task_specific_params": null,
137
+ "temperature": 1.0,
138
+ "tf_legacy_loss": false,
139
+ "tie_encoder_decoder": false,
140
+ "tie_word_embeddings": true,
141
+ "tokenizer_class": null,
142
+ "top_k": 50,
143
+ "top_p": 1.0,
144
+ "torch_dtype": null,
145
+ "torchscript": false,
146
+ "typical_p": 1.0,
147
+ "use_bfloat16": false
148
+ },
149
+ "audio_end_token_id": 151648,
150
+ "audio_start_token_id": 151647,
151
+ "audio_token_index": 151646,
152
+ "bos_token_id": 151644,
153
+ "eos_token_id": 151645,
154
+ "ignore_index": -100,
155
+ "image_token_index": 151655,
156
+ "init_std": 0.02,
157
+ "model_type": "qwen2_5_omni_thinker",
158
+ "pad_token_id": 151643,
159
+ "position_id_per_seconds": 25,
160
+ "seconds_per_chunk": 2,
161
+ "text_config": {
162
+ "_attn_implementation_autoset": false,
163
+ "_name_or_path": "",
164
+ "add_cross_attention": false,
165
+ "architectures": null,
166
+ "attention_dropout": 0.0,
167
+ "bad_words_ids": null,
168
+ "begin_suppress_tokens": null,
169
+ "bos_token_id": null,
170
+ "chunk_size_feed_forward": 0,
171
+ "cross_attention_hidden_size": null,
172
+ "decoder_start_token_id": null,
173
+ "diversity_penalty": 0.0,
174
+ "do_sample": false,
175
+ "early_stopping": false,
176
+ "encoder_no_repeat_ngram_size": 0,
177
+ "eos_token_id": null,
178
+ "exponential_decay_length_penalty": null,
179
+ "finetuning_task": null,
180
+ "forced_bos_token_id": null,
181
+ "forced_eos_token_id": null,
182
+ "hidden_act": "silu",
183
+ "hidden_size": 16,
184
+ "id2label": {
185
+ "0": "LABEL_0",
186
+ "1": "LABEL_1"
187
+ },
188
+ "init_std": 0.02,
189
+ "intermediate_size": 32,
190
+ "is_decoder": false,
191
+ "is_encoder_decoder": false,
192
+ "label2id": {
193
+ "LABEL_0": 0,
194
+ "LABEL_1": 1
195
+ },
196
+ "length_penalty": 1.0,
197
+ "max_length": 20,
198
+ "max_position_embeddings": 32768,
199
+ "max_window_layers": 28,
200
+ "min_length": 0,
201
+ "model_type": "qwen2_5_omni_text",
202
+ "no_repeat_ngram_size": 0,
203
+ "num_attention_heads": 1,
204
+ "num_beam_groups": 1,
205
+ "num_beams": 1,
206
+ "num_hidden_layers": 1,
207
+ "num_key_value_heads": 1,
208
+ "num_return_sequences": 1,
209
+ "output_attentions": false,
210
+ "output_hidden_states": false,
211
+ "output_scores": false,
212
+ "pad_token_id": null,
213
+ "prefix": null,
214
+ "problem_type": null,
215
+ "pruned_heads": {},
216
+ "remove_invalid_values": false,
217
+ "repetition_penalty": 1.0,
218
+ "return_dict": true,
219
+ "return_dict_in_generate": false,
220
+ "rms_norm_eps": 1e-06,
221
+ "rope_scaling": {
222
+ "mrope_section": [
223
+ 2,
224
+ 2,
225
+ 4
226
+ ],
227
+ "rope_type": "default",
228
+ "type": "default"
229
+ },
230
+ "rope_theta": 1000000.0,
231
+ "sep_token_id": null,
232
+ "sliding_window": 32768,
233
+ "suppress_tokens": null,
234
+ "task_specific_params": null,
235
+ "temperature": 1.0,
236
+ "tf_legacy_loss": false,
237
+ "tie_encoder_decoder": false,
238
+ "tie_word_embeddings": true,
239
+ "tokenizer_class": null,
240
+ "top_k": 50,
241
+ "top_p": 1.0,
242
+ "torch_dtype": null,
243
+ "torchscript": false,
244
+ "typical_p": 1.0,
245
+ "use_bfloat16": false,
246
+ "use_cache": true,
247
+ "use_sliding_window": false,
248
+ "vocab_size": 152064
249
+ },
250
+ "torch_dtype": "bfloat16",
251
+ "use_mrope": false,
252
+ "user_token_id": 872,
253
+ "video_token_index": 151656,
254
+ "vision_config": {
255
+ "_attn_implementation_autoset": true,
256
+ "_name_or_path": "",
257
+ "add_cross_attention": false,
258
+ "architectures": null,
259
+ "bad_words_ids": null,
260
+ "begin_suppress_tokens": null,
261
+ "bos_token_id": null,
262
+ "chunk_size_feed_forward": 0,
263
+ "cross_attention_hidden_size": null,
264
+ "decoder_start_token_id": null,
265
+ "depth": 2,
266
+ "diversity_penalty": 0.0,
267
+ "do_sample": false,
268
+ "early_stopping": false,
269
+ "embed_dim": 16,
270
+ "encoder_no_repeat_ngram_size": 0,
271
+ "eos_token_id": null,
272
+ "exponential_decay_length_penalty": null,
273
+ "finetuning_task": null,
274
+ "forced_bos_token_id": null,
275
+ "forced_eos_token_id": null,
276
+ "fullatt_block_indexes": [
277
+ 1
278
+ ],
279
+ "hidden_act": "silu",
280
+ "hidden_size": 16,
281
+ "id2label": {
282
+ "0": "LABEL_0",
283
+ "1": "LABEL_1"
284
+ },
285
+ "in_channels": 3,
286
+ "in_chans": 3,
287
+ "init_std": 0.02,
288
+ "intermediate_size": 32,
289
+ "is_decoder": false,
290
+ "is_encoder_decoder": false,
291
+ "label2id": {
292
+ "LABEL_0": 0,
293
+ "LABEL_1": 1
294
+ },
295
+ "length_penalty": 1.0,
296
+ "max_length": 20,
297
+ "min_length": 0,
298
+ "model_type": "qwen2_5_omni_vision_encoder",
299
+ "no_repeat_ngram_size": 0,
300
+ "num_beam_groups": 1,
301
+ "num_beams": 1,
302
+ "num_heads": 1,
303
+ "num_return_sequences": 1,
304
+ "out_hidden_size": 16,
305
+ "output_attentions": false,
306
+ "output_hidden_states": false,
307
+ "output_scores": false,
308
+ "pad_token_id": null,
309
+ "patch_size": 14,
310
+ "prefix": null,
311
+ "problem_type": null,
312
+ "pruned_heads": {},
313
+ "remove_invalid_values": false,
314
+ "repetition_penalty": 1.0,
315
+ "return_dict": true,
316
+ "return_dict_in_generate": false,
317
+ "sep_token_id": null,
318
+ "spatial_merge_size": 2,
319
+ "spatial_patch_size": 14,
320
+ "suppress_tokens": null,
321
+ "task_specific_params": null,
322
+ "temperature": 1.0,
323
+ "temporal_patch_size": 2,
324
+ "tf_legacy_loss": false,
325
+ "tie_encoder_decoder": false,
326
+ "tie_word_embeddings": true,
327
+ "tokenizer_class": null,
328
+ "tokens_per_second": 25,
329
+ "top_k": 50,
330
+ "top_p": 1.0,
331
+ "torch_dtype": null,
332
+ "torchscript": false,
333
+ "typical_p": 1.0,
334
+ "use_bfloat16": false,
335
+ "window_size": 112
336
+ },
337
+ "vision_end_token_id": 151653,
338
+ "vision_start_token_id": 151652,
339
+ "vision_token_id": 151654
340
+ },
341
+ "token2wav_config": {
342
+ "_attn_implementation_autoset": true,
343
+ "bigvgan_config": {
344
+ "_attn_implementation_autoset": true,
345
+ "_name_or_path": "",
346
+ "add_cross_attention": false,
347
+ "architectures": null,
348
+ "bad_words_ids": null,
349
+ "begin_suppress_tokens": null,
350
+ "bos_token_id": null,
351
+ "chunk_size_feed_forward": 0,
352
+ "cross_attention_hidden_size": null,
353
+ "decoder_start_token_id": null,
354
+ "diversity_penalty": 0.0,
355
+ "do_sample": false,
356
+ "early_stopping": false,
357
+ "encoder_no_repeat_ngram_size": 0,
358
+ "eos_token_id": null,
359
+ "exponential_decay_length_penalty": null,
360
+ "finetuning_task": null,
361
+ "forced_bos_token_id": null,
362
+ "forced_eos_token_id": null,
363
+ "id2label": {
364
+ "0": "LABEL_0",
365
+ "1": "LABEL_1"
366
+ },
367
+ "is_decoder": false,
368
+ "is_encoder_decoder": false,
369
+ "label2id": {
370
+ "LABEL_0": 0,
371
+ "LABEL_1": 1
372
+ },
373
+ "length_penalty": 1.0,
374
+ "max_length": 20,
375
+ "mel_dim": 80,
376
+ "min_length": 0,
377
+ "model_type": "qwen2_5_omni_bigvgan",
378
+ "no_repeat_ngram_size": 0,
379
+ "num_beam_groups": 1,
380
+ "num_beams": 1,
381
+ "num_return_sequences": 1,
382
+ "output_attentions": false,
383
+ "output_hidden_states": false,
384
+ "output_scores": false,
385
+ "pad_token_id": null,
386
+ "prefix": null,
387
+ "problem_type": null,
388
+ "pruned_heads": {},
389
+ "remove_invalid_values": false,
390
+ "repetition_penalty": 1.0,
391
+ "resblock_dilation_sizes": [
392
+ [
393
+ 1,
394
+ 3,
395
+ 5
396
+ ]
397
+ ],
398
+ "resblock_kernel_sizes": [
399
+ 7
400
+ ],
401
+ "return_dict": true,
402
+ "return_dict_in_generate": false,
403
+ "sep_token_id": null,
404
+ "suppress_tokens": null,
405
+ "task_specific_params": null,
406
+ "temperature": 1.0,
407
+ "tf_legacy_loss": false,
408
+ "tie_encoder_decoder": false,
409
+ "tie_word_embeddings": true,
410
+ "tokenizer_class": null,
411
+ "top_k": 50,
412
+ "top_p": 1.0,
413
+ "torch_dtype": null,
414
+ "torchscript": false,
415
+ "typical_p": 1.0,
416
+ "upsample_initial_channel": 32,
417
+ "upsample_kernel_sizes": [
418
+ 11,
419
+ 4
420
+ ],
421
+ "upsample_rates": [
422
+ 5,
423
+ 2
424
+ ],
425
+ "use_bfloat16": false,
426
+ "use_bias_at_final": false
427
+ },
428
+ "dit_config": {
429
+ "_attn_implementation_autoset": true,
430
+ "_name_or_path": "",
431
+ "add_cross_attention": false,
432
+ "architectures": null,
433
+ "bad_words_ids": null,
434
+ "begin_suppress_tokens": null,
435
+ "block_size": 24,
436
+ "bos_token_id": null,
437
+ "chunk_size_feed_forward": 0,
438
+ "cross_attention_hidden_size": null,
439
+ "decoder_start_token_id": null,
440
+ "depth": 1,
441
+ "dim": 16,
442
+ "diversity_penalty": 0.0,
443
+ "do_sample": false,
444
+ "dropout": 0.1,
445
+ "early_stopping": false,
446
+ "emb_dim": 16,
447
+ "enc_attention_channels": 16,
448
+ "enc_channels": [
449
+ 32,
450
+ 32,
451
+ 32
452
+ ],
453
+ "enc_dilations": [
454
+ 1,
455
+ 3,
456
+ 4
457
+ ],
458
+ "enc_dim": 16,
459
+ "enc_emb_dim": 16,
460
+ "enc_global_context": true,
461
+ "enc_kernel_sizes": [
462
+ 5,
463
+ 3,
464
+ 1
465
+ ],
466
+ "enc_lin_neurons": 16,
467
+ "enc_res2net_scale": 2,
468
+ "enc_se_channels": 64,
469
+ "encoder_no_repeat_ngram_size": 0,
470
+ "eos_token_id": null,
471
+ "exponential_decay_length_penalty": null,
472
+ "ff_mult": 2,
473
+ "finetuning_task": null,
474
+ "forced_bos_token_id": null,
475
+ "forced_eos_token_id": null,
476
+ "head_dim": 16,
477
+ "heads": 1,
478
+ "hidden_size": 16,
479
+ "id2label": {
480
+ "0": "LABEL_0",
481
+ "1": "LABEL_1"
482
+ },
483
+ "is_decoder": false,
484
+ "is_encoder_decoder": false,
485
+ "label2id": {
486
+ "LABEL_0": 0,
487
+ "LABEL_1": 1
488
+ },
489
+ "length_penalty": 1.0,
490
+ "look_ahead_layers": [
491
+ 10
492
+ ],
493
+ "look_backward_layers": [
494
+ 0,
495
+ 20
496
+ ],
497
+ "max_length": 20,
498
+ "max_position_embeddings": 32768,
499
+ "mel_dim": 80,
500
+ "min_length": 0,
501
+ "model_type": "qwen2_5_omni_dit",
502
+ "no_repeat_ngram_size": 0,
503
+ "num_attention_heads": 1,
504
+ "num_beam_groups": 1,
505
+ "num_beams": 1,
506
+ "num_embeds": 8448,
507
+ "num_hidden_layers": 1,
508
+ "num_return_sequences": 1,
509
+ "output_attentions": false,
510
+ "output_hidden_states": false,
511
+ "output_scores": false,
512
+ "pad_token_id": null,
513
+ "prefix": null,
514
+ "problem_type": null,
515
+ "pruned_heads": {},
516
+ "remove_invalid_values": false,
517
+ "repeats": 2,
518
+ "repetition_penalty": 1.0,
519
+ "return_dict": true,
520
+ "return_dict_in_generate": false,
521
+ "rope_theta": 10000.0,
522
+ "sep_token_id": null,
523
+ "suppress_tokens": null,
524
+ "task_specific_params": null,
525
+ "temperature": 1.0,
526
+ "tf_legacy_loss": false,
527
+ "tie_encoder_decoder": false,
528
+ "tie_word_embeddings": true,
529
+ "tokenizer_class": null,
530
+ "top_k": 50,
531
+ "top_p": 1.0,
532
+ "torch_dtype": "float32",
533
+ "torchscript": false,
534
+ "typical_p": 1.0,
535
+ "use_bfloat16": false
536
+ },
537
+ "model_type": "qwen2_5_omni_token2wav"
538
+ },
539
+ "torch_dtype": "bfloat16",
540
+ "transformers_version": "4.50.0.dev0"
541
+ }
generation_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "transformers_version": "4.50.0.dev0"
4
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5856e6a6c48b25459916c6233cedb53ad30943caf32674d030e780e8228f022
3
+ size 11223328
preprocessor_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "chunk_length": 300,
3
+ "dither": 0.0,
4
+ "feature_extractor_type": "WhisperFeatureExtractor",
5
+ "feature_size": 128,
6
+ "hop_length": 160,
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_processor_type": "Qwen2VLImageProcessor",
13
+ "image_std": [
14
+ 0.26862954,
15
+ 0.26130258,
16
+ 0.27577711
17
+ ],
18
+ "max_pixels": 12845056,
19
+ "merge_size": 2,
20
+ "min_pixels": 3136,
21
+ "n_fft": 400,
22
+ "n_samples": 4800000,
23
+ "nb_max_frames": 30000,
24
+ "padding_side": "right",
25
+ "padding_value": 0.0,
26
+ "patch_size": 14,
27
+ "processor_class": "Qwen2_5OmniProcessor",
28
+ "return_attention_mask": true,
29
+ "sampling_rate": 16000,
30
+ "temporal_patch_size": 2
31
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|AUDIO|>",
6
+ "<|audio_bos|>",
7
+ "<|audio_eos|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_bos|>",
12
+ "<|vision_eos|>",
13
+ "<|vision_pad|>",
14
+ "<|IMAGE|>",
15
+ "<|VIDEO|>"
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
+ }
spk_dict.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8294c250f1b71764778097c1785e0cb346c4365582127a851f2c5b18ae87841
3
+ size 258136
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8441917e39ae0244e06d704b95b3124795cec478e297f9afac39ba670d7e9d99
3
+ size 11421870
tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "151643": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "151644": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "151645": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "151646": {
29
+ "content": "<|AUDIO|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "151647": {
37
+ "content": "<|audio_bos|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "151648": {
45
+ "content": "<|audio_eos|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "151649": {
53
+ "content": "<|box_end|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "151650": {
61
+ "content": "<|quad_start|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "151651": {
69
+ "content": "<|quad_end|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "151652": {
77
+ "content": "<|vision_bos|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "151653": {
85
+ "content": "<|vision_eos|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "151654": {
93
+ "content": "<|vision_pad|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "151655": {
101
+ "content": "<|IMAGE|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "151656": {
109
+ "content": "<|VIDEO|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "151657": {
117
+ "content": "<tool_call>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": false
123
+ },
124
+ "151658": {
125
+ "content": "</tool_call>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": false
131
+ },
132
+ "151659": {
133
+ "content": "<|fim_prefix|>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": false
139
+ },
140
+ "151660": {
141
+ "content": "<|fim_middle|>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": false
147
+ },
148
+ "151661": {
149
+ "content": "<|fim_suffix|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": false
155
+ },
156
+ "151662": {
157
+ "content": "<|fim_pad|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": false
163
+ },
164
+ "151663": {
165
+ "content": "<|repo_name|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": false
171
+ },
172
+ "151664": {
173
+ "content": "<|file_sep|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": false
179
+ }
180
+ },
181
+ "additional_special_tokens": [
182
+ "<|im_start|>",
183
+ "<|im_end|>",
184
+ "<|AUDIO|>",
185
+ "<|audio_bos|>",
186
+ "<|audio_eos|>",
187
+ "<|box_end|>",
188
+ "<|quad_start|>",
189
+ "<|quad_end|>",
190
+ "<|vision_bos|>",
191
+ "<|vision_eos|>",
192
+ "<|vision_pad|>",
193
+ "<|IMAGE|>",
194
+ "<|VIDEO|>"
195
+ ],
196
+ "bos_token": null,
197
+ "chat_template": "{% set audio_count = namespace(value=0) %}{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_bos|><|IMAGE|><|vision_eos|>{% elif content['type'] == 'audio' or 'audio' in content or 'audio_url' in content %}{% set audio_count.value = audio_count.value + 1 %}{% if add_audio_id %}Audio {{ audio_count.value }}: {% endif %}<|audio_bos|><|AUDIO|><|audio_eos|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_bos|><|VIDEO|><|vision_eos|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
198
+ "clean_up_tokenization_spaces": false,
199
+ "eos_token": "<|im_end|>",
200
+ "errors": "replace",
201
+ "extra_special_tokens": {},
202
+ "model_max_length": 32768,
203
+ "pad_token": "<|endoftext|>",
204
+ "processor_class": "Qwen2_5OmniProcessor",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff