-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Error "Directory already existed" happen when training with multiple GPUs #2275
Comments
👋 Hello @Jelly123456, 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://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf 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), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@Jelly123456 hi thanks for the bug report and for the proposed solution. I'm pretty confused by the error, as the tensorboard summarywriter can certainly be initialized with an existing directory. For example when resuming an interrupted training run with Maybe the error is produced because the directory does not exist? To allow us to debug could you provide a minimum reproducible example? Thanks! BTW a pro tip: the --weights, --cfg, and --data files are searched locally, so if they are unique you can simply pass the filename and we will find it automatically, i.e. as in the colab notebook example here: |
@Jelly123456 also that's strange that your error says file exists. runs/train/exp should be a directory, not a file. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@Jelly123456 Just mkdir yourself before you run the codes and manually denote the --name as the directory you just built. Note that the codes will automatically change --name by appending numbers to it. So be sure to comment that line. |
@slimwangyue @Jelly123456 you can log to the same directory every time using the --exist-ok flag. This prevents the log directory from incrementing:
|
🐛 Bug
When I train my own datasets with multiple GPUs, the ["runs/train/exp*" already exists] error always shows.
To Reproduce (REQUIRED)
Input:
Output:
Expected behavior
It should not show the "directory already exists" error because there is no such directory (runs/train/exp5) in the "runs" folder.
Environment
If applicable, add screenshots to help explain your problem.
Proposed solution
I solved locally by adding the following one-line code before "tb_writer = SummaryWriter(opt.save_dir)" which is in "train.py"
os.makedirs(opt.save_dir, exist_ok=True); This line code is to create the directory explicitly.
I was inspired by this link:
allenai/allennlp#3843
After adding this code, the error disappears, and I can train successfully with multiple GPUs.
The text was updated successfully, but these errors were encountered: