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

About AutoBatch #9156

Closed
1 task done
z1069614715 opened this issue Aug 25, 2022 · 6 comments · Fixed by #9209 or #9259
Closed
1 task done

About AutoBatch #9156

z1069614715 opened this issue Aug 25, 2022 · 6 comments · Fixed by #9209 or #9259
Labels
question Further information is requested

Comments

@z1069614715
Copy link

Search before asking

Question

Hi! I want to use your autobatch function in my code, but have something problem, Could you please take a look at it for me?
image
as shown above, You can see my gpu memory is not increasing, but this autobatch function in working order in yolov5 code.
Why?
Wait patiently for your answer!

Additional

No response

@z1069614715 z1069614715 added the question Further information is requested label Aug 25, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2022

👋 Hello @z1069614715, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.

@robotaiguy
Copy link

Why does it say "Using batch-size 253731...", but it looks like it suggested batch-size of 16.

@glenn-jocher
Copy link
Member

@z1069614715 can you confirm you are seeing this issue in master?

AutoBatch is experimental and may not work in all circumstances, so if you are getting unreliable results you should set your batch-size manually.

@glenn-jocher glenn-jocher linked a pull request Aug 29, 2022 that will close this issue
glenn-jocher added a commit that referenced this issue Aug 29, 2022
If < 1 or > 1024 set output to default batch size 16.

May partially address #9156

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
glenn-jocher added a commit that referenced this issue Aug 29, 2022
If < 1 or > 1024 set output to default batch size 16.

May partially address #9156

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

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

@z1069614715 I've pushed PR #9209 to protect from super high batch size predictions, but the reality is that CUDA memory utilisation is sometimes hard to reproduce and measure correctly, especially if previous trainings are running, have run or been terminated early.

@z1069614715
Copy link
Author

@z1069614715 I've pushed PR #9209 to protect from super high batch size predictions, but the reality is that CUDA memory utilisation is sometimes hard to reproduce and measure correctly, especially if previous trainings are running, have run or been terminated early.

Thanks for your help, I have solved the problem, The reason is that (torch.backends.cudnn.benchmark) I set it to True, if True AutoBatch will lose efficacy.

@glenn-jocher
Copy link
Member

@z1069614715 got it. Should we set benchmark(False) before running AutoBatch? Benchmark(True) during training should only occur on non-zero seeds it seems, though that doesn't make much sense. I've created PR #9259 to update this.

@glenn-jocher glenn-jocher linked a pull request Sep 2, 2022 that will close this issue
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this issue Sep 8, 2022
If < 1 or > 1024 set output to default batch size 16.

May partially address ultralytics#9156

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
question Further information is requested
Projects
None yet
3 participants