-
Notifications
You must be signed in to change notification settings - Fork 272
[Feature] Add VP drafter training mode for DFlash #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
catnanami
wants to merge
7
commits into
sgl-project:main
Choose a base branch
from
catnanami:feature/vp-drafter-training
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b948e7
Add VP drafter training mode for DFlash
catnanami 1a144ea
Update specforge/core/dflash.py
catnanami 81a3554
Update specforge/core/dflash.py
catnanami 8a0c9c7
Update specforge/core/dflash.py
catnanami e1cb99d
fix formatting
47006b5
fix scripts with shebang
784d2c3
Merge branch 'main' into feature/vp-drafter-training
jiapingW File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "architectures": [ | ||
| "DFlashDraftModel" | ||
| ], | ||
| "attention_bias": false, | ||
| "attention_dropout": 0.0, | ||
| "auto_map": { | ||
| "AutoModel": "dflash.DFlashDraftModel" | ||
| }, | ||
| "block_size": 16, | ||
| "bos_token_id": 151643, | ||
| "dflash_config": { | ||
| "mask_token_id": 151669, | ||
| "target_layer_ids": [1, 9, 17, 25, 33], | ||
| "training_mode": "vp_drafter", | ||
| "prefix_weight_base": 0.9 | ||
| }, | ||
| "dtype": "bfloat16", | ||
| "eos_token_id": 151645, | ||
| "head_dim": 128, | ||
| "hidden_act": "silu", | ||
| "hidden_size": 4096, | ||
| "initializer_range": 0.02, | ||
| "intermediate_size": 12288, | ||
| "layer_types": [ | ||
| "full_attention", | ||
| "full_attention", | ||
| "full_attention", | ||
| "full_attention", | ||
| "full_attention" | ||
| ], | ||
| "max_position_embeddings": 40960, | ||
| "max_window_layers": 5, | ||
| "model_type": "qwen3", | ||
| "num_attention_heads": 32, | ||
| "num_hidden_layers": 5, | ||
| "num_key_value_heads": 8, | ||
| "num_target_layers": 36, | ||
| "rms_norm_eps": 1e-06, | ||
| "rope_scaling": null, | ||
| "rope_theta": 1000000, | ||
| "sliding_window": null, | ||
| "tie_word_embeddings": false, | ||
| "use_cache": true, | ||
| "use_sliding_window": false, | ||
| "vocab_size": 151936 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| ROOT_DIR=$(dirname $SCRIPT_DIR) | ||
| export TORCHINDUCTOR_CACHE_DIR=$ROOT_DIR/cache/compiled_kernels | ||
| export SPECFORGE_DATA_NUM_PROC=32 | ||
| NUM_GPUS=${1:-8} | ||
|
|
||
| ATTENTION_BACKEND=${2:-flex_attention} | ||
|
|
||
| torchrun \ | ||
| --standalone \ | ||
| --nproc_per_node $NUM_GPUS \ | ||
| $ROOT_DIR/scripts/train_dflash.py \ | ||
| --target-model-path Qwen/Qwen3-8B \ | ||
| --target-model-backend sglang \ | ||
| --draft-config-path $ROOT_DIR/configs/qwen3-8b-dta.json \ | ||
| --train-data-path $ROOT_DIR/cache/dataset/perfectblend_qwen3-8b_regen.jsonl \ | ||
| --output-dir $ROOT_DIR/outputs/qwen3-8b-dta-perfectblend \ | ||
| --num-epochs 6 \ | ||
| --batch-size 4 \ | ||
| --learning-rate 6e-4 \ | ||
| --warmup-ratio 0.04 \ | ||
| --max-grad-norm 1.0 \ | ||
| --max-length 3072 \ | ||
| --chat-template qwen \ | ||
| --attention-backend $ATTENTION_BACKEND \ | ||
| --loss-decay-gamma 7.0 \ | ||
| --log-interval 50 \ | ||
| --save-interval 1000 \ | ||
| --report-to wandb \ | ||
| --wandb-project specforge-qwen3-8b-dta \ | ||
| --block-size 16 \ | ||
| --num-anchors 512 \ | ||
| --wandb-name qwen3-8b-dta-perfectblend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.