ultralytics 8.2.40 refactor HUB code into callbacks (#13896)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
3df9d278dc
commit
c636fe0f35
8 changed files with 75 additions and 57 deletions
|
|
@ -3,8 +3,14 @@
|
|||
import json
|
||||
from time import time
|
||||
|
||||
from ultralytics.hub.utils import HUB_WEB_ROOT, PREFIX, events
|
||||
from ultralytics.utils import LOGGER, SETTINGS
|
||||
from ultralytics.hub import HUB_WEB_ROOT, PREFIX, HUBTrainingSession, events
|
||||
from ultralytics.utils import LOGGER, RANK, SETTINGS
|
||||
|
||||
|
||||
def on_pretrain_routine_start(trainer):
|
||||
"""Create a remote Ultralytics HUB session to log local model training."""
|
||||
if RANK in {-1, 0} and SETTINGS["hub"] is True and not getattr(trainer, "hub_session", None):
|
||||
trainer.hub_session = HUBTrainingSession.create_session(trainer.args.model, trainer.args)
|
||||
|
||||
|
||||
def on_pretrain_routine_end(trainer):
|
||||
|
|
@ -91,6 +97,7 @@ def on_export_start(exporter):
|
|||
|
||||
callbacks = (
|
||||
{
|
||||
"on_pretrain_routine_start": on_pretrain_routine_start,
|
||||
"on_pretrain_routine_end": on_pretrain_routine_end,
|
||||
"on_fit_epoch_end": on_fit_epoch_end,
|
||||
"on_model_save": on_model_save,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue