FLUX.1-dev dreambooth train on multigpu
Discussed in https://github.com/huggingface/diffusers/discussions/9277
Originally posted by MehmetcanTozlu August 26, 2024 I have 4 A6000 Ada Generation cards. but I get an error when training Flux.1-dev with dreambooth(train_dreambooth_flux.py). can anyone help?
pip list: absl-py 2.1.0 accelerate 0.33.0 bitsandbytes 0.43.3 certifi 2024.7.4 charset-normalizer 3.3.2 click 8.1.7 cmake 3.25.0 diffusers 0.31.0.dev0 docker-pycreds 0.4.0 filelock 3.15.4 fsspec 2024.6.1 ftfy 6.2.3 gitdb 4.0.11 GitPython 3.1.43 grpcio 1.66.0 huggingface-hub 0.24.6 idna 3.8 importlib_metadata 8.4.0 Jinja2 3.1.4 lit 15.0.7 Markdown 3.7 MarkupSafe 2.1.5 mpmath 1.3.0 networkx 3.3 numpy 1.26.4 nvidia-cublas-cu11 11.11.3.6 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu11 11.8.87 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu11 11.8.89 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu11 11.8.89 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu11 8.7.0.84 nvidia-cudnn-cu12 9.1.0.70 nvidia-cufft-cu11 10.9.0.58 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu11 10.3.0.86 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu11 11.4.1.48 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu11 11.7.5.86 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu11 2.19.3 nvidia-nccl-cu12 2.20.5 nvidia-nvjitlink-cu12 12.6.20 nvidia-nvtx-cu11 11.8.86 nvidia-nvtx-cu12 12.1.105 packaging 24.1 peft 0.12.0 pillow 10.4.0 pip 22.0.2 platformdirs 4.2.2 protobuf 5.27.3 psutil 6.0.0 PyYAML 6.0.2 regex 2024.7.24 requests 2.32.3 safetensors 0.4.4 sentencepiece 0.2.0 sentry-sdk 2.13.0 setproctitle 1.3.3 setuptools 59.6.0 six 1.16.0 smmap 5.0.1 sympy 1.13.2 tensorboard 2.17.1 tensorboard-data-server 0.7.2 tokenizers 0.19.1 torch 2.2.1+cu118 torchaudio 2.2.1+cu118 torchvision 0.17.1+cu118 tqdm 4.66.5 transformers 4.44.2 triton 2.2.0 typing_extensions 4.12.2 urllib3 2.2.2 wandb 0.17.7 wcwidth 0.2.13 Werkzeug 3.0.4 zipp 3.20.0
nvidia-smi: +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.161.08 Driver Version: 535.161.08 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA RTX 6000 Ada Gene... On | 00000000:00:10.0 Off | Off | | 30% 32C P8 28W / 300W | 1MiB / 49140MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ | 1 NVIDIA RTX 6000 Ada Gene... On | 00000000:00:11.0 Off | Off | | 30% 32C P8 24W / 300W | 1MiB / 49140MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ | 2 NVIDIA RTX 6000 Ada Gene... On | 00000000:00:1B.0 Off | Off | | 30% 30C P8 22W / 300W | 1MiB / 49140MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ | 3 NVIDIA RTX 6000 Ada Gene... On | 00000000:00:1C.0 Off | Off | | 30% 28C P8 24W / 300W | 1MiB / 49140MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+
run command: accelerate launch --num_processes=4 train_dreambooth_flux.py --pretrained_model_name_or_path="/mnt/s1/flux_dev/FLUX.1-dev" --instance_data_dir="/home/wrusr/flux_train_env/flux_dreambooth_train/dreambooth-datasets_/style_spiderverse" --caption_column="/home/wrusr/flux_train_env/flux_dreambooth_train/dreambooth-datasets_/atext" --instance_prompt="A photo of spdrvrs" --output_dir="/home/wrusr/flux_train_env/flux_dreambooth_train" --resolution=024 --train_batch_size=1 --mixed_precision="fp16" --max_train_steps=500 --revision="fp16" --gradient_accumulation_steps=4 --learning_rate=1e-4 --report_to="wandb" --lr_scheduler="constant" --lr_warmup_steps=0 --seed="0" --push_to_hub
error: 08/26/2024 11:46:54 - INFO - main - Distributed environment: MULTI_GPU Backend: nccl Num processes: 4 Process index: 0 Local process index: 0 Device: cuda:0
Mixed precision type: fp16
08/26/2024 11:46:54 - INFO - main - Distributed environment: MULTI_GPU Backend: nccl Num processes: 4 Process index: 3 Local process index: 3 Device: cuda:3
Mixed precision type: fp16
08/26/2024 11:46:54 - INFO - main - Distributed environment: MULTI_GPU Backend: nccl Num processes: 4 Process index: 2 Local process index: 2 Device: cuda:2
Mixed precision type: fp16
08/26/2024 11:46:54 - INFO - main - Distributed environment: MULTI_GPU Backend: nccl Num processes: 4 Process index: 1 Local process index: 1 Device: cuda:1
Mixed precision type: fp16
You set add_prefix_space. The tokenizer needs to be converted from the slow tokenizers
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
You are using a model of type t5 to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:25<00:00, 12.75s/it]
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:25<00:00, 12.91s/it]
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:25<00:00, 12.92s/it]
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:25<00:00, 12.92s/it]
{'axes_dims_rope'} was not found in config. Values will be initialized to default values.
[2024-08-26 11:48:25,610] torch.distributed.elastic.multiprocessing.api: [WARNING] Sending process 32699 closing signal SIGTERM
[2024-08-26 11:48:25,733] torch.distributed.elastic.multiprocessing.api: [WARNING] Sending process 32701 closing signal SIGTERM
[2024-08-26 11:48:25,733] torch.distributed.elastic.multiprocessing.api: [WARNING] Sending process 32702 closing signal SIGTERM
[2024-08-26 11:48:28,939] torch.distributed.elastic.multiprocessing.api: [ERROR] failed (exitcode: -9) local_rank: 1 (pid: 32700) of binary: /home/wrusr/flux_train_env/bin/python3.10
Traceback (most recent call last):
File "/home/wrusr/flux_train_env/bin/accelerate", line 8, in
sys.exit(main())
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
args.func(args)
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1097, in launch_command
multi_gpu_launcher(args)
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/accelerate/commands/launch.py", line 734, in multi_gpu_launcher
distrib_run.run(args)
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/torch/distributed/run.py", line 803, in run
elastic_launch(
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 135, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/home/wrusr/flux_train_env/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 268, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
train_dreambooth_flux.py FAILED
Failures: <NO_OTHER_FAILURES>
Root Cause (first observed failure): [0]: time : 2024-08-26_11:48:25 host : wr-dev-train-1 rank : 1 (local_rank: 1) exitcode : -9 (pid: 32700) error_file: <N/A> traceback : Signal 9 (SIGKILL) received by PID 32700 ======================================================
@sayakpaul or @linoytsaban there's github spam attacks with these ^ stealing user credentials and then forming botnets.
Same Problem, Did you solve it?
Same Problem, Did you solve it?
no
Maybe OOM, because 'exitcode : -9 (pid: 32700)'
Same Problem, Did you solve it?
no
Your memory is not big enough to load transformer, maybe before you load it, you can move 'T5'/'CLIP'/'vae' to GPU.
Same Problem, Did you solve it?
no
Your memory is not big enough to load transformer, maybe before you load it, you can move 'T5'/'CLIP'/'vae' to GPU.
Thank you for your reply. How much memory do I need? I tried to train with 3 x A100 80G, but OOM occurred.
Same Problem, Did you solve it?
no
Your memory is not big enough to load transformer, maybe before you load it, you can move 'T5'/'CLIP'/'vae' to GPU.
Thank you for your reply. How much memory do I need? I tried to train with 3 x A100 80G, but OOM occurred.
You can try to use Deepspeed-zero2 ,maybe can be helpful. I can't run my training on a single A100 80G.
Same Problem, Did you solve it?
no
Your memory is not big enough to load transformer, maybe before you load it, you can move 'T5'/'CLIP'/'vae' to GPU.
Thank you for your reply. How much memory do I need? I tried to train with 3 x A100 80G, but OOM occurred.
You can try to use Deepspeed-zero2 ,maybe can be helpful. I can't run my training on a single A100 80G.
I'll try it. Thank you.
Same Problem, Did you solve it?
no
Your memory is not big enough to load transformer, maybe before you load it, you can move 'T5'/'CLIP'/'vae' to GPU.
Thank you for your reply. How much memory do I need? I tried to train with 3 x A100 80G, but OOM occurred.
You can try to use Deepspeed-zero2 ,maybe can be helpful. I can't run my training on a single A100 80G.
I'll try it. Thank you.
Have you be able to solve this issue? I tried to train with 8 A100 80G but also got CUDA out-of-memory. Thanks!
well, make sure you are not using --multi_gpu for accelerate launch
Yeah I didn't include the multi_gpu in the accelerate launch, and still when I monitored the GPU usage, all 8 gpus actually reached 100% and then OOM error
This is the accelerate config
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------In which compute environment are you running?
This machine
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Which type of machine are you using?
multi-GPU
How many different machines will you use (use more than 1 for multi-node training)? [1]: 1
Should distributed operations be checked while running for errors? This can avoid timeout issues but will be slower. [yes/NO]: no
Do you wish to optimize your script with torch dynamo?[yes/NO]:no
Do you want to use DeepSpeed? [yes/NO]: no
Do you want to use FullyShardedDataParallel? [yes/NO]: no
Do you want to use Megatron-LM ? [yes/NO]: no
How many GPU(s) should be used for distributed training? [1]:8
What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:all
Would you like to enable numa efficiency? (Currently only supported on NVIDIA hardware). [yes/NO]: yes
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Do you wish to use FP16 or BF16 (mixed precision)?
bf16
accelerate configuration saved at /home/zhe/.cache/huggingface/accelerate/default_config.yaml
This is the command
CUDA_LAUNCH_BLOCKING=1 accelerate launch train_dreambooth_flux.py
--pretrained_model_name_or_path="black-forest-labs/FLUX.1-dev"
--instance_data_dir="dog"
--output_dir="trained-flux"
--mixed_precision="bf16"
--instance_prompt="a photo of sks dog"
--resolution=1024
--train_batch_size=1
--gradient_accumulation_steps=4
--learning_rate=1e-4
--lr_scheduler="constant"
--lr_warmup_steps=0
--max_train_steps=500
--seed="0"
--push_to_hub
This is the output
You set add_prefix_space. The tokenizer needs to be converted from the slow tokenizers
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
You are using a model of type t5 to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 1655.54it/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9950.90it/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8692.86it/s]
Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10143.42it/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9597.95it/s]
Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10551.71it/s]
Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:36<00:00, 18.26s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 2891.29it/s]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.83s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5647.63it/s]
Fetching 3 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 44620.26it/s]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5057.44it/s]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5017.11it/s]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 7714.84it/s]
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5045.27it/s]
{'axes_dims_rope'} was not found in config. Values will be initialized to default values.
Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 4514.86it/s]
[rank6]: Traceback (most recent call last):
[rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1774, in
Yeah I didn't include the multi_gpu in the accelerate launch, and still when I monitored the GPU usage, all 8 gpus actually reached 100% and then OOM error
This is the accelerate config
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------In which compute environment are you running? This machine ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Which type of machine are you using? multi-GPU How many different machines will you use (use more than 1 for multi-node training)? [1]: 1 Should distributed operations be checked while running for errors? This can avoid timeout issues but will be slower. [yes/NO]: no Do you wish to optimize your script with torch dynamo?[yes/NO]:no Do you want to use DeepSpeed? [yes/NO]: no Do you want to use FullyShardedDataParallel? [yes/NO]: no Do you want to use Megatron-LM ? [yes/NO]: no How many GPU(s) should be used for distributed training? [1]:8 What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:all Would you like to enable numa efficiency? (Currently only supported on NVIDIA hardware). [yes/NO]: yes ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Do you wish to use FP16 or BF16 (mixed precision)? bf16 accelerate configuration saved at /home/zhe/.cache/huggingface/accelerate/default_config.yaml
This is the command
CUDA_LAUNCH_BLOCKING=1 accelerate launch train_dreambooth_flux.py --pretrained_model_name_or_path="black-forest-labs/FLUX.1-dev" --instance_data_dir="dog" --output_dir="trained-flux" --mixed_precision="bf16" --instance_prompt="a photo of sks dog" --resolution=1024 --train_batch_size=1 --gradient_accumulation_steps=4 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=500 --seed="0" --push_to_hub
This is the output
You set
add_prefix_space. The tokenizer needs to be converted from the slow tokenizers You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors. You are using a model of type t5 to instantiate a model of type . This is not supported for all configurations of models and can yield errors. Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 1655.54it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9950.90it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8692.86it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10143.42it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9597.95it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10551.71it/s] Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:36<00:00, 18.26s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 2891.29it/s] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.83s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5647.63it/s] Fetching 3 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 44620.26it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5057.44it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5017.11it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 7714.84it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5045.27it/s] {'axes_dims_rope'} was not found in config. Values will be initialized to default values. Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 4514.86it/s][rank6]: Traceback (most recent call last): [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1774, in [rank6]: main(args) [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1403, in main [rank6]: transformer, optimizer, train_dataloader, lr_scheduler = accelerator.prepare( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1311, in prepare [rank6]: result = tuple( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1312, in [rank6]: self._prepare_one(obj, first_pass=True, device_placement=d) for obj, d in zip(args, device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1188, in _prepare_one [rank6]: return self.prepare_model(obj, device_placement=device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1452, in prepare_model [rank6]: model = torch.nn.parallel.DistributedDataParallel( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 836, in init [rank6]: self._ddp_init_helper( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1193, in _ddp_init_helper [rank6]: self.reducer = dist.Reducer( [rank6]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 146.00 MiB. GPU 6 has a total capacity of 79.14 GiB of which 84.75 MiB is free. Including non-PyTorch memory, this process has 79.05 GiB memory in use. Of the allocated memory 77.42 GiB is allocated by PyTorch, and 9.81 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) W0905 14:44:05.950000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6253 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6254 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6255 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6256 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6257 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6258 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6259 closing signal SIGTERM E0905 14:44:07.982000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:833] failed (exitcode: 1) local_rank: 0 (pid: 6252) of binary: /opt/conda/bin/python Traceback (most recent call last): File "/opt/conda/bin/accelerate", line 8, in sys.exit(main()) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main args.func(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1097, in launch_command multi_gpu_launcher(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 734, in multi_gpu_launcher distrib_run.run(args) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/run.py", line 892, in run elastic_launch( File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 133, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 264, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
you should set the config after accelerate launch, like 'accelerate launch --config_file config_path train_flux.py'.
Yeah I didn't include the multi_gpu in the accelerate launch, and still when I monitored the GPU usage, all 8 gpus actually reached 100% and then OOM error
This is the accelerate config
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------In which compute environment are you running? This machine ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Which type of machine are you using? multi-GPU How many different machines will you use (use more than 1 for multi-node training)? [1]: 1 Should distributed operations be checked while running for errors? This can avoid timeout issues but will be slower. [yes/NO]: no Do you wish to optimize your script with torch dynamo?[yes/NO]:no Do you want to use DeepSpeed? [yes/NO]: no Do you want to use FullyShardedDataParallel? [yes/NO]: no Do you want to use Megatron-LM ? [yes/NO]: no How many GPU(s) should be used for distributed training? [1]:8 What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:all Would you like to enable numa efficiency? (Currently only supported on NVIDIA hardware). [yes/NO]: yes ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Do you wish to use FP16 or BF16 (mixed precision)? bf16 accelerate configuration saved at /home/zhe/.cache/huggingface/accelerate/default_config.yaml
This is the command
CUDA_LAUNCH_BLOCKING=1 accelerate launch train_dreambooth_flux.py --pretrained_model_name_or_path="black-forest-labs/FLUX.1-dev" --instance_data_dir="dog" --output_dir="trained-flux" --mixed_precision="bf16" --instance_prompt="a photo of sks dog" --resolution=1024 --train_batch_size=1 --gradient_accumulation_steps=4 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=500 --seed="0" --push_to_hub
This is the output
You set
add_prefix_space. The tokenizer needs to be converted from the slow tokenizers You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors. You are using a model of type t5 to instantiate a model of type . This is not supported for all configurations of models and can yield errors. Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 1655.54it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9950.90it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8692.86it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10143.42it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9597.95it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10551.71it/s] Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:36<00:00, 18.26s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 2891.29it/s] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.83s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5647.63it/s] Fetching 3 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 44620.26it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5057.44it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5017.11it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 7714.84it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5045.27it/s] {'axes_dims_rope'} was not found in config. Values will be initialized to default values. Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 4514.86it/s] [rank6]: Traceback (most recent call last): [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1774, in [rank6]: main(args) [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1403, in main [rank6]: transformer, optimizer, train_dataloader, lr_scheduler = accelerator.prepare( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1311, in prepare [rank6]: result = tuple( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1312, in [rank6]: self._prepare_one(obj, first_pass=True, device_placement=d) for obj, d in zip(args, device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1188, in _prepare_one [rank6]: return self.prepare_model(obj, device_placement=device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1452, in prepare_model [rank6]: model = torch.nn.parallel.DistributedDataParallel( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 836, in init [rank6]: self._ddp_init_helper( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1193, in _ddp_init_helper [rank6]: self.reducer = dist.Reducer( [rank6]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 146.00 MiB. GPU 6 has a total capacity of 79.14 GiB of which 84.75 MiB is free. Including non-PyTorch memory, this process has 79.05 GiB memory in use. Of the allocated memory 77.42 GiB is allocated by PyTorch, and 9.81 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) W0905 14:44:05.950000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6253 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6254 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6255 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6256 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6257 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6258 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6259 closing signal SIGTERM E0905 14:44:07.982000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:833] failed (exitcode: 1) local_rank: 0 (pid: 6252) of binary: /opt/conda/bin/python Traceback (most recent call last): File "/opt/conda/bin/accelerate", line 8, in sys.exit(main()) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main args.func(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1097, in launch_command multi_gpu_launcher(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 734, in multi_gpu_launcher distrib_run.run(args) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/run.py", line 892, in run elastic_launch( File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 133, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 264, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:you should set the config after accelerate launch, like 'accelerate launch --config_file config_path train_flux.py'.
I don't think the issue is here, It still gave the same result
Yeah I didn't include the multi_gpu in the accelerate launch, and still when I monitored the GPU usage, all 8 gpus actually reached 100% and then OOM error
This is the accelerate config
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------In which compute environment are you running? This machine ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Which type of machine are you using? multi-GPU How many different machines will you use (use more than 1 for multi-node training)? [1]: 1 Should distributed operations be checked while running for errors? This can avoid timeout issues but will be slower. [yes/NO]: no Do you wish to optimize your script with torch dynamo?[yes/NO]:no Do you want to use DeepSpeed? [yes/NO]: no Do you want to use FullyShardedDataParallel? [yes/NO]: no Do you want to use Megatron-LM ? [yes/NO]: no How many GPU(s) should be used for distributed training? [1]:8 What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:all Would you like to enable numa efficiency? (Currently only supported on NVIDIA hardware). [yes/NO]: yes ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Do you wish to use FP16 or BF16 (mixed precision)? bf16 accelerate configuration saved at /home/zhe/.cache/huggingface/accelerate/default_config.yaml
This is the command
CUDA_LAUNCH_BLOCKING=1 accelerate launch train_dreambooth_flux.py --pretrained_model_name_or_path="black-forest-labs/FLUX.1-dev" --instance_data_dir="dog" --output_dir="trained-flux" --mixed_precision="bf16" --instance_prompt="a photo of sks dog" --resolution=1024 --train_batch_size=1 --gradient_accumulation_steps=4 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=500 --seed="0" --push_to_hub
This is the output
You set
add_prefix_space. The tokenizer needs to be converted from the slow tokenizers You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors. You are using a model of type t5 to instantiate a model of type . This is not supported for all configurations of models and can yield errors. Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 1655.54it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9950.90it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8692.86it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10143.42it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 8464.79it/s] Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 9597.95it/s] Downloading shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 10551.71it/s] Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:36<00:00, 18.26s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 2891.29it/s] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.84s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.83s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.85s/it] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5647.63it/s] Fetching 3 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 44620.26it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5057.44it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5017.11it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 7714.84it/s] Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 5045.27it/s] {'axes_dims_rope'} was not found in config. Values will be initialized to default values. Fetching 3 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 4514.86it/s] [rank6]: Traceback (most recent call last): [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1774, in [rank6]: main(args) [rank6]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1403, in main [rank6]: transformer, optimizer, train_dataloader, lr_scheduler = accelerator.prepare( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1311, in prepare [rank6]: result = tuple( [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1312, in [rank6]: self._prepare_one(obj, first_pass=True, device_placement=d) for obj, d in zip(args, device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1188, in _prepare_one [rank6]: return self.prepare_model(obj, device_placement=device_placement) [rank6]: File "/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py", line 1452, in prepare_model [rank6]: model = torch.nn.parallel.DistributedDataParallel( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 836, in init [rank6]: self._ddp_init_helper( [rank6]: File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1193, in _ddp_init_helper [rank6]: self.reducer = dist.Reducer( [rank6]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 146.00 MiB. GPU 6 has a total capacity of 79.14 GiB of which 84.75 MiB is free. Including non-PyTorch memory, this process has 79.05 GiB memory in use. Of the allocated memory 77.42 GiB is allocated by PyTorch, and 9.81 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) W0905 14:44:05.950000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6253 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6254 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6255 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6256 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6257 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6258 closing signal SIGTERM W0905 14:44:05.951000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:858] Sending process 6259 closing signal SIGTERM E0905 14:44:07.982000 140111482894144 torch/distributed/elastic/multiprocessing/api.py:833] failed (exitcode: 1) local_rank: 0 (pid: 6252) of binary: /opt/conda/bin/python Traceback (most recent call last): File "/opt/conda/bin/accelerate", line 8, in sys.exit(main()) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main args.func(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1097, in launch_command multi_gpu_launcher(args) File "/opt/conda/lib/python3.10/site-packages/accelerate/commands/launch.py", line 734, in multi_gpu_launcher distrib_run.run(args) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/run.py", line 892, in run elastic_launch( File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 133, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 264, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:you should set the config after accelerate launch, like 'accelerate launch --config_file config_path train_flux.py'.
I don't think the issue is here, It still gave the same result
you can email me at [email protected], I'll try my best to help you, or wechat dididi_0912
Using Deepspeed helped on the OOM error, but I now got a new error:
[rank1]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1788, in
Anyone knows why this happened?
Using Deepspeed helped on the OOM error, but I now got a new error: [rank1]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1788, in [rank1]: main(args) [rank1]: File "/home/zhe/diffusers/examples/dreambooth/train_dreambooth_flux.py", line 1582, in main [rank1]: if transformer.config.guidance_embeds: [rank1]: AttributeError: 'dict' object has no attribute 'guidance_embeds'
Anyone knows why this happened?
you can print the transformer.config, there is 'guidance_embeds' in flux_dev's config (but False in schell): { "_class_name": "FluxTransformer2DModel", "_diffusers_version": "0.30.0.dev0", "_name_or_path": "../checkpoints/flux-dev/transformer", "attention_head_dim": 128, "guidance_embeds": true, "in_channels": 64, "joint_attention_dim": 4096, "num_attention_heads": 24, "num_layers": 19, "num_single_layers": 38, "patch_size": 1, "pooled_projection_dim": 768 }
I also get the OOM errors on H800 GPU( 80G ), I think there are bugs in this training script
I also get the OOM errors on H800 GPU( 80G ), I think there are bugs in this training script
you can give more information about your setting
In my case (H100, 80GB), what only worked was using deepspeed when accelerate config ..
W/O deepspeed, I got OOM.
@icsl-Jeon Hey. Where you able to successfully finish the training? Could you please share your accelerate config file?
It's usually found here ~/.cache/huggingface/accelerate/default_config.yaml