-
Notifications
You must be signed in to change notification settings - Fork 120
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
Use GPU and multi-card for model training #3
Comments
This repo uses pytorch-lightning as the trainer. It's convenient to do single-gpu or multi-gpu training by simply setting the gpu number:
If I remember correctly, by default this will use Pytorch DDP Spawn strategy for multi-gpu training. If you want to use Pytorch DDP instead (which should be faster than DDP Spawn in general), you can add one line to train.py:
Let me know if it works. |
@yumianhuli2 To reproduce the results in the paper when using multi-gpu training, please also make sure that the effective batch size (batch_size * gpu_num) is 32. For example, if you use 4 gpus, then the batch size per gpu should be 8:
|
Thank you! |
Thank you for your outstanding work!If the batchsize is changed, does the learning rate need to be adjusted accordingly? |
@tandangzuoren I believe the learning rate should be adjusted. The number of epochs may also need to be changed. |
@ZikangZhou Thank you for your advice on this. May I know why 32 is the effective batch size? |
Hello! How to use GPU and multi-card for training? The default card 0 is the CPU for training.
Thank U!
The text was updated successfully, but these errors were encountered: