Skip to content

Commit df17d4b

Browse files
committed
Merge branch 'main' into mm-dataset
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
2 parents 94ab458 + 98c06c8 commit df17d4b

6 files changed

Lines changed: 72 additions & 11 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ updates:
1313
directory: "/"
1414
target-branch: "main"
1515
schedule:
16-
interval: "weekly"
16+
interval: "quarterly"
1717
open-pull-requests-limit: 10
1818
versioning-strategy: "increase"
1919
allow:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ dev = [
6969
"mkdocs~=1.6.1",
7070
"mkdocs-material[imaging]~=9.7.6",
7171
"markdown~=3.10.2",
72-
"pymdown-extensions~=10.21.2",
72+
"pymdown-extensions~=10.21.3",
7373
"mkdocs-section-index~=0.3.12",
7474
"mkdocs-minify-plugin~=0.8.0",
7575
"mkdocs-api-autonav~=0.4.0",
@@ -92,7 +92,7 @@ dev = [
9292

9393
# code quality
9494
"mypy~=2.1.0",
95-
"ruff~=0.14.1",
95+
"ruff~=0.15.13",
9696

9797
# docs quality
9898
"mdformat~=1.0.0",

src/speculators/train/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,6 @@ def apply_fully_sharded(model: torch.nn.Module):
156156
for layer in model.layers: # type: ignore[union-attr]
157157
fully_shard(layer, mp_policy=mp_policy)
158158

159-
fully_shard(model, mp_policy=mp_policy)
159+
fully_shard(model)
160160

161161
return model

tests/e2e/regression/test_training_only_acceptance.py

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ def _resolve_repo(repo_id: str, repo_type: str = "dataset") -> Path:
2020
try:
2121
return Path(
2222
snapshot_download(
23-
repo_id=repo_id, repo_type=repo_type, local_files_only=True
23+
repo_id=repo_id,
24+
repo_type=repo_type,
25+
local_files_only=True,
26+
allow_patterns=["*.arrow", "*.json", "*.pt", "hidden_states/*"],
2427
)
2528
)
2629
except LocalEntryNotFoundError:
27-
return Path(snapshot_download(repo_id=repo_id, repo_type=repo_type))
30+
return Path(
31+
snapshot_download(
32+
repo_id=repo_id,
33+
repo_type=repo_type,
34+
allow_patterns=["*.arrow", "*.json", "*.pt", "hidden_states/*"],
35+
)
36+
)
2837

2938

3039
@requires_cadence("weekly")
@@ -41,7 +50,7 @@ def test_eagle3_qwen3_8b_sharegpt(tmp_path: Path, prompts: list[list[dict[str, s
4150
seq_length=8192,
4251
epochs=epochs,
4352
lr=3e-4,
44-
draft_vocab_size=8192,
53+
draft_vocab_size=32000,
4554
online=False,
4655
log_freq=50,
4756
timeout=30 * 60, # 30 mins
@@ -71,7 +80,7 @@ def test_dflash_qwen3_8b_sharegpt(tmp_path: Path, prompts: list[list[dict[str, s
7180
seq_length=8192,
7281
epochs=epochs,
7382
lr=3e-4,
74-
draft_vocab_size=8192,
83+
draft_vocab_size=32000,
7584
num_layers=3,
7685
online=False,
7786
log_freq=50,
@@ -86,3 +95,39 @@ def test_dflash_qwen3_8b_sharegpt(tmp_path: Path, prompts: list[list[dict[str, s
8695
prompts=prompts,
8796
acceptance_thresholds=[0.30, 0.05, 0.001, 0, 0, 0, 0],
8897
)
98+
99+
100+
@requires_cadence("weekly")
101+
@pytest.mark.regression
102+
def test_peagle_qwen3_8b_sharegpt(tmp_path: Path, prompts: list[list[dict[str, str]]]):
103+
save_path = tmp_path / "checkpoints"
104+
hidden_states_dir = _resolve_repo("inference-optimization/Qwen3-8b-sharegpt-5k")
105+
epochs = 5
106+
run_training(
107+
model="Qwen/Qwen3-8B",
108+
speculator_type="peagle",
109+
data_path=hidden_states_dir,
110+
save_path=save_path,
111+
seq_length=8192,
112+
epochs=epochs,
113+
lr=6e-4,
114+
draft_vocab_size=32000,
115+
num_layers=4,
116+
online=False,
117+
log_freq=50,
118+
timeout=30 * 60, # 30 mins
119+
extra_train_args=[
120+
"--no-norm-before-residual",
121+
"--scheduler-type",
122+
"cosine",
123+
],
124+
)
125+
final_checkpoint = str(save_path / str(epochs - 1))
126+
run_vllm_engine(
127+
model_path=final_checkpoint,
128+
tmp_path=tmp_path,
129+
max_tokens=512,
130+
ignore_eos=True,
131+
prompts=prompts,
132+
acceptance_thresholds=[0.45, 0.1, 0.01],
133+
)

tests/e2e/smoke/test_offline_training.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,29 @@
3333
("model", "dataset", "speculator_type", "extra_train_args", "target_layer_ids"),
3434
[
3535
(TEXT_MODEL, "sharegpt", "eagle3", [], None), # Use default EAGLE layers
36+
(MM_MODEL, "sharegpt4v_coco", "eagle3", [], None), # Multimodal
3637
(
3738
TEXT_MODEL,
3839
"sharegpt",
3940
"dflash",
4041
["--block-size", "8", "--max-anchors", "256", "--num-layers", "3"],
4142
[1, 13, 25],
4243
), # DFlash with 3 layers + verifier last layer
43-
(MM_MODEL, "sharegpt4v_coco", "eagle3", [], None), # Multimodal
44+
(
45+
"peagle",
46+
[
47+
"--num-layers",
48+
"4",
49+
"--num-depths",
50+
"4",
51+
"--down-sample-ratio",
52+
"0.7",
53+
"--down-sample-ratio-min",
54+
"0.2",
55+
"--no-norm-before-residual",
56+
],
57+
None,
58+
), # P-EAGLE with parallel multi-token prediction
4459
],
4560
)
4661
def test_offline_smoke(

tests/unit/convert/test_eagle3_converter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,15 @@ def test_nm_testing_2layer_eagle3_model_config(self, tmp_path):
260260
checkpoint_path = "nm-testing/testing-llama3.1.8b-2layer-eagle3"
261261
base_model = "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic"
262262

263+
local_checkpoint_path = tmp_path / checkpoint_path.rsplit("/", maxsplit=1)[-1]
263264
converter.convert(
264265
checkpoint_path,
265-
tmp_path / checkpoint_path.split("/")[-1],
266+
local_checkpoint_path,
266267
base_model,
267268
norm_before_residual=False,
268269
)
269270

270-
config = load_checkpoint_config(tmp_path / checkpoint_path.split("/")[-1])
271+
config = load_checkpoint_config(local_checkpoint_path)
271272

272273
# Verify that num_hidden_layers is correctly set to 2
273274
assert config["transformer_layer_config"]["num_hidden_layers"] == 2

0 commit comments

Comments
 (0)