Ejemplo n.º 1
0
def main(unused_argv):
    """Saves bundle or runs generator based on flags."""
    tf.logging.set_verbosity(FLAGS.log)

    bundle = get_bundle()

    config_id = bundle.generator_details.id if bundle else FLAGS.config
    config = performance_model.default_configs[config_id]
    config.hparams.parse(FLAGS.hparams)
    # Having too large of a batch size will slow generation down unnecessarily.
    config.hparams.batch_size = min(config.hparams.batch_size,
                                    FLAGS.beam_size * FLAGS.branch_factor)

    generator = performance_sequence_generator.PerformanceRnnSequenceGenerator(
        model=performance_model.PerformanceRnnModel(config),
        details=config.details,
        steps_per_second=config.steps_per_second,
        num_velocity_bins=config.num_velocity_bins,
        control_signals=config.control_signals,
        optional_conditioning=config.optional_conditioning,
        checkpoint=get_checkpoint(),
        bundle=bundle,
        note_performance=config.note_performance)

    if FLAGS.save_generator_bundle:
        bundle_filename = os.path.expanduser(FLAGS.bundle_file)
        if FLAGS.bundle_description is None:
            tf.logging.warning('No bundle description provided.')
        tf.logging.info('Saving generator bundle to %s', bundle_filename)
        generator.create_bundle_file(bundle_filename, FLAGS.bundle_description)
    else:
        run_with_flags(generator)
 def create_sequence_generator(config, **kwargs):
   return PerformanceRnnSequenceGenerator(
       performance_model.PerformanceRnnModel(config), config.details,
       steps_per_second=config.steps_per_second,
       num_velocity_bins=config.num_velocity_bins,
       control_signals=config.control_signals,
       optional_conditioning=config.optional_conditioning,
       fill_generate_section=False,
       note_performance=config.note_performance,
       **kwargs)
Ejemplo n.º 3
0
 def create_sequence_generator(config, **kwargs):
     return PerformanceRnnSequenceGenerator(
         performance_model.PerformanceRnnModel(config),
         config.details,
         steps_per_second=config.steps_per_second,
         num_velocity_bins=config.num_velocity_bins,
         note_density_conditioning=config.density_bin_ranges is not None,
         pitch_histogram_conditioning=(config.pitch_histogram_window_size
                                       is not None),
         fill_generate_section=False,
         **kwargs)
Ejemplo n.º 4
0
 def create_sequence_generator(config, **kwargs):
   return PerformanceRnnSequenceGenerator(
       performance_model.PerformanceRnnModel(config), config.details,
       steps_per_second=config.steps_per_second,
       num_velocity_bins=config.num_velocity_bins, fill_generate_section=False,
       **kwargs)