sdsds222moyu commited on
Commit
736cdb6
·
1 Parent(s): a606e10

the first uploading

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ unimo-context/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ image/*.png filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ unitale_env/
README.md CHANGED
@@ -1,3 +1,45 @@
1
  ---
2
  license: agpl-3.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: agpl-3.0
3
+ base_model: Qwen/Qwen3-0.6B
4
+ pipeline_tag: text-to-speech
5
+ tags:
6
+ - emotion-
7
+ - emotion-recognition
8
+ - tts
9
+ - unimo
10
  ---
11
+
12
+
13
+ # Unimo IndexTTS2情绪描述文本解析优化模型
14
+
15
+ Unimo-context 是一个情绪上下文模型,能够根据情绪的上下文(如上一句话的情绪向量)以及当前的情绪描述,综合情绪的上下文信息后生成更加自然的情绪,使情绪的变化更加丝滑流畅
16
+
17
+ 基于 Qwen3-0.6B 微调的轻量级情感特征工程模型,专门用于解决多轮对话中TTS语音合成情感表现过于突变、缺乏物理惯性的问题。
18
+
19
+ 目的是为解决在传统的情感 TTS 流程中,情感随文本瞬间切换(例如从愤怒直接跳到冷静)过渡不自然的问题。
20
+
21
+ Unimo-context 充当了情感变化中的“阻尼器”或“润滑剂”:它接收上一句的情绪历史状态和当前句的情绪意图,输出较符合人类习惯的情绪惯性残留 的混合情绪向量,8维情绪特征向量可直接输入IndexTTS2使用合成音频。
22
+
23
+ 本项目可配合另一个项目:https://huggingface.co/sdsds222moyu/Unimo-indexTTS2-emotext 使用,这个项目可以更精确地解析自然语言的情绪指令文本,转化为IndexTTS2可用的情绪向量。
24
+
25
+
26
+ ## 部署方法:
27
+ 安装依赖:
28
+ ```
29
+ python -m venv venv
30
+ source venv/bin/activate # Linux
31
+ .\venv\Scripts\activate # Windows
32
+ pip install -r requirements.txt
33
+ ```
34
+
35
+ 启动情绪测试对比界面(可以生成上一句的情绪音频,当前的情绪音频和混合后的情绪音频,以供对比参考):
36
+ ```
37
+ python Unimo_test_qwen2.5.py
38
+ ```
39
+ ```
40
+ python Unimo_test_qwen3.py
41
+ ```
42
+
43
+ ![image](image/1.png)
44
+ ![image](image/2.png)
45
+ ![image](image/2.png)
Unimo_context_qwen3.py ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ import json
4
+ import re
5
+ import os
6
+ import requests
7
+ from transformers import AutoModelForCausalLM, AutoTokenizer
8
+
9
+ # --- 0. 全局配置 ---
10
+ modelname = 'unimo-context' # 你的“完全体”模型文件夹名
11
+
12
+ # --- 简洁 CSS:仅保留核心换行逻辑 ---
13
+ custom_css = """
14
+ /* 向量框:强制换行,确保长 JSON 自动折行 */
15
+ .wrap-json-code .cm-content, .wrap-json-code pre {
16
+ white-space: pre-wrap !important;
17
+ word-break: break-all !important;
18
+ }
19
+ .wrap-json-code .cm-editor {
20
+ border: 1px solid #ddd !important;
21
+ }
22
+
23
+ /* 容器样式:加深视觉区隔 */
24
+ .test-row {
25
+ border: 1px solid #e0e0e0;
26
+ border-radius: 12px;
27
+ padding: 24px !important;
28
+ margin-bottom: 35px !important;
29
+ background-color: transparent !important;
30
+ }
31
+
32
+ /* 标题样式:更具层次感 */
33
+ .test-row h4 {
34
+ border-left: 4px solid #4A90E2;
35
+ padding-left: 10px;
36
+ margin-bottom: 15px !important;
37
+ }
38
+ """
39
+
40
+ # --- 1. 情感引擎 (逻辑不变) ---
41
+ class EmotionEngine:
42
+ def __init__(self, model_folder_name):
43
+ current_dir = os.path.dirname(os.path.abspath(__file__))
44
+ model_path = os.path.join(current_dir, model_folder_name)
45
+ print(f"--- 引擎初始化 ---")
46
+ self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
47
+ self.model = AutoModelForCausalLM.from_pretrained(
48
+ model_path, dtype=torch.float16, device_map="cuda", trust_remote_code=True
49
+ )
50
+ self.model.eval()
51
+ print(f"Unimo 引擎就绪")
52
+
53
+ def predict_context(self, prev_v, intent_v):
54
+ instruction_str = "根据上句情感状态和此句意图,计算并输出符合心理阻尼逻辑的实操结果向量。"
55
+ inner_input_data = {"上句状态": prev_v, "此句意图": intent_v}
56
+ inner_input_str = json.dumps(inner_input_data, ensure_ascii=False)
57
+ prompt_obj = {"instruction": instruction_str, "input": inner_input_str}
58
+ full_text = json.dumps(prompt_obj, ensure_ascii=False, indent=0)
59
+
60
+ print(f"\n[模型调用] 正在请求阻尼计算...")
61
+ messages = [{"role": "user", "content": full_text}]
62
+ prompt = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
63
+
64
+ inputs = self.tokenizer(prompt, return_tensors="pt").to("cuda")
65
+ with torch.no_grad():
66
+ outputs = self.model.generate(**inputs, max_new_tokens=256, do_sample=False)
67
+
68
+ response = self.tokenizer.decode(outputs[0][len(inputs["input_ids"][0]):], skip_special_tokens=True).strip()
69
+ print(f"[模型输出] 原始响应: {response}")
70
+
71
+ try:
72
+ json_match = re.search(r'\{.*\}', response, re.DOTALL)
73
+ vector_res = json.loads(json_match.group())
74
+ return vector_res.get("实操结果", vector_res)
75
+ except Exception as e:
76
+ print(f"[解析失败] 响应格式不匹配: {e}")
77
+ return intent_v
78
+
79
+ # --- 2. 接口调用 (增加防御性检查) ---
80
+ def call_indextts(text, emotion_config, ref_audio, base_url):
81
+ print(f"\n[TTS 链路] 开始处理任务...")
82
+ if not base_url: return None, "URL缺失"
83
+ if not ref_audio:
84
+ print("⚠️ 失败: 请先在上方上传全局参考音频")
85
+ return None, "参考音频缺失"
86
+
87
+ base_url = base_url.rstrip('/')
88
+ ref_filename = os.path.basename(ref_audio)
89
+
90
+ try:
91
+ check_res = requests.get(f"{base_url}/v1/check/audio", params={"file_name": ref_filename}, timeout=5)
92
+ if check_res.status_code == 404:
93
+ print(f"[上传中] 发送参考音频: {ref_filename}")
94
+ with open(ref_audio, "rb") as f:
95
+ requests.post(f"{base_url}/v1/upload_audio", files={"audio": (ref_filename, f)}, data={"full_path": ref_filename}, timeout=30)
96
+
97
+ payload = {"text": text, "audio_path": ref_filename}
98
+ if isinstance(emotion_config, dict):
99
+ keys = ["高兴", "愤怒", "悲伤", "恐惧", "反感", "低落", "惊讶", "自然"]
100
+ payload["emo_vector"] = [float(emotion_config.get(k, 0.0)) for k in keys]
101
+ else: payload["emo_text"] = emotion_config
102
+
103
+ s_res = requests.post(f"{base_url}/v2/synthesize", json=payload, timeout=60)
104
+ if s_res.status_code == 200:
105
+ out_path = f"output_{hash(text + str(emotion_config))}.wav"
106
+ with open(out_path, "wb") as f: f.write(s_res.content)
107
+ print(f"[成功] 音频生成完毕")
108
+ return out_path, "成功"
109
+ print(f"[失败] 状态码: {s_res.status_code}")
110
+ return None, "失败"
111
+ except Exception as e:
112
+ print(f"[报错] {str(e)}")
113
+ return None, "报错"
114
+
115
+ # 初始化引擎
116
+ engine = EmotionEngine(model_folder_name=modelname)
117
+
118
+ # --- 3. Gradio 界面 ---
119
+ DEFAULT_V = {"高兴": 0.0, "愤怒": 0.0, "悲伤": 0.0, "恐惧": 0.0, "反感": 0.0, "低落": 0.0, "惊讶": 0.0, "自然": 1.0}
120
+
121
+ def get_default_row():
122
+ return {
123
+ "txt_p": "(前序台词)",
124
+ "txt_i": "刚才的事,我还没找你算账呢!",
125
+ "txt_m": "刚才的事,我还没找你算账呢!",
126
+ "v_prev": DEFAULT_V,
127
+ "v_intent": DEFAULT_V,
128
+ "v_mixed": None
129
+ }
130
+
131
+ with gr.Blocks(title="Unimo Context", css=custom_css) as demo:
132
+ gr.Markdown("# 🎭 Unitale 情感上下文测试台")
133
+
134
+ with gr.Row(variant="panel"):
135
+ api_url = gr.Textbox(label="IndexTTS API URL", value="http://127.0.0.1:8300", interactive=True, scale=4)
136
+ global_ref = gr.Audio(label="全局参考音色", type="filepath", scale=4)
137
+
138
+ rows_data = gr.State(value=[get_default_row()])
139
+
140
+ def update_state(data, idx, key, val):
141
+ data[idx][key] = val
142
+ return data
143
+
144
+ @gr.render(inputs=rows_data)
145
+ def show_rows(data_list):
146
+ for i, row in enumerate(data_list):
147
+ with gr.Column(elem_classes="test-row"):
148
+ gr.Markdown(f"#### 测试案例 #{i+1} - 1. 上句残留状态")
149
+ with gr.Row():
150
+ txt_p = gr.Textbox(label="对白内容", value=row["txt_p"], interactive=True, scale=4)
151
+ btn_p = gr.Button("📢 试听残留", variant="secondary", scale=1)
152
+ out_p = gr.Audio(label="音频输出", show_label=True)
153
+ v_prev = gr.Code(label="历史向量 (JSON)", value=json.dumps(row["v_prev"], ensure_ascii=False), language="json", interactive=True, elem_classes="wrap-json-code")
154
+
155
+ gr.Markdown("#### 2. 此句原始意图")
156
+ with gr.Row():
157
+ txt_i = gr.Textbox(label="对白内容", value=row["txt_i"], interactive=True, scale=4)
158
+ btn_i = gr.Button("📢 试听意图", variant="secondary", scale=1)
159
+ out_i = gr.Audio(label="音频输出", show_label=True)
160
+ v_intent = gr.Code(label="意图向量 (JSON)", value=json.dumps(row["v_intent"], ensure_ascii=False), language="json", interactive=True, elem_classes="wrap-json-code")
161
+
162
+ gr.Markdown("#### 3. Unimo 混合实操")
163
+ with gr.Row():
164
+ txt_m = gr.Textbox(label="对白内容", value=row["txt_m"], interactive=True, scale=4)
165
+ btn_m = gr.Button("🪄 开始混合合成", variant="primary", scale=1)
166
+ out_m = gr.Audio(label="音频输出", show_label=True)
167
+ mixed_val = json.dumps(row["v_mixed"], ensure_ascii=False, indent=4) if row["v_mixed"] else ""
168
+ v_mixed = gr.Code(label="预测向量结果 (JSON)", value=mixed_val, language="json", interactive=False, elem_classes="wrap-json-code")
169
+
170
+ # --- 核心修复:这里必须直接指向全局组件 global_ref 和 api_url ---
171
+ btn_p.click(
172
+ lambda t, v, r, u: call_indextts(t, json.loads(v), r, u)[0],
173
+ [txt_p, v_prev, global_ref, api_url], # <-- 这里修好了
174
+ out_p
175
+ )
176
+ btn_i.click(
177
+ lambda t, v, r, u: call_indextts(t, json.loads(v), r, u)[0],
178
+ [txt_i, v_intent, global_ref, api_url], # <-- 这里修好了
179
+ out_i
180
+ )
181
+
182
+ def calculate_and_gen(tp, ti, tm, vp, vi, r, u, d, idx):
183
+ vm = engine.predict_context(json.loads(vp), json.loads(vi))
184
+ audio_path, _ = call_indextts(tm, vm, r, u)
185
+ d[idx]["v_mixed"] = vm
186
+ return json.dumps(vm, ensure_ascii=False, indent=4), audio_path, d
187
+
188
+ btn_m.click(
189
+ calculate_and_gen,
190
+ [txt_p, txt_i, txt_m, v_prev, v_intent, global_ref, api_url, rows_data, gr.State(i)], # <-- 这里修好了
191
+ [v_mixed, out_m, rows_data]
192
+ )
193
+
194
+ # 同步文本框状态,防止添加行时丢失已改台词
195
+ txt_p.blur(update_state, [rows_data, gr.State(i), gr.State("txt_p"), txt_p], [rows_data])
196
+ txt_i.blur(update_state, [rows_data, gr.State(i), gr.State("txt_i"), txt_i], [rows_data])
197
+ txt_m.blur(update_state, [rows_data, gr.State(i), gr.State("txt_m"), txt_m], [rows_data])
198
+ v_prev.blur(lambda d, idx, val: update_state(d, idx, "v_prev", json.loads(val)), [rows_data, gr.State(i), v_prev], [rows_data])
199
+ v_intent.blur(lambda d, idx, val: update_state(d, idx, "v_intent", json.loads(val)), [rows_data, gr.State(i), v_intent], [rows_data])
200
+
201
+ def add_new_case(data):
202
+ data.append(get_default_row())
203
+ return data
204
+
205
+ with gr.Row():
206
+ add_btn = gr.Button("➕ 添加测试案例", variant="outline")
207
+ add_btn.click(add_new_case, [rows_data], [rows_data])
208
+
209
+ if __name__ == "__main__":
210
+ demo.launch(server_port=7878, inbrowser=True)
image/1.png ADDED

Git LFS Details

  • SHA256: 81fe5e9ffd55ca6b4e058e1c84e77f4e2bf8a5bec6de4bb49eb3cd93cd706a9d
  • Pointer size: 131 Bytes
  • Size of remote file: 301 kB
image/2.png ADDED

Git LFS Details

  • SHA256: 67876d2e90e909f038fa23a14cff4132f16d7d956a33f0d2fc246b7975b61b82
  • Pointer size: 131 Bytes
  • Size of remote file: 244 kB
image/3.png ADDED

Git LFS Details

  • SHA256: 52a1b29414a9b45d7c7e1a6dbe838545d439c826442ae45fca7442a5c32be303
  • Pointer size: 131 Bytes
  • Size of remote file: 276 kB
requirements.txt ADDED
Binary file (834 Bytes). View file
 
unimo-context/Modelfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ollama modelfile auto-generated by llamafactory
2
+
3
+ FROM .
4
+
5
+ TEMPLATE """{{ if .System }}<|im_start|>system
6
+ {{ .System }}<|im_end|>
7
+ {{ end }}{{ range .Messages }}{{ if eq .Role "user" }}<|im_start|>user
8
+ {{ .Content }}<|im_end|>
9
+ <|im_start|>assistant
10
+ {{ else if eq .Role "assistant" }}{{ .Content }}<|im_end|>
11
+ {{ end }}{{ end }}"""
12
+
13
+ PARAMETER stop "<|im_end|>"
14
+ PARAMETER num_ctx 4096
unimo-context/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
+ }
unimo-context/chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
unimo-context/config.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
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
+ ],
45
+ "max_position_embeddings": 40960,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "rms_norm_eps": 1e-06,
52
+ "rope_scaling": null,
53
+ "rope_theta": 1000000,
54
+ "sliding_window": null,
55
+ "tie_word_embeddings": true,
56
+ "transformers_version": "4.57.1",
57
+ "use_cache": true,
58
+ "use_sliding_window": false,
59
+ "vocab_size": 151936
60
+ }
unimo-context/generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.57.1"
13
+ }
unimo-context/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
unimo-context/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bfeb9985549944bea8333013ba6bd07dcf04fce9bd9091fffd65841dd605699
3
+ size 1192135096
unimo-context/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
+ }
unimo-context/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
unimo-context/tokenizer_config.json ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|endoftext|>",
236
+ "padding_side": "left",
237
+ "split_special_tokens": false,
238
+ "tokenizer_class": "Qwen2Tokenizer",
239
+ "unk_token": null
240
+ }
unimo-context/vocab.json ADDED
The diff for this file is too large to render. See raw diff