-
Notifications
You must be signed in to change notification settings - Fork 32
Optimizes Native FSDP memory_efficient_init weight loading for multi-node EP/FSDP jobs & add mutlti-node scripts #207
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
Merged
+180
−370
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
897891a
fix(native-fsdp): use node-local rank0 for memory efficient init
02a6aa8
delete deprecated code
41fe609
lint fix
3526c29
feat: add LoRA adapter state dict extraction with EP support
bcf6598
fix: replace point-to-point send/recv with broadcast in FSDP state dict
2c4e0ce
fix(dist): use send/recv fallback for HCCL local broadcast
bf295e4
feat:add multi node script
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
26 changes: 26 additions & 0 deletions
26
cookbook/transformers/ep_fsdp2_lora_deepseek_v4_multinode.sh
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,26 @@ | ||
|
|
||
| # `deepseek-ai/DeepSeek-V4-Flash` uses mixed FP4/FP8 weights. | ||
| # Convert the checkpoint before training by following: | ||
| # https://gitcode.com/cann/cann-recipes-train/blob/master/llm_pretrain/deepseekv4/README.md#%E6%A8%A1%E5%9E%8B%E6%9D%83%E9%87%8D%E5%87%86%E5%A4%87 | ||
| # Install `transformers==5.8.0` before running this cookbook. | ||
|
|
||
| export DSV4_MODEL_ID="ms://deepseek-ai/DeepSeek-V4-Flash-bf16" | ||
| export DATASET_ID="ms://swift/self-cognition" | ||
| # The following environment variables are required for multi-node training. Adjust the values according to your cluster setup. | ||
| export GLOO_SOCKET_IFNAME="eth0" # Use ifconfig to check the network interface name | ||
| export HCCL_SOCKET_IFNAME="eth0" | ||
| export HCCL_EXEC_TIMEOUT=1200 | ||
| export HCCL_CONNECT_TIMEOUT=1200 | ||
| export NNODES=4 | ||
| export NUM_GPUS=64 | ||
| export MASTER_ADDR="node0" # Replace with the IP address or hostname of the master node | ||
| export MASTER_PORT=29500 # Replace with an open port on the master node | ||
| export HCCL_IF_BASE_PORT=20000 | ||
|
|
||
| torchrun --nnodes=$NNODES --node_rank=$NODE_RANK --nproc_per_node=16 \ | ||
| --master_addr=$MASTER_ADDR --master_port=$MASTER_PORT ep_fsdp2_lora_deepseek_v4.py | ||
|
|
||
| # NODE_RANK=0 OUTPUT_DIR=./output sh ep_fsdp2_lora_deepseek_v4_multinode.sh | ||
| # NODE_RANK=1 OUTPUT_DIR=./output sh ep_fsdp2_lora_deepseek_v4_multinode.sh | ||
| # NODE_RANK=2 OUTPUT_DIR=./output sh ep_fsdp2_lora_deepseek_v4_multinode.sh | ||
| # NODE_RANK=3 OUTPUT_DIR=./output sh ep_fsdp2_lora_deepseek_v4_multinode.sh |
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.