Skip to content
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

How do I know if stage-3 is a success by using deepspeed? #6877

Open
hwhyyds opened this issue Dec 16, 2024 · 1 comment
Open

How do I know if stage-3 is a success by using deepspeed? #6877

hwhyyds opened this issue Dec 16, 2024 · 1 comment
Labels

Comments

@hwhyyds
Copy link

hwhyyds commented Dec 16, 2024

I used accelerate to packag the model with GPUs, but the model are copied in GPUs, not shard in GPUs. Why?

deepspeed_plugin = DeepSpeedPlugin(hf_ds_config="./configs/rl_ds_zero_3.json", zero_stage=3)

base_model = AutoModelForCausalLM.from_pretrained(
    model_path,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
)
accelerator = Accelerator(deepspeed_plugin=deepspeed_plugin, mixed_precision="bf16")
base_model= accelerator.prepare(base_model)

rl_ds_zero_3.json

{
  "train_micro_batch_size_per_gpu": 1,
  "model_parallel_size": 3,
  "zero_allow_untested_optimizer": true,
  "bf16": {
    "enabled": "auto"
  },
  "optimizer": {
    "type": "AdamW",
    "params": {
      "lr": 1e-5,
      "betas": [0.9, 0.999],
      "eps": 1e-8,
      "weight_decay": 0.01
    }
  },
  "zero_optimization": {
    "stage": 3,
    "allgather_partitions": true,
    "allgather_bucket_size": 5e8,
    "reduce_scatter": true,
    "contiguous_gradients": true,
    "overlap_comm": true,
    "sub_group_size": 1e9,
    "reduce_bucket_size": 5e8,
    "stage3_prefetch_bucket_size": 5e7,
    "stage3_param_persistence_threshold": 5e6,
    "stage3_max_live_parameters": 1e9,
    "stage3_max_reuse_distance": 1e9,
    "stage3_gather_16bit_weights_on_model_save": true,
    "offload_param": {
      "device": "cpu",
      "pin_memory": true
  }
  },
  "activation_checkpointing": {
    "partition_activations": true,
    "cpu_checkpointing": true,
    "number_checkpoints": 4,
    "synchronize_checkpoint_boundary": false,
    "contiguous_memory_optimization": true
  }
}
@tjruwase
Copy link
Contributor

@hwhyyds, can you please share more steps to reproduce, including logs, scripts, and command line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants