showlab / Tune-A-Video

[ICCV 2023] Tune-A-Video: One-Shot Tuning of Image Diffusion Models for Text-to-Video Generation
https://tuneavideo.github.io
Apache License 2.0
4.15k stars 377 forks source link

How to train with video size 256*256 #50

Closed LiRunyi2001 closed 1 year ago

LiRunyi2001 commented 1 year ago

Hi there! Due to limited GPU memory size, during training process it will trigger OOM, thus I turned to train with video size 256*256, batch_size=1. However, it leads to error like this:

RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument find_unused_parameters=True to torch.nn.parallel.DistributedDataParallel, and by making sure all forward function outputs participate in calculating loss. If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's forward function. Please include the loss function and the structure of the return value of forward of your module when reporting this issue (e.g. list, dict, iterable). Parameter indices which did not receive grad for rank 1: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error

I don't quite sure what to do with this. Any advise to this issue? Thanks!

LiRunyi2001 commented 1 year ago

Update: I install xformers and re-trained the model with video size 512*512, but this weird error still happens.

zhangjiewu commented 1 year ago

please avoid using distributed training on multiple gpus. you may specify one gpu by export CUDA_VISIBLE_DEVICES=GPU_ID.

LiRunyi2001 commented 1 year ago

please avoid using distributed training on multiple gpus. you may specify one gpu by export CUDA_VISIBLE_DEVICES=GPU_ID.

Thanks! I've tried this and it worked well.