SFT ERNIE-4.5-VL-28B-A3B-Thinking显存溢出
代码:
PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
MAX_PIXELS=4816896
MIN_PIXELS=3136
swift sft
--model ./ERNIE-4.5-VL-28B-A3B-Thinking
--model_type ernie_vl_thinking
--train_type lora
--dataset ./sft_data.json
--num_train_epochs 1
--per_device_train_batch_size 1
--learning_rate 1e-4
--lora_rank 16
--lora_alpha 32
--gradient_accumulation_steps 1
--max_length 8192
--max_new_tokens 512
--freeze_llm false
--freeze_vit true
--freeze_aligner true
--gradient_checkpointing true
--eval_steps 400
--save_steps 400
--save_total_limit 3
--logging_steps 1
--model_author swift
--model_name ernie-4_5-vl-28b-thinking-ui-grounding
报错:
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 30.56 GiB. GPU 7 has a total capacity of 79.33 GiB of which 14.89 GiB is free. Process 2520846 has 64.43 GiB memory in use. Of the allocated memory 63.19 GiB is allocated by PyTorch, and 755.35 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
显存分布:
虽然是8卡训练但显存只集中在一张卡上,请问如何对MOE模型加载时实现负载均衡,模型没有mcore和PT版本,不能使用megatron。
代码: PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True" CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 MAX_PIXELS=4816896 MIN_PIXELS=3136 swift sft --model ./ERNIE-4.5-VL-28B-A3B-Thinking --model_type ernie_vl_thinking --train_type lora --dataset ./sft_data.json --num_train_epochs 1 --per_device_train_batch_size 1 --learning_rate 1e-4 --lora_rank 16 --lora_alpha 32 --gradient_accumulation_steps 1 --max_length 8192 --max_new_tokens 512 --freeze_llm false --freeze_vit true --freeze_aligner true --gradient_checkpointing true --eval_steps 400 --save_steps 400 --save_total_limit 3 --logging_steps 1 --model_author swift --model_name ernie-4_5-vl-28b-thinking-ui-grounding 报错: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 30.56 GiB. GPU 7 has a total capacity of 79.33 GiB of which 14.89 GiB is free. Process 2520846 has 64.43 GiB memory in use. Of the allocated memory 63.19 GiB is allocated by PyTorch, and 755.35 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables) 显存分布:
虽然是8卡训练但显存只集中在一张卡上,请问如何对MOE模型加载时实现负载均衡,模型没有mcore和PT版本,不能使用megatron。
看着是device_map,加上NPROC_PER_NODE和deepspeed试一下看看
虽然是8卡训练但显存只集中在一张卡上,请问如何对MOE模型加载时实现负载均衡,模型没有mcore和PT版本,不能使用megatron。