ultralytics 8.2.81 fix HUB missing 'best.pt' resumed checkpoint upload (#15754)
This commit is contained in:
parent
a89b316f27
commit
2b7fac4db4
2 changed files with 30 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.2.80"
|
__version__ = "8.2.81"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
@ -344,23 +345,34 @@ class HUBTrainingSession:
|
||||||
map (float): Mean average precision of the model.
|
map (float): Mean average precision of the model.
|
||||||
final (bool): Indicates if the model is the final model after training.
|
final (bool): Indicates if the model is the final model after training.
|
||||||
"""
|
"""
|
||||||
if Path(weights).is_file():
|
weights = Path(weights)
|
||||||
progress_total = Path(weights).stat().st_size if final else None # Only show progress if final
|
if not weights.is_file():
|
||||||
self.request_queue(
|
last = weights.with_name("last" + weights.suffix)
|
||||||
self.model.upload_model,
|
if final and last.is_file():
|
||||||
epoch=epoch,
|
LOGGER.warning(
|
||||||
weights=weights,
|
f"{PREFIX} ARNING ⚠️ Model 'best.pt' not found, copying 'last.pt' to 'best.pt' and uploading. "
|
||||||
is_best=is_best,
|
"This often happens when resuming training in transient environments like Google Colab. "
|
||||||
map=map,
|
"For more reliable training, consider using Ultralytics HUB Cloud. "
|
||||||
final=final,
|
"Learn more at https://docs.ultralytics.com/hub/cloud-training/."
|
||||||
retry=10,
|
)
|
||||||
timeout=3600,
|
shutil.copy(last, weights) # copy last.pt to best.pt
|
||||||
thread=not final,
|
else:
|
||||||
progress_total=progress_total,
|
LOGGER.warning(f"{PREFIX} WARNING ⚠️ Model upload issue. Missing model {weights}.")
|
||||||
stream_response=True,
|
return
|
||||||
)
|
|
||||||
else:
|
self.request_queue(
|
||||||
LOGGER.warning(f"{PREFIX}WARNING ⚠️ Model upload issue. Missing model {weights}.")
|
self.model.upload_model,
|
||||||
|
epoch=epoch,
|
||||||
|
weights=str(weights),
|
||||||
|
is_best=is_best,
|
||||||
|
map=map,
|
||||||
|
final=final,
|
||||||
|
retry=10,
|
||||||
|
timeout=3600,
|
||||||
|
thread=not final,
|
||||||
|
progress_total=weights.stat().st_size if final else None, # only show progress if final
|
||||||
|
stream_response=True,
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _show_upload_progress(content_length: int, response: requests.Response) -> None:
|
def _show_upload_progress(content_length: int, response: requests.Response) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue