facebookresearch / mmf

A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)

Home Page:https://mmf.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encounter distributed error when trainning ViLT

accebet opened this issue Β· comments

πŸ› Bug

WARNING 2023-12-16T22:44:58 | py.warnings: /home/tjh/mmf/mmf/utils/distributed.py:414: UserWarning: 'losses' already present in model output. No calculation will be done in base model.
builtin_warn(*args, **kwargs)

WARNING 2023-12-16T22:44:58 | py.warnings: /home/tjh/mmf/mmf/utils/distributed.py:414: UserWarning: 'losses' already present in model output. No calculation will be done in base model.
builtin_warn(*args, **kwargs)

Traceback (most recent call last):
File "/home/tjh/anaconda3/envs/mmf/bin/mmf_run", line 8, in
sys.exit(run())
File "/home/tjh/mmf/mmf_cli/run.py", line 129, in run
nprocs=config.distributed.world_size,
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 240, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 198, in start_processes
while not context.join():
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 160, in join
raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap
fn(i, *args)
File "/home/tjh/mmf/mmf_cli/run.py", line 66, in distributed_main
main(configuration, init_distributed=True, predict=predict)
File "/home/tjh/mmf/mmf_cli/run.py", line 56, in main
trainer.train()
File "/home/tjh/mmf/mmf/trainers/mmf_trainer.py", line 145, in train
self.training_loop()
File "/home/tjh/mmf/mmf/trainers/core/training_loop.py", line 33, in training_loop
self.run_training_epoch()
File "/home/tjh/mmf/mmf/trainers/core/training_loop.py", line 91, in run_training_epoch
report = self.run_training_batch(batch, num_batches_for_this_update)
File "/home/tjh/mmf/mmf/trainers/core/training_loop.py", line 166, in run_training_batch
report = self._forward(batch)
File "/home/tjh/mmf/mmf/trainers/core/training_loop.py", line 200, in _forward
model_output = self.model(prepared_batch)
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/tjh/anaconda3/envs/mmf/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 947, in forward
if torch.is_grad_enabled() and self.reducer._rebuild_buckets():

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 0: 11 12 13 14
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

To Reproduce

Steps to reproduce the behavior:

  1. mmf_run config=projects/vilt/configs/vqa2/defaults.yaml run_type=train_val dataset=vqa2 model=vilt

Environment

-PyTorch version: 1.11.0+cu102
-Is debug build: False
-CUDA used to build PyTorch: 10.2
-ROCM used to build PyTorch: N/A

-OS: CentOS Linux release 7.9.2009 (Core) (x86_64)
-GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
-Clang version: Could not collect
-CMake version: version 2.8.12.2
-Libc version: glibc-2.10

-Python version: 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21) [GCC 9.4.0] (64-bit runtime)
-Python platform: Linux-3.10.0-957.el7.x86_64-x86_64-with-centos-7.9.2009-Core
-Is CUDA available: True
-CUDA runtime version: 11.0.221
-GPU models and configuration:
-GPU 0: Tesla V100-PCIE-32GB
-GPU 1: Tesla V100-PCIE-32GB

-Nvidia driver version: 450.36.06
-cuDNN version: Could not collect
-HIP runtime version: N/A
-MIOpen runtime version: N/A

-Versions of relevant libraries:
-[pip3] numpy==1.21.4
-[pip3] pytorch-lightning==1.6.0
-[pip3] torch==1.11.0
-[pip3] torchaudio==0.11.0
-[pip3] torchmetrics==0.11.4
-[pip3] torchtext==0.12.0
-[pip3] torchvision==0.12.0
-[conda] numpy 1.21.4 pypi_0 pypi
-[conda] pytorch-lightning 1.6.0 pypi_0 pypi
-[conda] torch 1.11.0 pypi_0 pypi
-[conda] torchaudio 0.11.0 pypi_0 pypi
-[conda] torchmetrics 0.11.4 pypi_0 pypi
-[conda] torchtext 0.12.0 pypi_0 pypi
-[conda] torchvision 0.12.0 pypi_0 pypi

Additional context