|
@@ -1,16 +1,12 @@
|
|
|
-import abc
|
|
|
-import gc
|
|
|
import logging
|
|
|
import pyaml
|
|
|
import typing as T
|
|
|
|
|
|
from bdb import BdbQuit
|
|
|
from chainer.serializers import save_npz
|
|
|
-from chainer.training import extension
|
|
|
from chainer.training import extensions
|
|
|
from chainer.training import updaters
|
|
|
from cvdatasets.utils import pretty_print_dict
|
|
|
-from functools import partial
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
@@ -56,12 +52,15 @@ class _TrainerMixin(BaseMixin):
|
|
|
return self.no_sacred
|
|
|
|
|
|
def init_experiment(self, *, config: dict):
|
|
|
- """ creates a sacred experiment that is later used by the trainer's sacred extension """
|
|
|
+ """ creates a sacred experiment that is later used
|
|
|
+ by the trainer's sacred extension
|
|
|
+ """
|
|
|
|
|
|
self.config = config
|
|
|
|
|
|
if self.no_sacred:
|
|
|
- logging.warning("Default sacred workflow is disabled by the --no_sacred option!")
|
|
|
+ logging.warning("Default sacred workflow is disabled "\
|
|
|
+ "by the --no_sacred option!")
|
|
|
return
|
|
|
|
|
|
self.ex = Experiment(
|
|
@@ -143,7 +142,8 @@ class _TrainerMixin(BaseMixin):
|
|
|
|
|
|
self.save_meta_info()
|
|
|
|
|
|
- logging.info("Snapshotting is {}abled".format("dis" if self.no_snapshot else "en"))
|
|
|
+ logging.info("Snapshotting is {}abled".format(
|
|
|
+ "dis" if self.no_snapshot else "en"))
|
|
|
|
|
|
try:
|
|
|
self.run_experiment(self.init_eval or self.only_eval)
|
|
@@ -163,7 +163,8 @@ class _TrainerMixin(BaseMixin):
|
|
|
eval_fpath = Path(eval_fpath)
|
|
|
|
|
|
if eval_fpath.exists() and not force:
|
|
|
- logging.warning(f"Evaluation file (\"{eval_fpath}\") exists already, skipping evaluation")
|
|
|
+ logging.warning(f"Evaluation file (\"{eval_fpath}\") "\
|
|
|
+ "exists already, skipping evaluation")
|
|
|
return
|
|
|
|
|
|
records = self.evaluator()
|