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

cudnn.benchmark = True on Seed 0 #9259

Merged
merged 3 commits into from
Sep 2, 2022
Merged

cudnn.benchmark = True on Seed 0 #9259

merged 3 commits into from
Sep 2, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Sep 2, 2022

Signed-off-by: Glenn Jocher glenn.jocher@ultralytics.com

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved the random number generator initialization for potentially faster training.

πŸ“Š Key Changes

  • Removed unnecessary imports and settings for cuDNN when initializing seeds.
  • Set torch.backends.cudnn.benchmark to True by default for all training sessions.
  • Confined deterministic settings within a conditional block that's only executed if determinism is requested.

🎯 Purpose & Impact

  • The removal of some cuDNN settings streamlines the seed initialization process, making the code more readable and potentially reducing overhead.
  • Enabling cudnn.benchmark by default aims to speed up training by allowing cuDNN to automatically find the most efficient algorithms for the hardware.
  • The careful placement of deterministic settings preserves reproducible results when needed, without affecting performance otherwise.
  • Users should see improved training speeds with no change in usage, while still having the option for deterministic behavior when reproducibility is crucial.

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher glenn-jocher self-assigned this Sep 2, 2022
@glenn-jocher glenn-jocher mentioned this pull request Sep 2, 2022
1 task
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher glenn-jocher linked an issue Sep 2, 2022 that may be closed by this pull request
1 task
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member Author

glenn-jocher commented Sep 2, 2022

@AyushExel enabled cudnn.benchmark=True by default (affects all tasks). Still deterministic, but cuts COCO training time a bit.

# Master
      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
        2/2      14.7G    0.03588    0.05798    0.01502        157        640: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7393/7393 [17:42<00:00,  6.96it/s]                                   
                 Class     Images  Instances          P          R     mAP@.5 mAP@.5:.95: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 157/157 [00:32<00:00,  4.82it/s]                          
                   all       5000      36335      0.713        0.6      0.649      0.466

3 epochs completed in 0.964 hours.


# PR
      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
        2/2      9.23G    0.03588    0.05798    0.01502        157        640: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7393/7393 [16:50<00:00,  7.31it/s]                                   
                 Class     Images  Instances          P          R     mAP@.5 mAP@.5:.95: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 157/157 [00:31<00:00,  5.06it/s]                          
                   all       5000      36335      0.713        0.6      0.649      0.466

3 epochs completed in 0.931 hours.

@glenn-jocher glenn-jocher merged commit 5d4787b into master Sep 2, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-2 branch September 2, 2022 14:05
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* `cudnn.benchmark = True` on Seed 0

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update general.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update general.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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

Successfully merging this pull request may close these issues.

About AutoBatch
1 participant