Refactor for simplification 2 (#9055)
* Refactor for simplification 2 * Update __init__.py Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
1 parent
c725511bfc
commit
93f63ee33f
2 files changed
+8
-15
No files matched your search
@@ -187,18 +187,16 @@ class Loggers():
|
||||
|
||||
def on_model_save(self, last, epoch, final_epoch, best_fitness, fi):
|
||||
# Callback runs on model save event
|
||||
if self.wandb:
|
||||
if ((epoch + 1) % self.opt.save_period == 0 and not final_epoch) and self.opt.save_period != -1:
|
||||
if (epoch + 1) % self.opt.save_period == 0 and not final_epoch and self.opt.save_period != -1:
|
||||
if self.wandb:
|
||||
self.wandb.log_model(last.parent, self.opt, epoch, fi, best_model=best_fitness == fi)
|
||||
|
||||
if self.clearml:
|
||||
if ((epoch + 1) % self.opt.save_period == 0 and not final_epoch) and self.opt.save_period != -1:
|
||||
if self.clearml:
|
||||
self.clearml.task.update_output_model(model_path=str(last),
|
||||
model_name='Latest Model',
|
||||
auto_delete_file=False)
|
||||
|
||||
def on_train_end(self, last, best, plots, epoch, results):
|
||||
# Callback runs on training end
|
||||
# Callback runs on training end, i.e. saving best model
|
||||
if plots:
|
||||
plot_results(file=self.save_dir / 'results.csv') # save results.png
|
||||
files = ['results.png', 'confusion_matrix.png', *(f'{x}_curve.png' for x in ('F1', 'PR', 'P', 'R'))]
|
||||
@@ -220,15 +218,11 @@ class Loggers():
|
||||
aliases=['latest', 'best', 'stripped'])
|
||||
self.wandb.finish_run()
|
||||
|
||||
if self.clearml:
|
||||
# Save the best model here
|
||||
if not self.opt.evolve:
|
||||
self.clearml.task.update_output_model(model_path=str(best if best.exists() else last),
|
||||
name='Best Model')
|
||||
if self.clearml and not self.opt.evolve:
|
||||
self.clearml.task.update_output_model(model_path=str(best if best.exists() else last), name='Best Model')
|
||||
|
||||
def on_params_update(self, params):
|
||||
def on_params_update(self, params: dict):
|
||||
# Update hyperparams or configs of the experiment
|
||||
# params: A dict containing {param: value} pairs
|
||||
if self.wandb:
|
||||
self.wandb.wandb_run.config.update(params, allow_val_change=True)
|
||||
|
||||
|
||||
Reference in new issue
Block a user