Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple GPU training failed #40

Closed
makecent opened this issue Jun 13, 2021 · 4 comments
Closed

Multiple GPU training failed #40

makecent opened this issue Jun 13, 2021 · 4 comments

Comments

@makecent
Copy link

makecent commented Jun 13, 2021

I tried to use 2 GPU for training, but it raised a error:

PYTHONPATH=$PWD:$PYTHONPATH mim train mmaction configs/localization/apn_coralrandom_r3dsony_32x4_10e_thumos14_flow.py --gpus 2 --validate

2021-06-13 16:38:48,309 - mmaction - INFO - workflow: [('train', 1)], max: 10 epochs
Traceback (most recent call last):
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmaction/tools/train.py", line 199, in <module>
    main()
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmaction/tools/train.py", line 195, in main
    meta=meta)
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmaction/apis/train.py", line 163, in train_model
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs, **runner_kwargs)
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 125, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train
    self.run_iter(data_batch, train_mode=True, **kwargs)
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 30, in run_iter
    **kwargs)
  File "/home/louis/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/parallel/data_parallel.py", line 55, in train_step
    ('MMDataParallel only supports single GPU training, if you need to'
AssertionError: MMDataParallel only supports single GPU training, if you need to train with multiple GPUs, please use MMDistributedDataParallelinstead.

However, I did's manually set the distributed method in my own code. It seems that mim uses the train.py instead of dist_train.sh . How to fix this?

@ZwwWayne
Copy link
Collaborator

You did not set the launcher. You should add option --launcher pytorch

@makecent
Copy link
Author

You did not set the launcher. You should add option --launcher pytorch

I also found this solution in the doc. But I think this argument is not that clear for demonstrating distributed training.

@ZwwWayne
Copy link
Collaborator

dist_train.sh actually set --launcher pytorch by default. Thanks for your advice, we will try to make it simpler in the future.

@makecent
Copy link
Author

dist_train.sh actually set --launcher pytorch by default. Thanks for your advice, we will try to make it simpler in the future.

Thanks for your reply. mim is excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants