lllyasviel / ControlNet

Let us control diffusion models!
Apache License 2.0
29.2k stars 2.64k forks source link

train with multi-gpus #351

Open pokameng opened 1 year ago

pokameng commented 1 year ago

@lllyasviel @williamyang1991 @eltociear @camenduru hello bro, Is it possible to train the tutorial_train_sd21.py with multi-GPUs? I have modified the trainer = pl.Trainer(gpus=1, precision=32, callbacks=[logger]) to trainer = pl.Trainer(gpus=4, accelerator='dp,precision=32, callbacks=[logger]) but it doesn't work

Can someone help me?

sethupavan12 commented 1 year ago

What was the error?

XavierCHEN34 commented 1 year ago

I get the same problem

soon-yau commented 1 year ago

You'll need to add the distributed strategy to avoid multiple gpus accessing the same files. I used the following arguments and it works for me: trainer = pl.Trainer(strategy="ddp", accelerator="gpu", devices=2, precision=32, callbacks=[logger])

ningbende commented 1 year ago

solve my problem, thx!

You'll need to add the distributed strategy to avoid multiple gpus accessing the same files. I used the following arguments and it works for me: trainer = pl.Trainer(strategy="ddp", accelerator="gpu", devices=2, precision=32, callbacks=[logger])