allow passing model through Ritual init

This commit is contained in:
Connor Olding 2019-02-05 22:16:46 +01:00
parent fd2fc4bd76
commit 50e0311051

View file

@ -9,9 +9,11 @@ Losses = namedtuple("Losses", ["avg_loss", "avg_mloss", "losses", "mlosses"])
class Ritual: # i'm just making up names at this point. class Ritual: # i'm just making up names at this point.
def __init__(self, learner=None): def __init__(self, learner=None, model=None):
self.learner = learner if learner is not None else Learner(Optimizer()) self.learner = learner if learner is not None else Learner(Optimizer())
self.model = None self.model = None
if model is not None:
self.prepare(model)
def reset(self): def reset(self):
self.learner.reset(optim=True) self.learner.reset(optim=True)