def __init__(self, wmodel, strategy_name="complete_midi"): self.wmodel = wmodel self.hparams = self.wmodel.hparams self.decoder = lib_pianoroll.get_pianoroll_encoder_decoder(self.hparams) self.logger = lib_logging.Logger() # Instantiates generation strategy. self.strategy_name = strategy_name self.strategy = BaseStrategy.make(self.strategy_name, self.wmodel, self.logger, self.decoder) self._pianorolls = None self._time_taken = None
def __init__(self, wmodel, strategy_name="complete_midi"): """Initializes Generator with a wrapped model and strategy name. Args: wmodel: A lib_tfutil.WrappedModel loaded from a model checkpoint. strategy_name: A string specifying the key of the default strategy. """ self.wmodel = wmodel self.hparams = self.wmodel.hparams self.decoder = lib_pianoroll.get_pianoroll_encoder_decoder(self.hparams) self.logger = lib_logging.Logger() # Instantiates generation strategy. self.strategy_name = strategy_name self.strategy = BaseStrategy.make(self.strategy_name, self.wmodel, self.logger, self.decoder) self._pianorolls = None self._time_taken = None