-
Notifications
You must be signed in to change notification settings - Fork 185
[hardware] feat: add Intel XPU device support #695
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
Draft
kahlun
wants to merge
4
commits into
ByteDance-Seed:main
Choose a base branch
from
kahlun:xpu/device-support
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.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b212058
[hardware] feat: add Intel XPU device support
kahlun f893cad
[review] fix: explicit fallback and robust XPU test behavior
kahlun 7a73397
tests(xpu): remove standalone fsdp2 smoke; generalize moe guard
kahlun 4fde11d
configs(xpu): move qwen2_5_xpu yaml into dedicated xpu folder
kahlun 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,53 @@ | ||
| model: | ||
| model_path: Qwen/Qwen2.5-0.5B-Instruct | ||
| ops_implementation: | ||
| attn_implementation: sdpa | ||
|
|
||
| data: | ||
| train_path: fineweb | ||
| train_size: 1000000000000 | ||
| dataloader: | ||
| type: native | ||
| drop_last: true | ||
| datasets_type: iterable | ||
| data_type: plaintext | ||
| max_seq_len: 512 | ||
| text_keys: text | ||
| dyn_bsz_buffer_size: 200 | ||
|
|
||
| train: | ||
| accelerator: | ||
| ulysses_size: 1 | ||
| fsdp_config: | ||
| fsdp_mode: fsdp1 | ||
| full_shard: true | ||
| offload: false | ||
| mixed_precision: | ||
| enable: true | ||
| offload: | ||
| enable_activation: false | ||
| gradient_checkpointing: | ||
| enable: true | ||
| global_batch_size: 8 | ||
| micro_batch_size: 1 | ||
| bsz_warmup_ratio: 0.007 | ||
| optimizer: | ||
| type: adamw | ||
| lr: 3.0e-4 | ||
| lr_warmup_ratio: 0.007 | ||
| lr_decay_style: constant | ||
| lr_decay_ratio: 1.0 | ||
| weight_decay: 0.01 | ||
| max_grad_norm: 1.0 | ||
| init_device: meta | ||
| enable_full_determinism: false | ||
| empty_cache_steps: 500 | ||
| checkpoint: | ||
| output_dir: Qwen2.5-0.5B-Instruct-sft-xpu | ||
| manager: dcp | ||
| save_steps: 100 | ||
| save_hf_weights: true | ||
| wandb: | ||
| enable: false | ||
| num_train_epochs: 1 | ||
| max_steps: 10 |
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,48 @@ | ||
| #!/bin/bash | ||
| # VeOmni trainer e2e SFT smoke test on Intel XPU (2 GPUs) | ||
|
|
||
| set -e | ||
|
|
||
| # Get the VeOmni root directory | ||
| VEOMNI_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
| cd "$VEOMNI_ROOT" | ||
|
|
||
| # XPU environment variables | ||
| export ZE_AFFINITY_MASK="0,1" | ||
| export CCL_ATL_SHM=1 | ||
| export CCL_BUFFER_CACHE=0 | ||
| export CCL_TOPO_FABRIC_VERTEX_CONNECTION_CHECK=0 | ||
| export CCL_TOPO_ALGO=0 | ||
| export RAY_NUM_PRESTART_PYTHON_WORKERS=0 | ||
|
|
||
| # Model and data setup | ||
| MODEL_PATH="${CI_HF_MODELS_DIR:-.}/Qwen/Qwen2.5-0.5B-Instruct" | ||
| DATASET_DIR="${CI_DATASET_DIR:-.}" | ||
|
|
||
| echo "==========================================" | ||
| echo "VeOmni e2e SFT Test on Intel XPU" | ||
| echo "==========================================" | ||
| echo "Model: Qwen2.5-0.5B-Instruct" | ||
| echo "GPUs: 2 (XPU devices 0,1 via ZE_AFFINITY_MASK)" | ||
| echo "Config: configs/xpu/text/qwen2_5_xpu.yaml (sdpa attention, fsdp1 trainer smoke)" | ||
| echo "" | ||
|
|
||
| # Run torchrun with 2 XPU GPUs | ||
| torchrun \ | ||
| --nnodes=1 \ | ||
| --nproc_per_node=2 \ | ||
| --master-port=4321 \ | ||
| tasks/train_text.py \ | ||
| configs/xpu/text/qwen2_5_xpu.yaml \ | ||
| --model.model_path "$MODEL_PATH" \ | ||
| --data.train_path "$DATASET_DIR/fineweb" \ | ||
| --train.checkpoint.output_dir "Qwen2.5-0.5B-Instruct-sft-xpu" \ | ||
| --train.accelerator.fsdp_config.fsdp_mode fsdp1 \ | ||
| --train.num_train_epochs 1 \ | ||
| --train.max_steps 5 \ | ||
| --train.wandb.enable false | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "VeOmni XPU e2e test PASSED!" | ||
| echo "==========================================" |
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guarding the import of
group_gemmkernels withtorch.cuda.is_available()will cause aNameErrorat runtime on XPU devices whenEPGroupGemmorEPMergedFc1GroupGemmare used, as these classes refer to the imported functions in their methods. If MoE is not yet supported on XPU, it would be better to provide a clear error message (e.g., aRuntimeErrorin theforwardmethod) or ensure the functions are defined asNoneand checked before use, rather than allowing aNameErrorto occur.