You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey I was trying to run the Megatron-LM code with your 3D parallelism. For pipeline parallelism, I unrolled the GPT-2 into an nn.Sequential like model and followed the AlexNet example to tweak the training script accordingly. But it keeps going out of memory for me even for a "train_micro_batch_size_per_gpu" of 1 in the 1.5bn model. I've disabled data & model parallelism and was running it on 8 GPUs with the partition method as "type:TransformerLayer".
I also see references to a "GPT2ModelPipe" in the code but I couldn't find it in the examples. Could you release this example for Megatron?
Hi @nitikasaran68, thank you for your interest in DeepSpeed! We're working on releasing a full example and tutorial. There have just been some initial tasks to address first, such as improved examples and some interface simplifications.
Hey, can you help me reproduce your GPT-2 3D parallelism results here (figure 5)
I'm unable to fit a batch size of even 1 with a single gradient accumulation step with the 4pp x 4dp setting on 16 V100s with 16GB memory. If I try 8pp and 2dp, a micro batch size of 1 fits for not more than 4 micro batches.
Here's how I'm wrapping the gpt2 model:
model = deepspeed.pipe.PipelineModule(layers=model.to_layers(),
num_stages=args.pipeline_depth,
loss_fn=loss_fn,
partition_method="type:GPT2ParallelTransformerLayer",
activation_checkpoint_interval=0)
I've gone through a lot of your code and I don't think I'm passing anything incorrectly but perhaps you could help me out?
Hi @nitikasaran68, try setting activation_checkpoint_interval=1 when you wrap the module. Activation checkpointing is a big memory saver for these kinds of models.
Activity
ShadenSmith commentedon Oct 29, 2020
Hi @nitikasaran68, thank you for your interest in DeepSpeed! We're working on releasing a full example and tutorial. There have just been some initial tasks to address first, such as improved examples and some interface simplifications.
nitikasaran68 commentedon Nov 3, 2020
Hey, can you help me reproduce your GPT-2 3D parallelism results here (figure 5)
I'm unable to fit a batch size of even 1 with a single gradient accumulation step with the 4pp x 4dp setting on 16 V100s with 16GB memory. If I try 8pp and 2dp, a micro batch size of 1 fits for not more than 4 micro batches.
Here's how I'm wrapping the gpt2 model:
model = deepspeed.pipe.PipelineModule(layers=model.to_layers(),
num_stages=args.pipeline_depth,
loss_fn=loss_fn,
partition_method="type:GPT2ParallelTransformerLayer",
activation_checkpoint_interval=0)
I've gone through a lot of your code and I don't think I'm passing anything incorrectly but perhaps you could help me out?
I'm using this config:
{
"train_batch_size": 8,
"train_micro_batch_size_per_gpu" : 1,
"steps_per_print": 1,
"zero_optimization": {
"stage": 1,
"reduce_bucket_size": 5000000,
"allgather_bucket_size": 5000000
},
"zero_allow_untested_optimizer": true,
"gradient_clipping": 1.0,
"fp16": {
"enabled": true,
"loss_scale": 0,
"loss_scale_window": 1000,
"hysteresis": 2,
"min_loss_scale": 1,
"initial_scale_power": 13
},
"wall_clock_breakdown": false
}
gpt_options="
--model-parallel-size 1
--num-layers 48
--hidden-size 1600
--num-attention-heads 16
--batch-size 1
--seq-length 1024
--max-position-embeddings 1024
--train-iters 100000
--resume-dataloader
--train-data webtext
--lazy-loader
--tokenizer-type GPT2BPETokenizer
--split 949,50,1
--distributed-backend nccl
--lr 0.00001
--no-load-optim
--lr-decay-style cosine
--weight-decay 1e-2
--log-interval 1
--clip-grad 1.0
--warmup .01
--fp16
ShadenSmith commentedon Nov 3, 2020
Hi @nitikasaran68, try setting
activation_checkpoint_interval=1when you wrap the module. Activation checkpointing is a big memory saver for these kinds of models.create branch for public release (#489)
xiexbing commentedon Sep 14, 2023
software issue has been solved.