Пример #1
0
    def run_sampling(self, model):
        """Test sampling from the model."""
        config = self.run_training_one_step("fivo", "pianoroll", 88,
                                            "tiny_pianoroll.pkl",
                                            "test-sampling", "multinomial",
                                            model)
        config.prefix_length = 3
        config.sample_length = 6
        config.split = "train"
        config.sample_out_dir = None

        runners.run_sample(config)
        unused_samples = np.load(os.path.join(config.logdir, "samples.npz"))
def main(unused_argv):
    tf.logging.set_verbosity(tf.logging.INFO)
    if FLAGS.model in ["vrnn", "srnn"]:
        if FLAGS.data_dimension is None:
            if FLAGS.dataset_type == "pianoroll":
                FLAGS.data_dimension = PIANOROLL_DEFAULT_DATA_DIMENSION
            elif FLAGS.dataset_type == "speech":
                FLAGS.data_dimension = SPEECH_DEFAULT_DATA_DIMENSION
        if FLAGS.mode == "train":
            runners.run_train(FLAGS)
        elif FLAGS.mode == "eval":
            runners.run_eval(FLAGS)
        elif FLAGS.mode == "sample":
            runners.run_sample(FLAGS)
    elif FLAGS.model == "ghmm":
        if FLAGS.mode == "train":
            ghmm_runners.run_train(FLAGS)
        elif FLAGS.mode == "eval":
            ghmm_runners.run_eval(FLAGS)
Пример #3
0
def main(unused_argv):
  tf.logging.set_verbosity(tf.logging.INFO)
  if FLAGS.model in ["vrnn", "srnn"]:
    if FLAGS.data_dimension is None:
      if FLAGS.dataset_type == "pianoroll":
        FLAGS.data_dimension = PIANOROLL_DEFAULT_DATA_DIMENSION
      elif FLAGS.dataset_type == "speech":
        FLAGS.data_dimension = SPEECH_DEFAULT_DATA_DIMENSION
    if FLAGS.mode == "train":
      runners.run_train(FLAGS)
    elif FLAGS.mode == "eval":
      runners.run_eval(FLAGS)
    elif FLAGS.mode == "sample":
      runners.run_sample(FLAGS)
  elif FLAGS.model == "ghmm":
    if FLAGS.mode == "train":
      ghmm_runners.run_train(FLAGS)
    elif FLAGS.mode == "eval":
      ghmm_runners.run_eval(FLAGS)
Пример #4
0
    def test_sampling_with_custom_fn(self):
        config = self.run_training_one_step(
            "fivo",
            "pianoroll",
            3,
            "tiny_pianoroll.pkl",
            "test-sample-custom-fn",
            "multinomial",
            "vrnn",
            batch_size=5,
            create_dataset_and_model_fn=self.dummmy_dataset_and_model_fn)
        config.prefix_length = 2
        config.sample_length = 3
        config.split = "train"
        config.sample_out_dir = None

        runners.run_sample(
            config,
            create_dataset_and_model_fn=self.dummmy_dataset_and_model_fn)
        unused_samples = np.load(os.path.join(config.logdir, "samples.npz"))