Skip to content

Commit 5c9955e

Browse files
authored
support qwen2.5 eagle3 training (#220)
1 parent 57cb107 commit 5c9955e

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"architectures": [
3+
"Eagle3LlamaForCausalLM"
4+
],
5+
"attention_dropout": 0.0,
6+
"bos_token_id": 151643,
7+
"eos_token_id": 151643,
8+
"hidden_act": "silu",
9+
"hidden_size": 3584,
10+
"initializer_range": 0.02,
11+
"intermediate_size": 18944,
12+
"max_position_embeddings": 131072,
13+
"max_window_layers": 28,
14+
"model_type": "llama",
15+
"num_attention_heads": 28,
16+
"num_hidden_layers": 1,
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.40.1",
24+
"use_cache": true,
25+
"use_mrope": false,
26+
"use_sliding_window": false,
27+
"vocab_size": 152064,
28+
"draft_vocab_size": 32000
29+
}

angelslim/compressor/speculative/train/data/chat_templates.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ChatTemplateType(Enum):
2727
"""Supported chat template types."""
2828

2929
QWEN2_AUDIO = "qwen2_audio"
30+
QWEN2_5 = "qwen2.5"
3031
QWEN3 = "qwen3"
3132
HUNYUAN = "hunyuan"
3233
QWEN3_VL = "qwen3_vl"
@@ -37,6 +38,7 @@ class ChatTemplateType(Enum):
3738
# String to ChatTemplateType mapping
3839
CHAT_TEMPLATE_TYPE_MAPPING = {
3940
"qwen2_audio": ChatTemplateType.QWEN2_AUDIO,
41+
"qwen2.5": ChatTemplateType.QWEN2_5,
4042
"qwen3": ChatTemplateType.QWEN3,
4143
"hunyuan": ChatTemplateType.HUNYUAN,
4244
"hunyuan_7b": ChatTemplateType.HUNYUAN_7B,
@@ -86,6 +88,21 @@ def _initialize_templates(self) -> Dict[ChatTemplateType, ChatTemplate]:
8688
"please don't share false information."
8789
),
8890
),
91+
ChatTemplateType.QWEN2_5: ChatTemplate(
92+
user_header="<|im_start|>user\n",
93+
assistant_header="<|im_start|>assistant\n",
94+
system_prompt=(
95+
"You are a helpful, respectful and honest assistant. "
96+
"Always answer as helpfully as possible, while being safe. "
97+
"Your answers should not include any harmful, unethical, racist, "
98+
"sexist, toxic, dangerous, or illegal content. Please ensure that "
99+
"your responses are socially unbiased and positive in nature.\n\n"
100+
"If a question does not make any sense, or is not factually "
101+
"coherent, explain why instead of answering something not "
102+
"correct. If you don't know the answer to a question, "
103+
"please don't share false information."
104+
),
105+
),
89106
ChatTemplateType.HUNYUAN: ChatTemplate(
90107
user_header="<|hy_User|>",
91108
assistant_header="<|hy_Assistant|>",

docs/source/features/speculative_decoding/eagle/eagle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bash scripts/speculative/generate_vlm_hidden_for_draft_model.sh
7373
- `MODEL_NAME`: 目标模型的HF名称或本地路径
7474
- `TARGET_BACKEND`: 目标模型后端,目前仅支持HF
7575
- `MODEL_MAX_LENGTH`: 生成数据的上下文长度
76-
- `CHAT_TEMPLATE_TYPE`: 目标模型的目标类型,目前支持qwen3/hunyuan
76+
- `CHAT_TEMPLATE_TYPE`: 目标模型的目标类型,目前支持qwen3/qwen2.5/hunyuan/hunyuan-7b
7777
- `OUTPUT_DIR`: 生成的数据集输出路径
7878

7979

0 commit comments

Comments
 (0)