Skip to content

Commit

Permalink
add configs for 2-8 gpus
Browse files Browse the repository at this point in the history
  • Loading branch information
xhluca committed Apr 24, 2024
1 parent 420a747 commit 3facd81
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
28 changes: 28 additions & 0 deletions modeling/llama/accelerate/fsdp_2gpus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Useful: https://huggingface.co/docs/accelerate/main/en/usage_guides/fsdp
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: FSDP
downcast_bf16: 'no'
fsdp_config:
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_backward_prefetch_policy: BACKWARD_PRE
fsdp_cpu_ram_efficient_loading: true
fsdp_forward_prefetch: false
fsdp_offload_params: false
fsdp_sharding_strategy: 1
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_sync_module_states: true
# Set fsdp_use_orig_params=true if using peft:
# https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019
fsdp_use_orig_params: false
machine_rank: 0
main_training_function: main
mixed_precision: bf16
num_machines: 1
num_processes: 2
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
28 changes: 28 additions & 0 deletions modeling/llama/accelerate/fsdp_6gpus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Useful: https://huggingface.co/docs/accelerate/main/en/usage_guides/fsdp
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: FSDP
downcast_bf16: 'no'
fsdp_config:
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_backward_prefetch_policy: BACKWARD_PRE
fsdp_cpu_ram_efficient_loading: true
fsdp_forward_prefetch: false
fsdp_offload_params: false
fsdp_sharding_strategy: 1
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_sync_module_states: true
# Set fsdp_use_orig_params=true if using peft:
# https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019
fsdp_use_orig_params: false
machine_rank: 0
main_training_function: main
mixed_precision: bf16
num_machines: 1
num_processes: 6
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
28 changes: 28 additions & 0 deletions modeling/llama/accelerate/fsdp_8gpus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Useful: https://huggingface.co/docs/accelerate/main/en/usage_guides/fsdp
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: FSDP
downcast_bf16: 'no'
fsdp_config:
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_backward_prefetch_policy: BACKWARD_PRE
fsdp_cpu_ram_efficient_loading: true
fsdp_forward_prefetch: false
fsdp_offload_params: false
fsdp_sharding_strategy: 1
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_sync_module_states: true
# Set fsdp_use_orig_params=true if using peft:
# https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019
fsdp_use_orig_params: false
machine_rank: 0
main_training_function: main
mixed_precision: bf16
num_machines: 1
num_processes: 8
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false

0 comments on commit 3facd81

Please sign in to comment.