Search before asking
Ultralytics YOLO Component
Train
Bug
I am facing an issue where upon resuming an interrupted training (manual interruption after 51 completed epochs) the losses are all nan from the very beginning.
I had created epochs on every 5 checkpoints, so i'm loading last.pt (also tried epoch50.pt) but to no avail. The weird thing is that If I begin a new training from the last checkpoint without the "resume" parameter, it works just fine.
However, setting the device="cpu" resumes the training successfully with resume=True. This obviously is not a solution, as my dataset is too large to even consider using CPU.
It is worth noting i have many existing solutions, reducing batch size down to 2, changing amp to false, directly modifying the args.yml file, etc. Tried setting lr0 to 0.001. Also worth mentioning I have been checking many solutions online, but most people seem to have an issue with regular training, but my training only has this issue upon using "resume".
Please suggest some solutions.
Environment
Ultralytics 8.3.19 🚀 Python-3.10.15 torch-2.5.0+cu121 CUDA:0 (NVIDIA GeForce RTX 4090, 24564MiB)
Using Yolov8x.
All AMP checks are passed, and everything else is normal. I can run other new trainings without any issues.
Minimal Reproducible Example
Below is a simple example of what my code looks like. It is worth noting i have tried a dozen variations of this, reducing batch size down to 2, changing amp to false, directly modifying the args.yml file, etc. Also tried different checkpoints.
=========================
def train_yolov8(model_path, **kwargs):
model = YOLO(model_path)
model.train(**kwargs)
if __name__ == '__main__':
epochs = 300
train_yolov8(
model_path=r"my/model/full/path",
resume=True
)
Additional
I am using the LVIS dataset.
Furthermore, I have faced this issue once a week or two ago as well. So it is not a one-time issue.
Are you willing to submit a PR?
Search before asking
Ultralytics YOLO Component
Train
Bug
I am facing an issue where upon resuming an interrupted training (manual interruption after 51 completed epochs) the losses are all nan from the very beginning.
I had created epochs on every 5 checkpoints, so i'm loading last.pt (also tried epoch50.pt) but to no avail. The weird thing is that If I begin a new training from the last checkpoint without the "resume" parameter, it works just fine.
However, setting the device="cpu" resumes the training successfully with resume=True. This obviously is not a solution, as my dataset is too large to even consider using CPU.
It is worth noting i have many existing solutions, reducing batch size down to 2, changing amp to false, directly modifying the args.yml file, etc. Tried setting lr0 to 0.001. Also worth mentioning I have been checking many solutions online, but most people seem to have an issue with regular training, but my training only has this issue upon using "resume".
Please suggest some solutions.
Environment
Ultralytics 8.3.19 🚀 Python-3.10.15 torch-2.5.0+cu121 CUDA:0 (NVIDIA GeForce RTX 4090, 24564MiB)
Using Yolov8x.
All AMP checks are passed, and everything else is normal. I can run other new trainings without any issues.
Minimal Reproducible Example
Below is a simple example of what my code looks like. It is worth noting i have tried a dozen variations of this, reducing batch size down to 2, changing amp to false, directly modifying the args.yml file, etc. Also tried different checkpoints.
=========================
Additional
I am using the LVIS dataset.
Furthermore, I have faced this issue once a week or two ago as well. So it is not a one-time issue.
Are you willing to submit a PR?