satgeze commited on
Commit
dfb5deb
·
verified ·
1 Parent(s): fe985ae

Upload train_config.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. train_config.py +77 -0
train_config.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from deepspec.trainer import Qwen3DSparkTrainer
3
+ BASE_TB_DIR = os.path.expanduser("~/tensorboard")
4
+ BASE_CKPT_DIR = os.path.expanduser("~/checkpoints")
5
+ project_name = "deepspec"
6
+ exp_name = "dspark_block15_qwen36_27b_online"
7
+ seed = 42
8
+
9
+ model = dict(
10
+ target_model_name_or_path="/mnt/t5evo/models/Qwen3.6-27B",
11
+ block_size=15,
12
+ num_draft_layers=5,
13
+ # Qwen3.5-0.8B: 24 layers (6 full-attention), hidden 1024
14
+ target_layer_ids=[1, 16, 31, 46, 61],
15
+ # free embedding slot: tokenizer len 248077 < embed 248320 (same family trick as ornith_9b)
16
+ mask_token_id=248200,
17
+ init_draft_from="/mnt/data/dspark-test/head_q36_27b_dflash_init/model.safetensors",
18
+ num_anchors=512,
19
+ markov_rank=256,
20
+ # match z-lab DFlash warm-start geometry (differs from target-derived defaults)
21
+ head_dim=128,
22
+ num_attention_heads=32,
23
+ num_key_value_heads=8,
24
+ intermediate_size=17408,
25
+ markov_head_type="vanilla",
26
+ confidence_head_alpha=1.0,
27
+ confidence_head_with_markov=True,
28
+ loss_decay_gamma=4.0,
29
+ ce_loss_alpha=0.1,
30
+ l1_loss_alpha=0.9,
31
+ )
32
+
33
+ train = dict(
34
+ trainer_cls=Qwen3DSparkTrainer,
35
+ lr=5.0e-4,
36
+ warmup_ratio=0.04,
37
+ weight_decay=0.0,
38
+ precision="bf16",
39
+ local_batch_size=1,
40
+ global_batch_size=128, # single Pro 6000; 0.8B target fits with room
41
+ num_train_epochs=5,
42
+ max_train_steps=None,
43
+ max_grad_norm=1.0,
44
+ sharding_strategy="no_shard",
45
+ torch_compile=True,
46
+ )
47
+
48
+ logging = dict(
49
+ logging_steps=10,
50
+ checkpointing_steps=200,
51
+ )
52
+
53
+ data = dict(
54
+ online_target=True,
55
+ target_cache_path=None,
56
+ train_data_paths=[
57
+ "/mnt/data/DeepSpec/train_datasets/q27_regen_12k.jsonl",
58
+ ],
59
+ min_loss_tokens=14,
60
+ chat_template="qwen",
61
+ max_length=2048,
62
+ num_workers=4,
63
+ )
64
+
65
+
66
+ def finalize_cfg(cfg):
67
+ logging_cfg = dict(cfg["logging"])
68
+ project_name = str(cfg["project_name"])
69
+ exp_name = str(cfg["exp_name"])
70
+ logging_cfg["checkpoint_dir"] = os.path.join(BASE_CKPT_DIR, project_name, exp_name)
71
+ logging_cfg["tensorboard_dir"] = os.path.join(BASE_TB_DIR, project_name, exp_name)
72
+ cfg["logging"] = logging_cfg
73
+ return cfg
74
+
75
+
76
+ # --opts overrides applied at save time
77
+ train['num_train_epochs'] = 3