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

Multi-gpu training problem #6

Closed
humian321 opened this issue Jan 31, 2024 · 4 comments
Closed

Multi-gpu training problem #6

humian321 opened this issue Jan 31, 2024 · 4 comments

Comments

@humian321
Copy link

This is a good paper and very interested idea! There is a training cmd using a single gpu in readme. For multi-gpus training, could you provide the corresponding cmd ?

@humian321
Copy link
Author

I tried to use the official MMengine distributed training command, but it reported an error.

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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
 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

@humian321
Copy link
Author

I found the solution by adding find_unused_parameters = True

@w1oves
Copy link
Owner

w1oves commented Feb 1, 2024

Yes, you are right! I will update this soon.

@w1oves w1oves reopened this Feb 4, 2024
@w1oves w1oves closed this as completed Feb 6, 2024
@liblacklucy
Copy link

Using TORCH_DISTRIBUTED_DEBUG=DETAIL, you can find these unmatched grad and debug it. If using find_unused_parameters = True, whether increasing training time?

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

3 participants