Ziruibest commited on
Commit
56c55ff
·
verified ·
1 Parent(s): fac5a77

Upload BAGEL-7B-MoT model files

Browse files
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - Qwen/Qwen2.5-7B-Instruct
5
+ pipeline_tag: any-to-any
6
+ library_name: bagel-mot
7
+ ---
8
+
9
+
10
+ <p align="left">
11
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/nuhojubrps/banner.png" alt="BAGEL" width="480"/>
12
+ </p>
13
+
14
+
15
+ # 🥯 BAGEL • Unified Model for Multimodal Understanding and Generation
16
+
17
+
18
+
19
+ <p align="left">
20
+ <a href="https://bagel-ai.org/">
21
+ <img
22
+ src="https://img.shields.io/badge/BAGEL-Website-0A66C2?logo=safari&logoColor=white" style="display: inline-block; vertical-align: middle;"
23
+ alt="BAGEL Website"
24
+ />
25
+ </a>
26
+ <a href="https://arxiv.org/abs/2505.14683">
27
+ <img
28
+ src="https://img.shields.io/badge/BAGEL-Paper-red?logo=arxiv&logoColor=red" style="display: inline-block; vertical-align: middle;"
29
+ alt="BAGEL Paper on arXiv"
30
+ />
31
+ </a>
32
+ <a href="https://github.com/bytedance-seed/BAGEL" target="_blank" style="margin: 2px;">
33
+ <img
34
+ alt="Github" src="https://img.shields.io/badge/BAGEL-Codebase-536af5?color=536af5&logo=github" style="display: inline-block; vertical-align: middle;"
35
+ alt="BAGEL Codebase"
36
+ />
37
+ </a>
38
+ <a href="https://demo.bagel-ai.org/">
39
+ <img
40
+ src="https://img.shields.io/badge/BAGEL-Demo-blue?logo=googleplay&logoColor=white" style="display: inline-block; vertical-align: middle;"
41
+ alt="BAGEL Demo"
42
+ />
43
+ </a>
44
+ <a href="https://discord.com/invite/Z836xxzy">
45
+ <img
46
+ src="https://img.shields.io/badge/BAGEL-Discord-green?logo=discord&logoColor=white" style="display: inline-block; vertical-align: middle;"
47
+ alt="BAGEL Discord"
48
+ />
49
+ </a>
50
+
51
+
52
+ </p>
53
+
54
+
55
+ > We present **BAGEL**, an open‑source multimodal foundation model with 7B active parameters (14B total) trained on large‑scale interleaved multimodal data. BAGEL outperforms the current top‑tier open‑source VLMs like Qwen2.5-VL and InternVL-2.5 on standard multimodal understanding leaderboards, and delivers text‑to‑image quality that is competitive with strong specialist generators such as SD3.
56
+ Moreover, BAGEL demonstrates superior qualitative results in classical image‑editing scenarios than the leading open-source models. More importantly, it extends to free-form visual manipulation, multiview synthesis, and world navigation, capabilities that constitute "world-modeling" tasks beyond the scope of previous image-editing models.
57
+
58
+
59
+ This repository hosts the model weights for **BAGEL**. For installation, usage instructions, and further documentation, please visit our [GitHub repository](https://github.com/bytedance-seed/BAGEL).
60
+
61
+
62
+
63
+ <p align="left"><img src="https://github.com/ByteDance-Seed/Bagel/raw/main/assets/teaser.webp" width="80%"></p>
64
+
65
+
66
+
67
+
68
+
69
+
70
+ ## 🧠 Method
71
+ BAGEL adopts a Mixture-of-Transformer-Experts (MoT) architecture to maximize the model’s capacity to learn from richly diverse multimodal information. Following the same principle of capacity maximization, it utilizes two separate encoders to capture pixel-level and semantic-level features of an image. The overall framework follows a Next Group of Token Prediction paradigm, where the model is trained to predict the next group of language or visual tokens as a compression target.
72
+
73
+ BAGEL scales MoT’s capacity through Pre-training, Continued Training, and Supervised Finetuning on trillions of interleaved multimodal tokens spanning language, image, video, and web data. It surpasses open models on standard understanding and generation benchmarks and demonstrates advanced in-context multimodal abilities like free-form image editing, future frame prediction, 3D manipulation, world navigation, and sequential reasoning.
74
+
75
+ <p align="left"><img src="https://github.com/ByteDance-Seed/Bagel/raw/main/assets/arch.png" width="50%"></p>
76
+
77
+
78
+ ## 🌱 Emerging Properties
79
+ <p align="left"><img src="https://github.com/ByteDance-Seed/Bagel/raw/main/assets/emerging_curves.png" width="50%"></p>
80
+
81
+ As we scale up BAGEL’s pretraining with more multimodal tokens, we observe consistent performance gains across understanding, generation, and editing tasks. Different capabilities emerge at distinct training stages—multimodal understanding and generation appear early, followed by basic editing, while complex, intelligent editing emerges later. This staged progression suggests an emergent pattern, where advanced multimodal reasoning builds on well-formed foundational skills. Ablation studies further show that combining VAE and ViT features significantly improves intelligent editing, underscoring the importance of visual-semantic context in enabling complex multimodal reasoning and further supporting its role in the emergence of advanced capabilities.
82
+
83
+
84
+
85
+ ## 📊 Benchmarks
86
+ ### 1. Visual Understanding
87
+ | Model | MME ↑ | MMBench ↑ | MMMU ↑ | MM-Vet ↑ | MathVista ↑ |
88
+ | ------------------- | ----------: | ----------: | -------: | -------: | ----------: |
89
+ | Janus-Pro-7B | - | 79.2 | 41.0 | 50.0 | – |
90
+ | Qwen2.5-VL-7B | 2347 | 83.5 | **58.6** | 67.1 | 68.2 |
91
+ | **BAGEL** | **2388** | **85.0** | 55.3 | **67.2** | **73.1** |
92
+ ### 2. Text-to-Image Generation · GenEval
93
+ | Model | Overall ↑ |
94
+ | ------------ | --------- |
95
+ | FLUX-1-dev | 0.82 |
96
+ | SD3-Medium | 0.74 |
97
+ | Janus-Pro-7B | 0.80 |
98
+ | **BAGEL** | **0.88** |
99
+ ### 3. Image Editing
100
+ | Model | GEdit-Bench-EN (SC) ↑ | GEdit-Bench-EN (PQ) ↑ | GEdit-Bench-EN (O) ↑ | IntelligentBench ↑ |
101
+ | ------------- | --------------------- | --------------------- | ------------------- | ------------------ |
102
+ | Step1X-Edit | 7.09 | 6.76 | **6.70** | 14.9 |
103
+ | Gemini-2-exp. | 6.73 | 6.61 | 6.32 | **57.6** |
104
+ | **BAGEL** | **7.36** | **6.83** | 6.52 | 44.0 |
105
+ | **BAGEL+CoT** | – | – | – | 55.3 |
106
+
107
+ ## License
108
+ BAGEL is licensed under the Apache 2.0 license. It is finetuned from [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) and [siglip-so400m-14-384-flash-attn2](https://huggingface.co/HuggingFaceM4/siglip-so400m-14-384-flash-attn2) model, and uses the [FLUX.1-schnell VAE model](https://huggingface.co/black-forest-labs/FLUX.1-schnell), all under Apache 2.0.
109
+
110
+ ## ✍️ Citation
111
+ ```bibtex
112
+ @article{deng2025bagel,
113
+ title = {Emerging Properties in Unified Multimodal Pretraining},
114
+ author = {Deng, Chaorui and Zhu, Deyao and Li, Kunchang and Gou, Chenhui and Li, Feng and Wang, Zeyu and Zhong, Shu and Yu, Weihao and Nie, Xiaonan and Song, Ziang and Shi, Guang and Fan, Haoqi},
115
+ journal = {arXiv preprint arXiv:2505.14683},
116
+ year = {2025}
117
+ }
118
+ ```
ae.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afc8e28272cd15db3919bacdb6918ce9c1ed22e96cb12c4d5ed0fba823529e38
3
+ size 335304388
cache/models--ByteDance-Seed--BAGEL-7B-MoT/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ 570026eca23479ee7df5a6ce9fb50a835530da30
config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "name": [
3
+ "BAGEL-7B-MoT"
4
+ ],
5
+ }
convert_ema_to_standard.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Merge BAGEL EMA checkpoint into a standard inference checkpoint.
4
+
5
+ The repository ships two shards:
6
+ * ``ema.safetensors`` – EMA weights for the Mixture-of-Transformer stack,
7
+ connector and ViT encoder described by ``llm_config.json`` / ``vit_config.json``.
8
+ * ``ae.safetensors`` – VAE weights referenced by ``model.safetensors.index.json``.
9
+
10
+ This script combines the two into a single ``model`` checkpoint that can be used in
11
+ place of the EMA file. By default the script keeps the source files untouched and
12
+ writes a new ``model_from_ema.safetensors`` plus, optionally, an accompanying index.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import json
19
+ from collections import OrderedDict
20
+ from pathlib import Path
21
+ from typing import Dict
22
+
23
+ import torch
24
+
25
+
26
+ def parse_args() -> argparse.Namespace:
27
+ parser = argparse.ArgumentParser(
28
+ description="Convert BAGEL EMA weights into a regular inference checkpoint."
29
+ )
30
+ parser.add_argument(
31
+ "--ema",
32
+ type=Path,
33
+ default=Path("ema.safetensors"),
34
+ help="Path to the EMA weights file (default: ema.safetensors).",
35
+ )
36
+ parser.add_argument(
37
+ "--ae",
38
+ type=Path,
39
+ default=Path("ae.safetensors"),
40
+ help="Path to the VAE weights file (default: ae.safetensors).",
41
+ )
42
+ parser.add_argument(
43
+ "--output",
44
+ type=Path,
45
+ default=Path("model_from_ema.safetensors"),
46
+ help="Destination for the merged checkpoint.",
47
+ )
48
+ parser.add_argument(
49
+ "--index",
50
+ type=Path,
51
+ default=None,
52
+ help="Optional path for a Hugging Face style index JSON file.",
53
+ )
54
+ return parser.parse_args()
55
+
56
+
57
+ def load_safetensors(path: Path) -> Dict[str, torch.Tensor]:
58
+ try:
59
+ from safetensors.torch import load_file
60
+ except ImportError as exc: # pragma: no cover - raises early when dependency missing
61
+ raise RuntimeError(
62
+ "safetensors is required. Install it with `pip install safetensors`."
63
+ ) from exc
64
+
65
+ tensors = load_file(str(path))
66
+ if not tensors:
67
+ raise ValueError(f"{path} does not contain any tensors.")
68
+ return tensors
69
+
70
+
71
+ def save_safetensors(
72
+ tensors: Dict[str, torch.Tensor], path: Path, *, metadata: Dict[str, str]
73
+ ) -> None:
74
+ try:
75
+ from safetensors.torch import save_file
76
+ except ImportError as exc: # pragma: no cover - raises early when dependency missing
77
+ raise RuntimeError(
78
+ "safetensors is required. Install it with `pip install safetensors`."
79
+ ) from exc
80
+
81
+ save_file(tensors, str(path), metadata=metadata)
82
+
83
+
84
+ def compute_total_size_bytes(tensors: Dict[str, torch.Tensor]) -> int:
85
+ total = 0
86
+ for tensor in tensors.values():
87
+ total += tensor.element_size() * tensor.nelement()
88
+ return total
89
+
90
+
91
+ def main() -> None:
92
+ args = parse_args()
93
+
94
+ if not args.ema.is_file():
95
+ raise FileNotFoundError(f"EMA weights not found: {args.ema}")
96
+ if not args.ae.is_file():
97
+ raise FileNotFoundError(f"VAE weights not found: {args.ae}")
98
+
99
+ ema_state = load_safetensors(args.ema)
100
+ ae_state = load_safetensors(args.ae)
101
+
102
+ overlap = set(ae_state.keys()) & set(ema_state.keys())
103
+ if overlap:
104
+ raise ValueError(
105
+ f"Found {len(overlap)} overlapping parameter names between ae and ema files; "
106
+ "please inspect your checkpoints before merging."
107
+ )
108
+
109
+ merged = OrderedDict()
110
+ merged.update(sorted(ae_state.items()))
111
+ merged.update(sorted(ema_state.items()))
112
+
113
+ total_size = compute_total_size_bytes(merged)
114
+ metadata = {"total_size": str(total_size)}
115
+ save_safetensors(merged, args.output, metadata=metadata)
116
+
117
+ if args.index:
118
+ weight_map = {key: args.output.name for key in merged.keys()}
119
+ index_payload = {
120
+ "metadata": {"total_size": total_size},
121
+ "weight_map": weight_map,
122
+ }
123
+ args.index.write_text(json.dumps(index_payload, indent=4, ensure_ascii=False) + "\n")
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
ema.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b41c43835fd737b8c948e604870da522c091dcf151f3e8d55f84781765ee1a3
3
+ size 29214685336
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "pad_token_id": 151643,
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 151645,
7
+ 151643
8
+ ],
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.7,
11
+ "top_p": 0.8,
12
+ "top_k": 20,
13
+ "transformers_version": "4.37.0"
14
+ }
llm_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 3584,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 18944,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 28,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 28,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 4,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_theta": 1000000.0,
20
+ "sliding_window": 131072,
21
+ "tie_word_embeddings": false,
22
+ "torch_dtype": "bfloat16",
23
+ "transformers_version": "4.43.1",
24
+ "use_cache": true,
25
+ "use_sliding_window": false,
26
+ "vocab_size": 152064
27
+ }
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:8dd47a686ee248579b984a558f2640aad3d54f6f6d83e5d25197738a7c34e015
3
+ size 29549989332
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|im_end|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "split_special_tokens": false,
205
+ "tokenizer_class": "Qwen2Tokenizer",
206
+ "unk_token": null
207
+ }
vit_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "hidden_size": 1152,
3
+ "image_size": 980,
4
+ "intermediate_size": 4304,
5
+ "model_type": "siglip_vision_model",
6
+ "num_attention_heads": 16,
7
+ "num_hidden_layers": 27,
8
+ "patch_size": 14
9
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff