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

ClearML integration removes the best checkpoint after uploading to the server #9251

Closed
1 of 2 tasks
kecsap opened this issue Sep 1, 2022 · 10 comments · Fixed by #9265
Closed
1 of 2 tasks

ClearML integration removes the best checkpoint after uploading to the server #9251

kecsap opened this issue Sep 1, 2022 · 10 comments · Fixed by #9265
Labels
bug Something isn't working

Comments

@kecsap
Copy link

kecsap commented Sep 1, 2022

Search before asking

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

YOLOv5 Component

Integrations

Bug

YOLOv5 Git is up-to-date.
After configuring a local ClearML server, everything works fine, but the integration removes the uploaded best checkpoint file (best.pt) from runs/train/expXX/weights/ after the training is finished and it is uploaded to the server.

Environment

Ubuntu 20.04

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!
@kecsap kecsap added the bug Something isn't working label Sep 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

👋 Hello @kecsap, 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.

@glenn-jocher
Copy link
Member

@thepycoder is the logging code deleting local checkpoints on upload?

@Denizzje
Copy link

Denizzje commented Sep 2, 2022

Oh... so this might explain why I have not seen any best.pt at all having trained with various model sizes from YoloV5 v6.2. I geniunely thought something was changed from 6.1 to 6.2 (we use the fixed releases for training due to some modifications in training code). However I also enabled clearML when v6.2 got released. but to their hosted service for now instead of local server. None of my trained models had a best.pt in the weights folder after training. Looking at the ClearML artificats of each run, I do see them being there now.

@glenn-jocher
Copy link
Member

@Denizzje no, the only reason best.pt would be missing is if you trained with --nosave or --noval.

@kecsap
Copy link
Author

kecsap commented Sep 2, 2022

Just running the bleeding-edge master now.

ClearML installed:

$ python3 train.py --img 640 --batch 124 --epochs 3 --data XXX.yaml --weights yolov5s.pt --freeze 10
train: weights=yolov5s.pt, cfg=, data=XXX.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=3, batch_size=124, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[10], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
...
3 epochs completed in 0.002 hours.
Optimizer stripped from runs/train/exp92/weights/last.pt, 14.8MB
Optimizer stripped from runs/train/exp92/weights/best.pt, 14.8MB
...
Validating runs/train/exp92/weights/best.pt...
...
Results saved to runs/train/exp92
2022-09-02 11:49:55,696 - clearml.Task - INFO - Waiting to finish uploads
2022-09-02 11:49:55,801 - clearml.Task - INFO - Completed model upload to http://X.X.X.X:8081/YOLOv5/training.XXX/models/best.pt
2022-09-02 11:50:01,036 - clearml.Task - INFO - Finished uploading

$ ls runs/train/exp92/weights/best.pt
ls: cannot access 'runs/train/exp92/weights/best.pt': No such file or directory

Repeating the same after pip3 uninstall clearml:

$ python3 train.py --img 640 --batch 124 --epochs 3 --data XXX.yaml --weights yolov5s.pt --freeze 10
train: weights=yolov5s.pt, cfg=, data=XXX.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=3, batch_size=124, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[10], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
...
3 epochs completed in 0.002 hours.
Optimizer stripped from runs/train/exp93/weights/last.pt, 14.8MB
Optimizer stripped from runs/train/exp93/weights/best.pt, 14.8MB
...
Validating runs/train/exp93/weights/best.pt...
...
Results saved to runs/train/exp93

$ ls runs/train/exp93/weights/best.pt
runs/train/exp93/weights/best.pt

@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 2, 2022

@kecsap thanks for the example!

@thepycoder per the example in #9251 (comment) it appears the ClearML integration is moving or deleting best.pt after training completes.

Can you try to reproduce and investigate a fix? Thanks!

@thepycoder
Copy link
Contributor

thepycoder commented Sep 2, 2022

Hey @kecsap,

Thank you so much for the reproducible example. That is very weird indeed. I'm looking into it!

For others that might have the issue: you can still retrieve your best model by going to the experiment webui and downloading it there or by using the sdk

task = Task.get_task(task_id='previously_executed_task')
 my_local_copy_of_the_previously_uploaded_artifact = task.artifacts["best"].get_local_copy()

Not at a computer right now, but will fix asap!

@thepycoder
Copy link
Contributor

Hey @glenn-jocher, @kecsap

I opened a PR with a fix. Sorry for the inconvenience!

@yuyang3478
Copy link

yuyang3478 commented Sep 3, 2022 via email

@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 3, 2022

@kecsap good news 😃! Your original issue may now be fixed ✅ in PR #9265. To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants