How to finetune mt0-xxl-mt(13B parameters) seq2seq_qa with deepspeed

I tried to finetune mt0-xxl-mt with the transformers official script examples/pytorch/question-answering/run_qa_seq2seq_qa.py, the machine has 8 x V100(32GB) GPU and 250GB CPU memory, but failed with OOM. Anyone can help me?

this is the command:

deepspeed --num_gpus 8 run_seq2seq_qa.py     --model_name_or_path bigscience/mt0-xxl-mt         --output_dir ./output         --dataset_name squad_v2         --context_column context     --question_column question         --answer_column answers        --do_train         --auto_find_batch_size         --learning_rate 3e-5   --num_train_epochs 2         --max_seq_length 512         --deepspeed ./ds_config.json

this is the ds_config.json:
{
“fp16”: {
“enabled”: “auto”,
“loss_scale”: 0,
“loss_scale_window”: 1000,
“initial_scale_power”: 16,
“hysteresis”: 2,
“min_loss_scale”: 1
},
“bf16”: {
“enabled”: “auto”
},
“optimizer”: {
“type”: “AdamW”,
“params”: {
“lr”: “auto”,
“betas”: “auto”,
“eps”: “auto”,
“weight_decay”: “auto”
}
},
“scheduler”: {
“type”: “WarmupLR”,
“params”: {
“warmup_min_lr”: “auto”,
“warmup_max_lr”: “auto”,
“warmup_num_steps”: “auto”
}
},
“zero_optimization”: {
“stage”: 3,
“offload_optimizer”: {
“device”: “cpu”,
“pin_memory”: true
},
“offload_param”: {
“device”: “cpu”,
“pin_memory”: true
},
“overlap_comm”: true,
“contiguous_gradients”: true,
“allgather_partitions”: true,
“allgather_bucket_size”: 2e8,
“reduce_scatter”: true,
“reduce_bucket_size”: 2e8,
“sub_group_size”: 1e9,
“stage3_prefetch_bucket_size”: “auto”,
“stage3_param_persistence_threshold”: “auto”,
“stage3_max_live_parameters”: 1e9,
“stage3_max_reuse_distance”: 1e9,
“stage3_gather_16bit_weights_on_model_save”: true
},
“gradient_accumulation_steps”: “auto”,
“gradient_clipping”: “auto”,
“steps_per_print”: 2000,
“train_batch_size”: “auto”,
“train_micro_batch_size_per_gpu”: “auto”,
“wall_clock_breakdown”: false
}

The behavior is:
Time to load utils op: 0.0003857612609863281 seconds
[2023-02-15 11:00:40,462] [INFO] [utils.py:831:see_memory_usage] DeepSpeedZeRoOffload initialize [begin]
[2023-02-15 11:00:40,463] [INFO] [utils.py:832:see_memory_usage] MA 0.0 GB Max_MA 0.0 GB CA 0.0 GB Max_CA 0 GB
[2023-02-15 11:00:40,463] [INFO] [utils.py:840:see_memory_usage] CPU Virtual Memory: used = 226.3 GB, percent = 90.0%
Parameter Offload: Total persistent parameters: 503808 in 124 params
[2023-02-15 11:00:40,595] [INFO] [utils.py:831:see_memory_usage] DeepSpeedZeRoOffload initialize [end]
[2023-02-15 11:00:40,595] [INFO] [utils.py:832:see_memory_usage] MA 0.0 GB Max_MA 0.0 GB CA 0.0 GB Max_CA 0 GB
[2023-02-15 11:00:40,596] [INFO] [utils.py:840:see_memory_usage] CPU Virtual Memory: used = 226.32 GB, percent = 90.0%
[2023-02-15 11:00:40,700] [INFO] [utils.py:831:see_memory_usage] Before creating fp16 partitions
[2023-02-15 11:00:40,701] [INFO] [utils.py:832:see_memory_usage] MA 0.0 GB Max_MA 0.0 GB CA 0.0 GB Max_CA 0 GB
[2023-02-15 11:00:40,702] [INFO] [utils.py:840:see_memory_usage] CPU Virtual Memory: used = 226.33 GB, percent = 90.0%
[2023-02-15 11:00:43,709] [INFO] [utils.py:831:see_memory_usage] After creating fp16 partitions: 12
[2023-02-15 11:00:43,710] [INFO] [utils.py:832:see_memory_usage] MA 0.0 GB Max_MA 0.0 GB CA 0.0 GB Max_CA 0 GB
[2023-02-15 11:00:43,711] [INFO] [utils.py:840:see_memory_usage] CPU Virtual Memory: used = 226.3 GB, percent = 90.0%
[2023-02-15 11:00:43,807] [INFO] [utils.py:831:see_memory_usage] Before creating fp32 partitions
[2023-02-15 11:00:43,807] [INFO] [utils.py:832:see_memory_usage] MA 0.0 GB Max_MA 0.0 GB CA 0.0 GB Max_CA 0 GB
[2023-02-15 11:00:43,808] [INFO] [utils.py:840:see_memory_usage] CPU Virtual Memory: used = 226.32 GB, percent = 90.0%
Traceback (most recent call last):
File “/data/yckj1358/projects/nlg/jobs/mt0-xxl-mt/…/…//tools/hf_run_seq2seq_qa.py”, line 767, in
main()
File “/data/yckj1358/projects/nlg/jobs/mt0-xxl-mt/…/…//tools/hf_run_seq2seq_qa.py”, line 703, in main
train_result = trainer.train(resume_from_checkpoint=checkpoint)
File “/data/yckj1358/.virtualenvs/transformers-pytorch-gpu/lib/python3.9/site-packages/transformers-4.27.0.dev0-py3.9.egg/transformers/trainer.py”, line 1571, in train
return inner_training_loop(
File “/data/yckj1358/.virtualenvs/transformers-pytorch-gpu/lib/python3.9/site-packages/accelerate/utils/memory.py”, line 122, in decorator
raise RuntimeError(“No executable batch size found, reached zero.”)
RuntimeError: No executable batch size found, reached zero.
[2023-02-15 11:01:24,284] [INFO] [launch.py:318:sigkill_handler] Killing subprocess 115133