Initial release: CALM baseline (Pipeline A, LLaDA2)
Browse files- .gitattributes +1 -0
- README.md +58 -0
- added_tokens.json +29 -0
- chat_template.jinja +85 -0
- config.json +66 -0
- generation_config.json +9 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- modeling_qwen3.py +171 -0
- special_tokens_map.json +45 -0
- tokenizer.json +3 -0
- tokenizer_config.json +249 -0
- vocab.json +0 -0
.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,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- diffusion-language-model
|
| 6 |
+
- distillation
|
| 7 |
+
- dllm
|
| 8 |
+
- qwen3
|
| 9 |
+
- bd3lm
|
| 10 |
+
base_model: dllm-collection/Qwen3-0.6B-diffusion-bd3lm-v0.1
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# distill-LLaDA2-CALM
|
| 14 |
+
|
| 15 |
+
This is the **CALM (Pipeline A baseline)** student checkpoint from
|
| 16 |
+
*Turning the TIDE: Cross-Architecture Distillation for Diffusion Large Language Models*.
|
| 17 |
+
It is a 0.6B Qwen3-BD3LM diffusion language model distilled in the **Cross-Tokenizer (LLaDA2 → BD3LM)** pipeline.
|
| 18 |
+
Forward chunk-level approximate likelihood matching baseline.
|
| 19 |
+
|
| 20 |
+
- Code: https://github.com/Nobody-Zhang/dllm_release
|
| 21 |
+
- Project page: https://pku-yuangroup.github.io/TIDE-Page/
|
| 22 |
+
- Paper: https://arxiv.org/abs/XXXX.XXXXX
|
| 23 |
+
|
| 24 |
+
## Loading
|
| 25 |
+
|
| 26 |
+
This checkpoint uses custom modeling code (`A2DQwen3LMHeadModel`) registered via the `auto_map` field in `config.json`. Pass `trust_remote_code=True`:
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from transformers import AutoConfig, AutoModelForMaskedLM, AutoTokenizer
|
| 30 |
+
|
| 31 |
+
repo = "TIDE-dllm/distill-LLaDA2-CALM"
|
| 32 |
+
cfg = AutoConfig.from_pretrained(repo, trust_remote_code=True)
|
| 33 |
+
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
|
| 34 |
+
model = AutoModelForMaskedLM.from_pretrained(repo, trust_remote_code=True)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
For sampling and evaluation, install the companion library:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
git clone https://github.com/Nobody-Zhang/dllm_release && cd dllm_release
|
| 41 |
+
pip install -e .
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
See the GitHub README for full sampling, evaluation, and distillation instructions.
|
| 45 |
+
|
| 46 |
+
## Citation
|
| 47 |
+
|
| 48 |
+
```bibtex
|
| 49 |
+
@misc{tide2026,
|
| 50 |
+
title = {Turning the TIDE: Cross-Architecture Distillation for Diffusion Large Language Models},
|
| 51 |
+
author = {Zhang, Gongbo and Wang, Wen and Tian, Ye and Yuan, Li},
|
| 52 |
+
year = {2026},
|
| 53 |
+
eprint = {XXXX.XXXXX},
|
| 54 |
+
archivePrefix = {arXiv},
|
| 55 |
+
primaryClass = {cs.CL},
|
| 56 |
+
url = {https://arxiv.org/abs/XXXX.XXXXX},
|
| 57 |
+
}
|
| 58 |
+
```
|
added_tokens.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"<|mask|>": 151669,
|
| 20 |
+
"<|object_ref_end|>": 151647,
|
| 21 |
+
"<|object_ref_start|>": 151646,
|
| 22 |
+
"<|quad_end|>": 151651,
|
| 23 |
+
"<|quad_start|>": 151650,
|
| 24 |
+
"<|repo_name|>": 151663,
|
| 25 |
+
"<|video_pad|>": 151656,
|
| 26 |
+
"<|vision_end|>": 151653,
|
| 27 |
+
"<|vision_pad|>": 151654,
|
| 28 |
+
"<|vision_start|>": 151652
|
| 29 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 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.role == "user") or (message.role == "system" and not loop.first) %}
|
| 27 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 28 |
+
{%- elif message.role == "assistant" %}
|
| 29 |
+
{%- set content = message.content %}
|
| 30 |
+
{%- set reasoning_content = '' %}
|
| 31 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 32 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 33 |
+
{%- else %}
|
| 34 |
+
{%- if '</think>' in message.content %}
|
| 35 |
+
{%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
|
| 36 |
+
{%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{%- endif %}
|
| 39 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 40 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 41 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 42 |
+
{%- else %}
|
| 43 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 47 |
+
{%- endif %}
|
| 48 |
+
{%- if message.tool_calls %}
|
| 49 |
+
{%- for tool_call in message.tool_calls %}
|
| 50 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 51 |
+
{{- '\n' }}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- if tool_call.function %}
|
| 54 |
+
{%- set tool_call = tool_call.function %}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 57 |
+
{{- tool_call.name }}
|
| 58 |
+
{{- '", "arguments": ' }}
|
| 59 |
+
{%- if tool_call.arguments is string %}
|
| 60 |
+
{{- tool_call.arguments }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{{- tool_call.arguments | tojson }}
|
| 63 |
+
{%- endif %}
|
| 64 |
+
{{- '}\n</tool_call>' }}
|
| 65 |
+
{%- endfor %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{{- '<|im_end|>\n' }}
|
| 68 |
+
{%- elif message.role == "tool" %}
|
| 69 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 70 |
+
{{- '<|im_start|>user' }}
|
| 71 |
+
{%- endif %}
|
| 72 |
+
{{- '\n<tool_response>\n' }}
|
| 73 |
+
{{- message.content }}
|
| 74 |
+
{{- '\n</tool_response>' }}
|
| 75 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 76 |
+
{{- '<|im_end|>\n' }}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{%- endfor %}
|
| 80 |
+
{%- if add_generation_prompt %}
|
| 81 |
+
{{- '<|im_start|>assistant\n' }}
|
| 82 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 83 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"A2DQwen3LMHeadModel"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "modeling_qwen3.A2DQwen3Config",
|
| 9 |
+
"AutoModel": "modeling_qwen3.A2DQwen3Model",
|
| 10 |
+
"AutoModelForMaskedLM": "modeling_qwen3.A2DQwen3LMHeadModel"
|
| 11 |
+
},
|
| 12 |
+
"bos_token_id": 151643,
|
| 13 |
+
"dtype": "bfloat16",
|
| 14 |
+
"eos_token_id": 151645,
|
| 15 |
+
"head_dim": 128,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"hidden_size": 1024,
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"intermediate_size": 3072,
|
| 20 |
+
"layer_types": [
|
| 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 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention"
|
| 49 |
+
],
|
| 50 |
+
"max_position_embeddings": 40960,
|
| 51 |
+
"max_window_layers": 28,
|
| 52 |
+
"model_type": "a2d-qwen3",
|
| 53 |
+
"num_attention_heads": 16,
|
| 54 |
+
"num_hidden_layers": 28,
|
| 55 |
+
"num_key_value_heads": 8,
|
| 56 |
+
"pad_token_id": 151643,
|
| 57 |
+
"rms_norm_eps": 1e-06,
|
| 58 |
+
"rope_scaling": null,
|
| 59 |
+
"rope_theta": 1000000,
|
| 60 |
+
"sliding_window": null,
|
| 61 |
+
"tie_word_embeddings": true,
|
| 62 |
+
"transformers_version": "4.57.0",
|
| 63 |
+
"use_cache": true,
|
| 64 |
+
"use_sliding_window": false,
|
| 65 |
+
"vocab_size": 151936
|
| 66 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 151643,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 151643,
|
| 8 |
+
"transformers_version": "4.57.0"
|
| 9 |
+
}
|
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:1f1834cd6307d49d7ea915d6761058b71b226726abe9c7d28c332dc436c8be1c
|
| 3 |
+
size 1192135096
|
modeling_qwen3.py
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional
|
| 2 |
+
|
| 3 |
+
import torch
|
| 4 |
+
from torch import nn
|
| 5 |
+
|
| 6 |
+
import transformers
|
| 7 |
+
from transformers.cache_utils import Cache, DynamicCache
|
| 8 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast
|
| 9 |
+
from transformers.processing_utils import Unpack
|
| 10 |
+
from transformers.utils import TransformersKwargs
|
| 11 |
+
from transformers.modeling_attn_mask_utils import _prepare_4d_attention_mask
|
| 12 |
+
|
| 13 |
+
if transformers.utils.is_torch_flex_attn_available():
|
| 14 |
+
from torch.nn.attention.flex_attention import _DEFAULT_SPARSE_BLOCK_SIZE as flex_default_block_size
|
| 15 |
+
from torch.nn.attention.flex_attention import BlockMask, create_block_mask
|
| 16 |
+
else:
|
| 17 |
+
# Register a fake type to avoid crashing for annotations and `isinstance` checks
|
| 18 |
+
BlockMask = torch.Tensor
|
| 19 |
+
|
| 20 |
+
class A2DQwen3Config(transformers.Qwen3Config):
|
| 21 |
+
model_type = "a2d-qwen3" # <- NEW model_type
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class A2DQwen3Model(transformers.Qwen3Model):
|
| 25 |
+
|
| 26 |
+
def forward(
|
| 27 |
+
self,
|
| 28 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 29 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 30 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 31 |
+
past_key_values: Optional[Cache] = None,
|
| 32 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 33 |
+
use_cache: Optional[bool] = None,
|
| 34 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 35 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 36 |
+
) -> BaseModelOutputWithPast:
|
| 37 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 38 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 39 |
+
|
| 40 |
+
if inputs_embeds is None:
|
| 41 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 42 |
+
|
| 43 |
+
if use_cache and past_key_values is None:
|
| 44 |
+
past_key_values = DynamicCache(config=self.config)
|
| 45 |
+
|
| 46 |
+
if cache_position is None:
|
| 47 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 48 |
+
cache_position = torch.arange(
|
| 49 |
+
past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
if position_ids is None:
|
| 53 |
+
position_ids = cache_position.unsqueeze(0)
|
| 54 |
+
|
| 55 |
+
"""
|
| 56 |
+
# -------------------------------------------------------------
|
| 57 |
+
# ORIGINAL CODE (causal mask)
|
| 58 |
+
# -------------------------------------------------------------
|
| 59 |
+
# It may already have been prepared by e.g. `generate`
|
| 60 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 61 |
+
# Prepare mask arguments
|
| 62 |
+
mask_kwargs = {
|
| 63 |
+
"config": self.config,
|
| 64 |
+
"input_embeds": inputs_embeds,
|
| 65 |
+
"attention_mask": attention_mask,
|
| 66 |
+
"cache_position": cache_position,
|
| 67 |
+
"past_key_values": past_key_values,
|
| 68 |
+
"position_ids": position_ids,
|
| 69 |
+
}
|
| 70 |
+
# Create the masks
|
| 71 |
+
causal_mask_mapping = {
|
| 72 |
+
"full_attention": create_causal_mask(**mask_kwargs),
|
| 73 |
+
}
|
| 74 |
+
# The sliding window alternating layers are not always activated depending on the config
|
| 75 |
+
if self.has_sliding_layers:
|
| 76 |
+
causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
|
| 77 |
+
# -------------------------------------------------------------
|
| 78 |
+
# ORIGINAL CODE (causal mask)
|
| 79 |
+
# -------------------------------------------------------------
|
| 80 |
+
"""
|
| 81 |
+
# -------------------------------------------------------------
|
| 82 |
+
# NEW CODE (bidirectional, padding-only mask)
|
| 83 |
+
# -------------------------------------------------------------
|
| 84 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 85 |
+
# 1) If no mask is provided → treat all tokens as valid (no padding)
|
| 86 |
+
if attention_mask is None:
|
| 87 |
+
attention_mask = torch.ones(
|
| 88 |
+
inputs_embeds.shape[:2],
|
| 89 |
+
device=inputs_embeds.device,
|
| 90 |
+
dtype=torch.long
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
# 2) If mask is not already a 4D attention mask → convert it
|
| 94 |
+
if not (
|
| 95 |
+
isinstance(attention_mask, BlockMask)
|
| 96 |
+
or (isinstance(attention_mask, torch.Tensor) and attention_mask.ndim == 4)
|
| 97 |
+
):
|
| 98 |
+
attention_mask = _prepare_4d_attention_mask(attention_mask, self.dtype)
|
| 99 |
+
|
| 100 |
+
# 3) Build causal mask mapping used by the attention layers
|
| 101 |
+
causal_mask_mapping = {"full_attention": attention_mask}
|
| 102 |
+
|
| 103 |
+
# Sliding-window layers share the same non-causal mask
|
| 104 |
+
if self.has_sliding_layers:
|
| 105 |
+
causal_mask_mapping["sliding_attention"] = attention_mask
|
| 106 |
+
# -------------------------------------------------------------
|
| 107 |
+
# NEW CODE (bidirectional, padding-only mask)
|
| 108 |
+
# -------------------------------------------------------------
|
| 109 |
+
|
| 110 |
+
hidden_states = inputs_embeds
|
| 111 |
+
|
| 112 |
+
# create position embeddings to be shared across the decoder layers
|
| 113 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 114 |
+
|
| 115 |
+
for decoder_layer in self.layers[: self.config.num_hidden_layers]:
|
| 116 |
+
hidden_states = decoder_layer(
|
| 117 |
+
hidden_states,
|
| 118 |
+
attention_mask=causal_mask_mapping[decoder_layer.attention_type],
|
| 119 |
+
position_ids=position_ids,
|
| 120 |
+
past_key_values=past_key_values,
|
| 121 |
+
use_cache=use_cache,
|
| 122 |
+
cache_position=cache_position,
|
| 123 |
+
position_embeddings=position_embeddings,
|
| 124 |
+
**kwargs,
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
hidden_states = self.norm(hidden_states)
|
| 128 |
+
return BaseModelOutputWithPast(
|
| 129 |
+
last_hidden_state=hidden_states,
|
| 130 |
+
past_key_values=past_key_values if use_cache else None,
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
class A2DQwen3LMHeadModel(transformers.Qwen3ForCausalLM):
|
| 135 |
+
config: A2DQwen3Config
|
| 136 |
+
|
| 137 |
+
def __init__(self, config):
|
| 138 |
+
transformers.Qwen3PreTrainedModel.__init__(self, config)
|
| 139 |
+
self.model = A2DQwen3Model(config)
|
| 140 |
+
self.vocab_size = config.vocab_size
|
| 141 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 142 |
+
|
| 143 |
+
# Initialize weights and apply final processing
|
| 144 |
+
self.post_init()
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
transformers.AutoConfig.register("a2d-qwen3", A2DQwen3Config)
|
| 148 |
+
transformers.AutoModel.register(A2DQwen3Config, A2DQwen3LMHeadModel)
|
| 149 |
+
transformers.AutoModelForMaskedLM.register(A2DQwen3Config, A2DQwen3LMHeadModel)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
if __name__ == "__main__":
|
| 153 |
+
import dllm
|
| 154 |
+
import torch
|
| 155 |
+
from transformers import AutoModel
|
| 156 |
+
|
| 157 |
+
# Load a config from a local path (either a directory containing config.json, or the file itself)
|
| 158 |
+
config_path = dllm.utils.resolve_with_base_env(
|
| 159 |
+
"Qwen/Qwen3-0.6B-Base", "BASE_MODELS_DIR"
|
| 160 |
+
)
|
| 161 |
+
config = A2DQwen3Config.from_pretrained(config_path)
|
| 162 |
+
if hasattr(config, "auto_map"):
|
| 163 |
+
delattr(config, "auto_map")
|
| 164 |
+
if hasattr(config, "architectures"):
|
| 165 |
+
delattr(config, "architectures")
|
| 166 |
+
|
| 167 |
+
torch.set_default_device("cuda")
|
| 168 |
+
model = A2DQwen3LMHeadModel(config)
|
| 169 |
+
model.save_pretrained("models-tmp/a2d-qwen3")
|
| 170 |
+
auto_model = AutoModel.from_pretrained("models-tmp/a2d-qwen3")
|
| 171 |
+
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"bos_token": {
|
| 18 |
+
"content": "<|endoftext|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"eos_token": {
|
| 25 |
+
"content": "<|im_end|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
},
|
| 31 |
+
"mask_token": {
|
| 32 |
+
"content": "<|mask|>",
|
| 33 |
+
"lstrip": false,
|
| 34 |
+
"normalized": false,
|
| 35 |
+
"rstrip": false,
|
| 36 |
+
"single_word": false
|
| 37 |
+
},
|
| 38 |
+
"pad_token": {
|
| 39 |
+
"content": "<|endoftext|>",
|
| 40 |
+
"lstrip": false,
|
| 41 |
+
"normalized": false,
|
| 42 |
+
"rstrip": false,
|
| 43 |
+
"single_word": false
|
| 44 |
+
}
|
| 45 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d55810de1daf81d1d1259355b4b85810385022ab745be68029295935a4eacf0
|
| 3 |
+
size 11422839
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"151669": {
|
| 214 |
+
"content": "<|mask|>",
|
| 215 |
+
"lstrip": false,
|
| 216 |
+
"normalized": false,
|
| 217 |
+
"rstrip": false,
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"special": true
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
"additional_special_tokens": [
|
| 223 |
+
"<|im_start|>",
|
| 224 |
+
"<|im_end|>",
|
| 225 |
+
"<|object_ref_start|>",
|
| 226 |
+
"<|object_ref_end|>",
|
| 227 |
+
"<|box_start|>",
|
| 228 |
+
"<|box_end|>",
|
| 229 |
+
"<|quad_start|>",
|
| 230 |
+
"<|quad_end|>",
|
| 231 |
+
"<|vision_start|>",
|
| 232 |
+
"<|vision_end|>",
|
| 233 |
+
"<|vision_pad|>",
|
| 234 |
+
"<|image_pad|>",
|
| 235 |
+
"<|video_pad|>"
|
| 236 |
+
],
|
| 237 |
+
"bos_token": "<|endoftext|>",
|
| 238 |
+
"clean_up_tokenization_spaces": false,
|
| 239 |
+
"eos_token": "<|im_end|>",
|
| 240 |
+
"errors": "replace",
|
| 241 |
+
"extra_special_tokens": {},
|
| 242 |
+
"mask_token": "<|mask|>",
|
| 243 |
+
"model_max_length": 131072,
|
| 244 |
+
"pad_token": "<|endoftext|>",
|
| 245 |
+
"padding_side": "right",
|
| 246 |
+
"split_special_tokens": false,
|
| 247 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 248 |
+
"unk_token": null
|
| 249 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|