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

Problem on running Hyperparameter Evolution on Big Dataset #9916

Closed
1 of 2 tasks
silvada95 opened this issue Oct 25, 2022 · 3 comments
Closed
1 of 2 tasks

Problem on running Hyperparameter Evolution on Big Dataset #9916

silvada95 opened this issue Oct 25, 2022 · 3 comments
Labels
bug Something isn't working Stale

Comments

@silvada95
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Evolution

Bug

Good morning,

I am trying to run Hyperparameter Evolution on a relatively big dataset (>1million images and >200GB), but I am facing issues with it.

The code I am using to run it is quite simple:

python train.py --data my_dataset.yaml --weights 'yolov5s6.pt' --cfg yolov5s.yaml --batch 32 --img 1280 --epochs 1 --evolve 25

python train.py --data my_dataset.yaml --weights 'yolov5s6.pt' --cfg yolov5s.yaml --batch 32 --img 1280 --epochs 2 --evolve 12

Some of the errors that happen:

1- Run all the epochs for a given generation, then crash during the validation.

The errors that appear are

AttributeError: 'NoneType' object has no attribute '_free_weak_ref'
Exception ignored in: <function StorageWeakRef.del at 0x2b6fee3035e0>

AttributeError: 'NoneType' object has no attribute '_free_weak_ref'
slurmstepd: error: Detected 3 oom-kill event(s) in StepId=22501303.batch cgroup. Some of your processes may have been killed by the cgroup out-of-memory handler.

However, when I was checking, the batches were occupying 22GB of 32GB of the memory.

2- Sometimes it run the generation properly but them just stop to work at the model summary screen

Environment

  • Python 3.9 ( tried also 3.8)
  • GPU V100 32GB;
  • System Memory: Allocated 48GB for the CPUs
  • CUDA 11.1;
  • Torch 1.8;
  • Torchvision 0.9;

Also tried => Cuda 10.2, Torch 1.11, Torchvision 0.12

Both setups worked well on all the other applications, even in evolutions in smaller datasets...

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@silvada95 silvada95 added the bug Something isn't working label Oct 25, 2022
@frabob2017
Copy link

May I ask Hyperparameter Evolution --evolve is trying to find the optimal hyperparameters? I think it should be to perform such task.

@glenn-jocher
Copy link
Member

glenn-jocher commented Oct 25, 2022

👋 Hello! Thanks for asking about CUDA memory issues. YOLOv5 🚀 can be trained on CPU, single-GPU, or multi-GPU. When training on GPU it is important to keep your batch-size small enough that you do not use all of your GPU memory, otherwise you will see a CUDA Out Of Memory (OOM) Error and your training will crash. You can observe your CUDA memory utilization using either the nvidia-smi command or by viewing your console output:

Screenshot 2021-05-28 at 12 19 51

CUDA Out of Memory Solutions

If you encounter a CUDA OOM error, the steps you can take to reduce your memory usage are:

  • Reduce --batch-size
  • Reduce --img-size
  • Reduce model size, i.e. from YOLOv5x -> YOLOv5l -> YOLOv5m -> YOLOv5s > YOLOv5n
  • Train with multi-GPU at the same --batch-size
  • Upgrade your hardware to a larger GPU
  • Train on free GPU backends with up to 16GB of CUDA memory: Open In Colab Open In Kaggle

AutoBatch

You can use YOLOv5 AutoBatch (NEW) to find the best batch size for your training by passing --batch-size -1. AutoBatch will solve for a 90% CUDA memory-utilization batch-size given your training settings. AutoBatch is experimental, and only works for Single-GPU training. It may not work on all systems, and is not recommended for production use.

Screenshot 2021-11-06 at 12 31 10

Good luck 🍀 and let us know if you have any other questions!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2022

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@github-actions github-actions bot added the Stale label Nov 25, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

3 participants