waifu-diffusion/trainer
Carlos Chavez f2cfe65d09
Move the movel to device BEFORE creating the optimizer
>It shouldn’t matter, as the optimizer should hold the references to the parameter (even after moving them). However, the “safer” approach would be to move the model to the device first and create the optimizer afterwards.

https://discuss.pytorch.org/t/should-i-create-optimizer-after-sending-the-model-to-gpu/133418/2
https://discuss.pytorch.org/t/effect-of-calling-model-cuda-after-constructing-an-optimizer/15165

At least in my experience with hivemind, if you initialize the optimizer and move the model afterwards, it will throw errors about finding some data in CPU and other on GPU. This shouldn't affect performance or anything I believe.
2022-11-20 00:09:35 -05:00
..
diffusers_trainer.py Move the movel to device BEFORE creating the optimizer 2022-11-20 00:09:35 -05:00
train.sh relicense 2022-11-10 12:59:53 -07:00