whisperkkk commited on
Commit
3a803fb
·
verified ·
1 Parent(s): 0891089

Add files using upload-large-folder tool

Browse files
LICENSE ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Tencent is pleased to support the open source community by making Hy-Embodied-RxBrain-1.0.
2
+
3
+ Copyright (C) 2026 Tencent. All rights reserved.
4
+
5
+ For the avoidance of doubt, Hy-Embodied-RxBrain-1.0 refers to the code and model parameter weights made publicly available by Tencent.
6
+
7
+
8
+ Terms of the Apache-2.0:
9
+ --------------------------------------------------------------------
10
+ Apache License
11
+ Version 2.0, January 2004
12
+ http://www.apache.org/licenses/
13
+
14
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
15
+
16
+ 1. Definitions.
17
+
18
+ "License" shall mean the terms and conditions for use, reproduction,
19
+ and distribution as defined by Sections 1 through 9 of this document.
20
+
21
+ "Licensor" shall mean the copyright owner or entity authorized by
22
+ the copyright owner that is granting the License.
23
+
24
+ "Legal Entity" shall mean the union of the acting entity and all
25
+ other entities that control, are controlled by, or are under common
26
+ control with that entity. For the purposes of this definition,
27
+ "control" means (i) the power, direct or indirect, to cause the
28
+ direction or management of such entity, whether by contract or
29
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
30
+ outstanding shares, or (iii) beneficial ownership of such entity.
31
+
32
+ "You" (or "Your") shall mean an individual or Legal Entity
33
+ exercising permissions granted by this License.
34
+
35
+ "Source" form shall mean the preferred form for making modifications,
36
+ including but not limited to software source code, documentation
37
+ source, and configuration files.
38
+
39
+ "Object" form shall mean any form resulting from mechanical
40
+ transformation or translation of a Source form, including but
41
+ not limited to compiled object code, generated documentation,
42
+ and conversions to other media types.
43
+
44
+ "Work" shall mean the work of authorship, whether in Source or
45
+ Object form, made available under the License, as indicated by a
46
+ copyright notice that is included in or attached to the work
47
+ (an example is provided in the Appendix below).
48
+
49
+ "Derivative Works" shall mean any work, whether in Source or Object
50
+ form, that is based on (or derived from) the Work and for which the
51
+ editorial revisions, annotations, elaborations, or other modifications
52
+ represent, as a whole, an original work of authorship. For the purposes
53
+ of this License, Derivative Works shall not include works that remain
54
+ separable from, or merely link (or bind by name) to the interfaces of,
55
+ the Work and Derivative Works thereof.
56
+
57
+ "Contribution" shall mean any work of authorship, including
58
+ the original version of the Work and any modifications or additions
59
+ to that Work or Derivative Works thereof, that is intentionally
60
+ submitted to Licensor for inclusion in the Work by the copyright owner
61
+ or by an individual or Legal Entity authorized to submit on behalf of
62
+ the copyright owner. For the purposes of this definition, "submitted"
63
+ means any form of electronic, verbal, or written communication sent
64
+ to the Licensor or its representatives, including but not limited to
65
+ communication on electronic mailing lists, source code control systems,
66
+ and issue tracking systems that are managed by, or on behalf of, the
67
+ Licensor for the purpose of discussing and improving the Work, but
68
+ excluding communication that is conspicuously marked or otherwise
69
+ designated in writing by the copyright owner as "Not a Contribution."
70
+
71
+ "Contributor" shall mean Licensor and any individual or Legal Entity
72
+ on behalf of whom a Contribution has been received by Licensor and
73
+ subsequently incorporated within the Work.
74
+
75
+ 2. Grant of Copyright License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ copyright license to reproduce, prepare Derivative Works of,
79
+ publicly display, publicly perform, sublicense, and distribute the
80
+ Work and such Derivative Works in Source or Object form.
81
+
82
+ 3. Grant of Patent License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ (except as stated in this section) patent license to make, have made,
86
+ use, offer to sell, sell, import, and otherwise transfer the Work,
87
+ where such license applies only to those patent claims licensable
88
+ by such Contributor that are necessarily infringed by their
89
+ Contribution(s) alone or by combination of their Contribution(s)
90
+ with the Work to which such Contribution(s) was submitted. If You
91
+ institute patent litigation against any entity (including a
92
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
93
+ or a Contribution incorporated within the Work constitutes direct
94
+ or contributory patent infringement, then any patent licenses
95
+ granted to You under this License for that Work shall terminate
96
+ as of the date such litigation is filed.
97
+
98
+ 4. Redistribution. You may reproduce and distribute copies of the
99
+ Work or Derivative Works thereof in any medium, with or without
100
+ modifications, and in Source or Object form, provided that You
101
+ meet the following conditions:
102
+
103
+ (a) You must give any other recipients of the Work or
104
+ Derivative Works a copy of this License; and
105
+
106
+ (b) You must cause any modified files to carry prominent notices
107
+ stating that You changed the files; and
108
+
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+
115
+ (d) If the Work includes a "NOTICE" text file as part of its
116
+ distribution, then any Derivative Works that You distribute must
117
+ include a readable copy of the attribution notices contained
118
+ within such NOTICE file, excluding those notices that do not
119
+ pertain to any part of the Derivative Works, in at least one
120
+ of the following places: within a NOTICE text file distributed
121
+ as part of the Derivative Works; within the Source form or
122
+ documentation, if provided along with the Derivative Works; or,
123
+ within a display generated by the Derivative Works, if and
124
+ wherever such third-party notices normally appear. The contents
125
+ of the NOTICE file are for informational purposes only and
126
+ do not modify the License. You may add Your own attribution
127
+ notices within Derivative Works that You distribute, alongside
128
+ or as an addendum to the NOTICE text from the Work, provided
129
+ that such additional attribution notices cannot be construed
130
+ as modifying the License.
131
+
132
+ You may add Your own copyright statement to Your modifications and
133
+ may provide additional or different license terms and conditions
134
+ for use, reproduction, or distribution of Your modifications, or
135
+ for any such Derivative Works as a whole, provided Your use,
136
+ reproduction, and distribution of the Work otherwise complies with
137
+ the conditions stated in this License.
138
+
139
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
140
+ any Contribution intentionally submitted for inclusion in the Work
141
+ by You to the Licensor shall be under the terms and conditions of
142
+ this License, without any additional terms or conditions.
143
+ Notwithstanding the above, nothing herein shall supersede or modify
144
+ the terms of any separate license agreement you may have executed
145
+ with Licensor regarding such Contributions.
146
+
147
+ 6. Trademarks. This License does not grant permission to use the trade
148
+ names, trademarks, service marks, or product names of the Licensor,
149
+ except as required for reasonable and customary use in describing the
150
+ origin of the Work and reproducing the content of the NOTICE file.
151
+
152
+ 7. Disclaimer of Warranty. Unless required by applicable law or
153
+ agreed to in writing, Licensor provides the Work (and each
154
+ Contributor provides its Contributions) on an "AS IS" BASIS,
155
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
156
+ implied, including, without limitation, any warranties or conditions
157
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
158
+ PARTICULAR PURPOSE. You are solely responsible for determining the
159
+ appropriateness of using or redistributing the Work and assume any
160
+ risks associated with Your exercise of permissions under this License.
161
+
162
+ 8. Limitation of Liability. In no event and under no legal theory,
163
+ whether in tort (including negligence), contract, or otherwise,
164
+ unless required by applicable law (such as deliberate and grossly
165
+ negligent acts) or agreed to in writing, shall any Contributor be
166
+ liable to You for damages, including any direct, indirect, special,
167
+ incidental, or consequential damages of any character arising as a
168
+ result of this License or out of the use or inability to use the
169
+ Work (including but not limited to damages for loss of goodwill,
170
+ work stoppage, computer failure or malfunction, or any and all
171
+ other commercial damages or losses), even if such Contributor
172
+ has been advised of the possibility of such damages.
173
+
174
+ 9. Accepting Warranty or Additional Liability. While redistributing
175
+ the Work or Derivative Works thereof, You may choose to offer,
176
+ and charge a fee for, acceptance of support, warranty, indemnity,
177
+ or other liability obligations and/or rights consistent with this
178
+ License. However, in accepting such obligations, You may act only
179
+ on Your own behalf and on Your sole responsibility, not on behalf
180
+ of any other Contributor, and only if You agree to indemnify,
181
+ defend, and hold each Contributor harmless for any liability
182
+ incurred by, or claims asserted against, such Contributor by reason
183
+ of your accepting any such warranty or additional liability.
184
+
185
+ END OF TERMS AND CONDITIONS
186
+
187
+ APPENDIX: How to apply the Apache License to your work.
188
+
189
+ To apply the Apache License to your work, attach the following
190
+ boilerplate notice, with the fields enclosed by brackets "[]"
191
+ replaced with your own identifying information. (Don't include
192
+ the brackets!) The text should be enclosed in the appropriate
193
+ comment syntax for the file format. We also recommend that a
194
+ file or class name and description of purpose be included on the
195
+ same "printed page" as the copyright notice for easier
196
+ identification within third-party archives.
197
+
198
+ Copyright [yyyy] [name of copyright owner]
199
+
200
+ Licensed under the Apache License, Version 2.0 (the "License");
201
+ you may not use this file except in compliance with the License.
202
+ You may obtain a copy of the License at
203
+
204
+ http://www.apache.org/licenses/LICENSE-2.0
205
+
206
+ Unless required by applicable law or agreed to in writing, software
207
+ distributed under the License is distributed on an "AS IS" BASIS,
208
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
+ See the License for the specific language governing permissions and
210
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - multilingual
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - hunyuan
8
+ - hunyuan_vl_mot
9
+ - unified_mot
10
+ - vision-language
11
+ - Embodied
12
+ - image-to-text
13
+ - any-to-any
14
+ - MoT
15
+ - flow-matching
16
+ ---
17
+
18
+ <div align="center">
19
+ <h1>RxBrain</h1>
20
+ <p><b>Embodied Cognition Foundation Model with Joint Language–Visual Reasoning and Imagination</b></p>
21
+ <p><i>Tencent Robotics X × Futian Laboratory × Tencent Hunyuan</i></p>
22
+
23
+ <a href="https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0/blob/main/assets/RxBrain_v0.pdf"><img src="https://img.shields.io/badge/Paper-Report-red?logo=adobeacrobatreader" alt="Tech Report"></a>
24
+ <a href="https://huggingface.co/tencent/Hy-Embodied-RxBrain-1.0"><img src="https://img.shields.io/badge/Models-HuggingFace-yellow?logo=huggingface" alt="Models"></a>
25
+ <a href="https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0"><img src="https://img.shields.io/badge/GitHub-Repo-181717?logo=github&logoColor=white" alt="GitHub"></a>
26
+
27
+ </div>
28
+
29
+ <div align="center">
30
+ <img src="https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0/blob/main/assets/teaser.png?raw=true" alt="RxBrain — capability overview" width="90%">
31
+ </div>
32
+
33
+ ## 🔥 Updates
34
+
35
+ * **`[2026-07]`** 🎉 We release **Hy-Embodied-RxBrain-1.0** — the technical report, official inference code, and model weights.
36
+
37
+ ## 📖 Introduction
38
+
39
+ **RxBrain** (`Hy-Embodied-RxBrain-1.0`) is a **unified multimodal foundation model for embodied cognition** — a single model that couples language reasoning with visual imagination to deliver three core capabilities:
40
+
41
+ * 🤖 **Embodied Understanding & Reasoning** — question answering and chain-of-thought over images and multi-frame video.
42
+ * 🔮 **World State Prediction** — imagine the near-future frames an action produces in the physical world.
43
+ * 🧩 **Joint Subgoal Planning** — decompose a task into steps, emitting for each step *both* the next action (language) *and* the goal image it should reach (vision).
44
+
45
+ These capabilities are unified through **interleaved generation**: within a single autoregressive sequence RxBrain alternates reasoning text and flow-matched imagined frames — a learned `<Image>` token decides when to imagine — so an embodied plan couples *what to do* with *what the world should look like*, step by step.
46
+
47
+ ## ⭐️ Key Features
48
+
49
+ * 🧠 **Unified Mixture-of-Transformers (MoT):** A ~6.2B-parameter backbone with modality-specific pathways (text / vision / generation), so understanding and image synthesis share one autoregressive model instead of separate towers.
50
+ * 🎨 **Flow-Matching Image Head:** Imagined frames are produced by a flow-matching head decoding into a frozen **FLUX** VAE latent space, enabling text-to-image, multi-frame world-model rollout, and goal-image planning.
51
+ * 🔗 **Interleaved Reasoning + Imagination:** Text reasoning and generated frames are emitted in one sequence, coupling symbolic plans with visual goals.
52
+
53
+ ## 📅 Roadmap
54
+
55
+ - [x] Transformers Inference (understanding + generation)
56
+ - [ ] vLLM Inference
57
+ - [ ] Fine-tuning Code
58
+ - [ ] Online Gradio Demo
59
+
60
+ ## 🛠️ Dependencies and Installation
61
+
62
+ ### Prerequisites
63
+
64
+ - 🖥️ **Operating System**: Linux (recommended)
65
+ - 🐍 **Python**: 3.10+
66
+ - ⚡ **CUDA**: 12.x, an NVIDIA GPU (required for `flash-attn`)
67
+ - 🔥 **PyTorch**: 2.10
68
+
69
+ ### Installation
70
+
71
+ 1. **Install the specific Transformers version required for this model** (it provides the `hunyuan_vl_mot` backbone that `unified_mot` builds on):
72
+ ```bash
73
+ pip install git+https://github.com/huggingface/transformers@9293856c419762ebf98fbe2bd9440f9ce7069f1a
74
+ ```
75
+ > **Note:** A stock `transformers` release does **not** yet include `hunyuan_vl_mot`; this pinned commit is required. We will merge the improvements into the Transformers main branch later.
76
+
77
+ 2. **Clone the inference code and install the remaining dependencies:**
78
+ ```bash
79
+ git clone https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0.git
80
+ cd Hy-Embodied-RxBrain-1.0
81
+ pip install -r requirements.txt
82
+ ```
83
+
84
+ ### Model Download
85
+
86
+ | Component | Params | Source |
87
+ |---|:---:|---|
88
+ | **Hy-Embodied-RxBrain-1.0** | ~6.2 B | [🤗 tencent/Hy-Embodied-RxBrain-1.0](https://huggingface.co/tencent/Hy-Embodied-RxBrain-1.0) |
89
+ | FLUX VAE (`ae.safetensors`) | 83.8 M | Obtain from the [FLUX](https://github.com/black-forest-labs/flux) distribution |
90
+
91
+ Download the weights to a **local directory** — the loader reads the checkpoint files directly, so `--ckpt` must be a local path, **not** the Hub repo id:
92
+
93
+ ```bash
94
+ pip install -U "huggingface_hub[cli]"
95
+ hf download tencent/Hy-Embodied-RxBrain-1.0 --local-dir ./Hy-Embodied-RxBrain-1.0
96
+ ```
97
+
98
+ The VQA (understanding) path needs **only** the main weights. Image generation (T2I / world-model rollout / interleaved planning) additionally requires the external **FLUX VAE** `ae.safetensors`.
99
+
100
+
101
+ ## 🚀 Quick Start with Transformers
102
+
103
+ Load the Transformers processor together with the `UnifiedMoT` classes shipped in this repo, then run understanding (VQA). Run this from the repo root so the `model` package is importable, and point `MODEL_PATH` at your **local** download (see [Model Download](#model-download)).
104
+
105
+ ```python
106
+ import torch
107
+ from transformers.models.hunyuan_vl_mot import HunYuanVLMoTProcessor
108
+ from model import UnifiedMoTForConditionalGeneration, maybe_init_generation_path
109
+ from vqa_inference import answer
110
+
111
+ MODEL_PATH = "./Hy-Embodied-RxBrain-1.0" # local checkpoint directory, not the Hub id
112
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
113
+ dtype = torch.bfloat16
114
+
115
+ # Load processor & model
116
+ processor = HunYuanVLMoTProcessor.from_pretrained(MODEL_PATH, trust_remote_code=True)
117
+ model = UnifiedMoTForConditionalGeneration.from_pretrained(MODEL_PATH, dtype=dtype)
118
+ maybe_init_generation_path(model, model_load_path=MODEL_PATH) # wires up the generation path
119
+ model.to(device).eval()
120
+
121
+ # Ask a question about an image
122
+ text = answer(
123
+ model, processor,
124
+ image_paths=["demo_cases/bridgev2_move_toy/input/obs_1.jpg"],
125
+ question="What objects are on the stovetop, and where is the green toy?",
126
+ device=device, dtype=dtype, max_new_tokens=256,
127
+ )
128
+ print(text)
129
+ ```
130
+
131
+ > **Note:** RxBrain uses a custom interleaved text/image decoding loop rather than the standard `model.generate` API. The `answer(...)` helper (in `vqa_inference.py`) wraps that loop for the understanding case; image generation and planning have their own entry points below.
132
+
133
+ The same tasks are also available as ready-to-run scripts:
134
+
135
+ <details open>
136
+ <summary><b>① Visual Question Answering (VQA)</b> — image(s) + question → answer text</summary>
137
+
138
+ Pure autoregressive text understanding — **no VAE / flow-matching needed**.
139
+
140
+ ```bash
141
+ python vqa_inference.py \
142
+ --ckpt ./Hy-Embodied-RxBrain-1.0 \
143
+ --images demo_cases/bridgev2_move_toy/input/obs_1.jpg \
144
+ --question "What objects are on the stovetop, and where is the green toy?" \
145
+ --max_new_tokens 256
146
+ ```
147
+ </details>
148
+
149
+
150
+ <details open>
151
+ <summary><b>② Text-to-Image (T2I)</b></summary>
152
+
153
+ ```bash
154
+ python text2image_inference.py \
155
+ --ckpt ./Hy-Embodied-RxBrain-1.0 --vae /path/to/ae.safetensors \
156
+ --prompt "a watercolor painting of a cat" \
157
+ --height 256 --width 256 --num_steps 25 --out out.png
158
+
159
+ # with classifier-free guidance
160
+ python text2image_inference.py \
161
+ --ckpt ./Hy-Embodied-RxBrain-1.0 --vae /path/to/ae.safetensors \
162
+ --prompt "a watercolor painting of a cat" \
163
+ --cfg_scale 5.0 --num_steps 50 --out out.png
164
+ ```
165
+ </details>
166
+
167
+ <details open>
168
+ <summary><b>③ Multi-Frame World-Model Rollout</b> — imagine future frames from an observation</summary>
169
+
170
+ ```bash
171
+ python multiframe_inference.py \
172
+ --ckpt ./Hy-Embodied-RxBrain-1.0 --vae /path/to/ae.safetensors \
173
+ --frames /path/to/obs.jpg --task "imagine the next frames" \
174
+ --num_frames 4 --num_steps 50 --out_dir multiframe_out
175
+ ```
176
+ </details>
177
+
178
+ <details>
179
+ <summary><b>④ Interleaved Embodied Planning</b> — text plan + goal images, step by step</summary>
180
+
181
+ Runs interleaved planning on a bundled scene. See [`demo_cases/README.md`](https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0/blob/main/demo_cases/README.md) for details.
182
+
183
+ ```bash
184
+ CASE=umi_fold_sock
185
+ python interleave_inference.py \
186
+ --ckpt ./Hy-Embodied-RxBrain-1.0 --vae /path/to/ae.safetensors \
187
+ --frames demo_cases/$CASE/input/*.jpg \
188
+ --task "$(cat demo_cases/$CASE/prompt.txt)" \
189
+ --max_frames 5 --num_steps 50 --out_dir out_$CASE
190
+ ```
191
+ </details>
192
+
193
+ ## 📊 Evaluation
194
+
195
+ RxBrain is evaluated on embodied understanding, spatial reasoning, and imagination/generation benchmarks. For detailed metrics and methodology, please refer to our [technical report](https://github.com/Tencent-Hunyuan/Hy-Embodied-RxBrain-1.0/blob/main/assets/RxBrain_v0.pdf).
196
+
chat_template.jinja ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if not add_generation_prompt is defined %}
2
+ {%- set add_generation_prompt = false %}
3
+ {%- endif %}
4
+ {%- set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_first_user=true, is_last_user=false) %}
5
+ {%- for message in messages %}
6
+ {%- if message['role'] == 'system' %}
7
+ {%- if ns.is_first_sp %}
8
+ {%- set ns.system_prompt = ns.system_prompt + message['content'] %}
9
+ {%- set ns.is_first_sp = false %}
10
+ {%- else %}
11
+ {% set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] %}
12
+ {%- endif %}
13
+ {%- endif %}
14
+ {%- endfor %}
15
+ {{- bos_token }}
16
+ {{- ns.system_prompt }}
17
+ {%- if tools %}
18
+ {%- if ns.system_prompt != '' %}
19
+ {{- '\n\n# Tools\n\nYou may call one or more functions to assist with the user query.' }}
20
+ {%- else %}
21
+ {{- '# Tools\n\nYou may call one or more functions to assist with the user query.' }}
22
+ {%- endif %}
23
+ {{- '\n\nYou are provided with function signatures within <tools></tools> XML tags:' }}
24
+ {{- '\n<tools>\n' }}
25
+ {%- for tool in tools %}
26
+ {%- if loop.index0 > 1 %}
27
+ {{- '\n' }}
28
+ {%- endif %}
29
+ {{- tool | tojson }}
30
+ {%- endfor %}
31
+ {{- '\n</tools>\n\n' }}
32
+ {{- 'For function call returns, you should first print <tool_calls>' }}
33
+ {{- 'For each function call, you should return object like:\n' }}
34
+ {{- '<tool_call>function_name\n```json\nfunction_arguments_in_json_format\n```</tool_call>' }}
35
+ {{- 'At the end of function call returns, you should print </tool_calls>' }}
36
+ {%- endif %}
37
+ {%- if ns.system_prompt != '' or tools %}
38
+ {{- '<|hy_place▁holder▁no▁3|>' }}
39
+ {%- endif %}
40
+ {%- set image_count = namespace(value=0) %}
41
+ {%- set video_count = namespace(value=0) %}
42
+ {%- set last_user_idx = namespace(value=-1) %}
43
+ {%- for message in messages %}
44
+ {%- if message['role'] == 'user' %}
45
+ {%- set last_user_idx.value = loop.index0 %}
46
+ {%- endif %}
47
+ {%- endfor %}
48
+ {%- for message in messages %}
49
+ {%- if message['role'] == 'user' %}
50
+ {%- set ns.is_tool = false %}
51
+ {%- set ns.is_first = false %}
52
+ {%- set ns.is_last_user = true %}
53
+ {{- '<|hy_User|>'}}
54
+ {%- if message.content is string %}
55
+ {{- message.content }}
56
+ {%- else %}
57
+ {%- for content in message.content %}
58
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
59
+ {%- set image_count.value = image_count.value + 1 %}
60
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
61
+ <|hy_place▁holder▁no▁666|><|hy_place▁holder▁no▁669|><|hy_place▁holder▁no▁672|><|hy_place▁holder▁no▁667|>
62
+ {%- elif content.type == 'video' or 'video' in content %}
63
+ {%- set video_count.value = video_count.value + 1 %}
64
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
65
+ <|hy_place▁holder▁no▁666|><|hy_place▁holder▁no▁670|><|hy_place▁holder▁no▁672|><|hy_place▁holder▁no▁667|>
66
+ {%- elif 'text' in content %}
67
+ {{- content.text }}
68
+ {%- endif %}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {%- if loop.index0 == last_user_idx.value %}
72
+ {%- if enable_thinking is defined and enable_thinking %}
73
+ {{- '/think' }}
74
+ {%- else %}
75
+ {{- '/no_think' }}
76
+ {%- endif %}
77
+ {%- else %}
78
+ {{- '/no_think' }}
79
+ {%- endif %}
80
+ {%- endif %}
81
+ {%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}
82
+ {%- set ns.is_last_user = false %}
83
+ {%- if ns.is_tool %}
84
+ {{- '</tool_responses>' }}
85
+ {%- endif %}
86
+ {{- '<|hy_Assistant|>' }}
87
+ {%- set ns.is_first = false %}
88
+ {%- set ns.is_tool = false %}
89
+ {%- set ns.is_output_first = true %}
90
+ {%- for tool in message['tool_calls'] %}
91
+ {%- set arguments = tool['function']['arguments'] %}
92
+ {%- if arguments is not string %}
93
+ {%- set arguments = arguments | tojson %}
94
+ {%- endif %}
95
+ {%- if not ns.is_first %}
96
+ {%- if message['content'] is none %}
97
+ {{- '<tool_calls><tool_call>' + tool['function']['name'] + '\n```json\n' + arguments + '\n```</tool_call>' }}
98
+ {%- else %}
99
+ {{- message['content'] + '<tool_calls><tool_call>' + tool['function']['name'] + '\n```json\n' + arguments + '\n```</tool_call>' }}
100
+ {%- endif %}
101
+ {%- set ns.is_first = true %}
102
+ {%- else %}
103
+ {{- '\n<tool_call>' + tool['function']['name'] + '\n```json\n' + arguments + '\n```</tool_call>' }}
104
+ {%- endif %}
105
+ {%- endfor %}
106
+ {{- '</tool_calls>' + eos_token }}
107
+ {%- endif %}
108
+ {%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none) %}
109
+ {%- set ns.is_last_user = false %}
110
+ {{- '<|hy_Assistant|>' }}
111
+ {{- '<think>\n\n</think>\n' }}
112
+ {{- '<answer>\n' }}
113
+ {%- if message['content'] is string %}
114
+ {{- message['content'] }}
115
+ {%- else %}
116
+ {%- for content_item in message['content'] %}
117
+ {%- if 'text' in content_item %}
118
+ {{- content_item['text'] }}
119
+ {%- endif %}
120
+ {%- endfor %}
121
+ {%- endif %}
122
+ {{- '\n</answer>' }}
123
+ {{- eos_token }}
124
+ {%- endif %}
125
+ {%- if message['role'] == 'tool' %}
126
+ {%- set ns.is_last_user = false %}
127
+ {%- set ns.is_tool = true %}
128
+ {%- if ns.is_output_first %}
129
+ {{- '<|hy_User|>' + '<tool_responses><tool_response>' + message['content'] + '</tool_response>' }}
130
+ {%- set ns.is_output_first = false %}
131
+ {%- else %}
132
+ {{- '\n<tool_response>' + message['content'] + '</tool_response>' }}
133
+ {%- endif %}
134
+ {%- endif %}
135
+ {%- endfor %}
136
+ {%- if ns.is_tool %}
137
+ {{- '</tool_responses>' }}
138
+ {%- endif %}
139
+ {%- if add_generation_prompt %}
140
+ {{- '<|hy_Assistant|>' }}
141
+ {%- if enable_thinking is defined and enable_thinking %}
142
+ {{- '<think>' }}
143
+ {%- else %}
144
+ {{- '<think>\n\n</think>\n' }}
145
+ {%- endif %}
146
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_classification_head": false,
3
+ "architectures": [
4
+ "UnifiedMoTForConditionalGeneration"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "attention_head_dim": 128,
9
+ "bos_token_id": 120000,
10
+ "boundary_loss_weight": 0.0,
11
+ "cla_share_factor": 2,
12
+ "class_num": 0,
13
+ "dense_list": [
14
+ 2048,
15
+ 0
16
+ ],
17
+ "dtype": "bfloat16",
18
+ "eos_token_id": 120020,
19
+ "flow_latent_placeholder_id": 120690,
20
+ "flow_loss_weight": 1.0,
21
+ "head_dim": 128,
22
+ "hidden_act": "silu",
23
+ "hidden_size": 2048,
24
+ "im_end_id": 5,
25
+ "im_newline_id": 11,
26
+ "im_start_id": 4,
27
+ "image_end_token_id": 120120,
28
+ "image_start_token_id": 120119,
29
+ "image_token_id": 120687,
30
+ "initializer_range": 0.02,
31
+ "intermediate_size": 6144,
32
+ "latent_patch_size": 2,
33
+ "latent_token_id": 120690,
34
+ "mask_init_id": 12,
35
+ "max_latent_size": 32,
36
+ "max_position_embeddings": 262144,
37
+ "mlp_bias": false,
38
+ "model_type": "unified_mot",
39
+ "norm_type": "rms",
40
+ "num_attention_heads": 16,
41
+ "num_hidden_layers": 32,
42
+ "num_key_value_heads": 4,
43
+ "org_vocab_size": 120818,
44
+ "pad_id": 120002,
45
+ "pad_token_id": 120002,
46
+ "pool_type": "last",
47
+ "pretraining_tp": 1,
48
+ "rms_norm_eps": 1e-05,
49
+ "rope_scaling": {
50
+ "alpha": 1000.0,
51
+ "beta_fast": 32,
52
+ "beta_slow": 1,
53
+ "factor": 1.0,
54
+ "mscale": 1.0,
55
+ "mscale_all_dim": 1.0,
56
+ "type": "dynamic"
57
+ },
58
+ "rope_theta": 10000.0,
59
+ "sep_token_id": 120007,
60
+ "text_config": {
61
+ "_name_or_path": "",
62
+ "add_classification_head": false,
63
+ "architectures": [
64
+ "UnifiedMoTForConditionalGeneration"
65
+ ],
66
+ "attention_bias": false,
67
+ "attention_dropout": 0.0,
68
+ "attention_head_dim": 128,
69
+ "cla_share_factor": 2,
70
+ "class_num": 0,
71
+ "dense_list": [
72
+ 2048,
73
+ 0
74
+ ],
75
+ "dtype": "bfloat16",
76
+ "head_dim": 128,
77
+ "hidden_act": "silu",
78
+ "hidden_size": 2048,
79
+ "im_end_id": 5,
80
+ "im_newline_id": 11,
81
+ "im_start_id": 4,
82
+ "initializer_range": 0.02,
83
+ "intermediate_size": 6144,
84
+ "mask_init_id": 12,
85
+ "max_position_embeddings": 262144,
86
+ "mlp_bias": false,
87
+ "mlp_g_init_noise_std": 0.0001,
88
+ "mlp_g_intermediate_size": 12288,
89
+ "model_type": "unified_mot",
90
+ "norm_type": "rms",
91
+ "num_attention_heads": 16,
92
+ "num_hidden_layers": 32,
93
+ "num_key_value_heads": 4,
94
+ "org_vocab_size": 120818,
95
+ "pad_id": 120002,
96
+ "pool_type": "last",
97
+ "pretraining_tp": 1,
98
+ "rms_norm_eps": 1e-05,
99
+ "rope_scaling": {
100
+ "alpha": 1000.0,
101
+ "beta_fast": 32,
102
+ "beta_slow": 1,
103
+ "factor": 1.0,
104
+ "mscale": 1.0,
105
+ "mscale_all_dim": 1.0,
106
+ "type": "dynamic"
107
+ },
108
+ "rope_theta": 10000.0,
109
+ "sep_token_id": 120007,
110
+ "text_end_id": 7,
111
+ "text_start_id": 6,
112
+ "use_cache": true,
113
+ "use_cla": false,
114
+ "use_moe": false,
115
+ "use_qk_norm": true,
116
+ "use_rotary_pos_emb": true,
117
+ "use_varlen_flash_attn": true,
118
+ "vision_full_attention": false,
119
+ "vocab_size": 120818
120
+ },
121
+ "text_end_id": 7,
122
+ "text_loss_weight": 1.0,
123
+ "text_start_id": 6,
124
+ "timestep_shift": 1.0,
125
+ "transformers_version": "4.57.0",
126
+ "use_cache": true,
127
+ "use_cla": false,
128
+ "use_qk_norm": true,
129
+ "use_rotary_pos_emb": true,
130
+ "vae_image_downsample": 16,
131
+ "vae_z_channels": 16,
132
+ "video_end_token_id": 120123,
133
+ "video_start_token_id": 120122,
134
+ "vision_config": {
135
+ "anyres_vit_max_image_size": 2048,
136
+ "attention_dropout": 0.0,
137
+ "cat_extra_token": 1,
138
+ "dtype": "bfloat16",
139
+ "hidden_act": "gelu",
140
+ "hidden_size": 1152,
141
+ "img_max_token_num": 4096,
142
+ "intermediate_size": 4304,
143
+ "interpolate_mode": "bilinear",
144
+ "learnable_mlp_pooling_size": 0,
145
+ "max_image_size": 2048,
146
+ "max_vit_seq_len": 16384,
147
+ "min_image_size": 512,
148
+ "model_type": "hunyuan_vl_mot",
149
+ "num_attention_heads": 16,
150
+ "num_channels": 3,
151
+ "num_hidden_layers": 27,
152
+ "num_key_value_heads": 16,
153
+ "out_hidden_size": 4096,
154
+ "patch_size": 16,
155
+ "perceive_post_norm": true,
156
+ "perceive_pre_norm": true,
157
+ "remove_prenorm": true,
158
+ "resize_resolution": 2048,
159
+ "rms_norm_eps": 1e-05,
160
+ "spatial_merge_size": 2,
161
+ "spatial_patch_size": 1,
162
+ "temporal_patch_size": 1,
163
+ "text_hidden_size": 2048,
164
+ "video_max_image_size": 768,
165
+ "video_min_image_size": 256,
166
+ "vision_full_attention": false
167
+ },
168
+ "vocab_size": 120818
169
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 120000,
4
+ "eos_token_id": [
5
+ 120020
6
+ ],
7
+ "pad_token_id": 120002,
8
+ "transformers_version": "4.57.0"
9
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa8d2cf13e6056494f89fb49ace96057dd9008371def50641c36a7d05e29d936
3
+ size 4999925816
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c490f84bb2054b6d29866eb070a6c5e002adcfeccfa00d7927e88d22d9ba67d7
3
+ size 4974862032
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:413a279bb4afdb55892d8ff25a3118f9013dfd82247513eaa389b5e39944bf20
3
+ size 2441807536
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": null,
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "device": null,
6
+ "disable_grouping": null,
7
+ "do_center_crop": null,
8
+ "do_convert_rgb": true,
9
+ "do_normalize": true,
10
+ "do_pad": null,
11
+ "do_rescale": true,
12
+ "do_resize": true,
13
+ "image_mean": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "image_processor_type": "Qwen2VLImageProcessorFast",
19
+ "image_std": [
20
+ 0.5,
21
+ 0.5,
22
+ 0.5
23
+ ],
24
+ "input_data_format": null,
25
+ "max_pixels": 524288,
26
+ "merge_size": 2,
27
+ "min_pixels": 25088,
28
+ "pad_size": null,
29
+ "patch_size": 16,
30
+ "processor_class": "HunYuanVLMoTProcessor",
31
+ "resample": 3,
32
+ "rescale_factor": 0.00392156862745098,
33
+ "return_tensors": null,
34
+ "size": {
35
+ "longest_edge": 524288,
36
+ "shortest_edge": 25088
37
+ },
38
+ "temporal_patch_size": 1
39
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|hy_begin▁of▁sentence|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|hy_place▁holder▁no▁2|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "image_newline_token": "<|hy_place▁holder▁no▁671|>",
17
+ "image_token": "<|hy_place▁holder▁no▁669|>",
18
+ "pad_token": {
19
+ "content": "<|hy_▁pad▁|>",
20
+ "lstrip": false,
21
+ "normalized": false,
22
+ "rstrip": false,
23
+ "single_word": false
24
+ },
25
+ "video_token": "<|hy_place▁holder▁no▁670|>",
26
+ "vision_end_token": "<|hy_place▁holder▁no▁667|>",
27
+ "vision_start_token": "<|hy_place▁holder▁no▁666|>"
28
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
video_preprocessor_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": null,
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "device": null,
6
+ "do_center_crop": null,
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "do_sample_frames": true,
12
+ "fps": 2.0,
13
+ "image_mean": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "image_std": [
19
+ 0.5,
20
+ 0.5,
21
+ 0.5
22
+ ],
23
+ "input_data_format": null,
24
+ "max_frames": 16,
25
+ "merge_size": 2,
26
+ "min_frames": 8,
27
+ "num_frames": null,
28
+ "pad_size": null,
29
+ "patch_size": 16,
30
+ "processor_class": "HunYuanVLMoTProcessor",
31
+ "resample": 3,
32
+ "rescale_factor": 0.00392156862745098,
33
+ "return_metadata": false,
34
+ "size": {
35
+ "longest_edge": 134217728,
36
+ "shortest_edge": 100352
37
+ },
38
+ "temporal_patch_size": 1,
39
+ "video_metadata": null,
40
+ "video_processor_type": "Qwen3VLVideoProcessor"
41
+ }