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

feat: ✨ PyTorch Recognition Model Multi-GPU support #1164

Merged
merged 10 commits into from
Mar 31, 2023

Conversation

odulcy-mindee
Copy link
Collaborator

@odulcy-mindee odulcy-mindee commented Mar 9, 2023

Fix #1146

Highly inspired from:

How to use this script

wget https://github.com/mindee/doctr/releases/download/v0.3.1/toy_recogition_set-036a4d80.zip
sudo apt-get update && sudo apt-get install unzip -y
unzip toy_recogition_set-036a4d80.zip -d reco_set

python references/recognition/train_pytorch_ddp.py crnn_mobilenet_v3_small --train_path ./reco_set --val_path ./reco_set -b 2 --epochs 10 --devices 0 1

How to retrieve device id

import torch
devices = [torch.cuda.device(i) for i in range(torch.cuda.device_count())]
device_names = [torch.cuda.get_device_name(d) for d in devices]

Update 28/03/23

We created a Dataset to verify if train_pytorch_ddp.py is correct. Training has been launched today on two GPUs, we'll see if the modifications are correct. Hopefully, this PR will be merged tomorrow if there is no issue.

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #1164 (86a1dd0) into main (9e254fe) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1164   +/-   ##
=======================================
  Coverage   95.01%   95.01%           
=======================================
  Files         150      150           
  Lines        6418     6418           
=======================================
  Hits         6098     6098           
  Misses        320      320           
Flag Coverage Δ
unittests 95.01% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
doctr/models/factory/hub.py 74.69% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@odulcy-mindee odulcy-mindee marked this pull request as ready for review March 31, 2023 09:37
Copy link
Contributor

@aminemindee aminemindee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@odulcy-mindee odulcy-mindee merged commit 3b6649c into mindee:main Mar 31, 2023
@odulcy-mindee odulcy-mindee deleted the pytorch_multi_gpu branch March 31, 2023 10:35
@odulcy-mindee odulcy-mindee added type: enhancement Improvement ext: references Related to references folder framework: pytorch Related to PyTorch backend type: new feature New feature labels Mar 31, 2023
@felixdittrich92
Copy link
Contributor

Hi @odulcy-mindee thanks for the PR 👍
Could you update the readme in references with an example how to use this script ? And maybe add this also for the detection task ? :)

@odulcy-mindee
Copy link
Collaborator Author

@felixdittrich92 Hello! Yep, I'll update the README first and if possible detection task !

@felixdittrich92 felixdittrich92 added this to the 0.7.0 milestone Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: references Related to references folder framework: pytorch Related to PyTorch backend type: enhancement Improvement type: new feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Training on mutliple GPUs
3 participants