def generate_data(self, data_dir, tmp_dir, task_id=(- 1)):
    del task_id

    def augment_note_sequence(ns, stretch_factor, transpose_amount):
        'Augment a NoteSequence by time stretch and pitch transposition.'
        augmented_ns = sequences_lib.stretch_note_sequence(ns, stretch_factor, in_place=False)
        try:
            (_, num_deleted_notes) = sequences_lib.transpose_note_sequence(augmented_ns, transpose_amount, min_allowed_pitch=MIN_PITCH, max_allowed_pitch=MAX_PITCH, in_place=True)
        except chord_symbols_lib.ChordSymbolError:
            raise datagen_beam.DataAugmentationError('Transposition of chord symbol(s) failed.')
        if num_deleted_notes:
            raise datagen_beam.DataAugmentationError('Transposition caused out-of-range pitch(es).')
        return augmented_ns
    augment_params = itertools.product(self.stretch_factors, self.transpose_amounts)
    augment_fns = [functools.partial(augment_note_sequence, stretch_factor=s, transpose_amount=t) for (s, t) in augment_params]
    datagen_beam.generate_conditional_examples(input_transform=self.performances_input_transform(tmp_dir), output_dir=data_dir, problem_name=self.dataset_filename(), splits=self.splits, min_pitch=MIN_PITCH, max_pitch=MAX_PITCH, melody=False, noisy=False, encode_performance_fn=self.performance_encoder().encode_note_sequence, encode_score_fns=dict(((name, encoder.encode_note_sequence) for (name, encoder) in self.score_encoders())), augment_fns=augment_fns, num_replications=self.num_replications)
def generate_data(self, data_dir, tmp_dir, task_id=(- 1)):
    del task_id

    def augment_note_sequence(ns, stretch_factor, transpose_amount):
        'Augment a NoteSequence by time stretch and pitch transposition.'
        augmented_ns = sequences_lib.stretch_note_sequence(ns, stretch_factor, in_place=False)
        try:
            (_, num_deleted_notes) = sequences_lib.transpose_note_sequence(augmented_ns, transpose_amount, min_allowed_pitch=MIN_PITCH, max_allowed_pitch=MAX_PITCH, in_place=True)
        except chord_symbols_lib.ChordSymbolError:
            raise datagen_beam.DataAugmentationError('Transposition of chord symbol(s) failed.')
        if num_deleted_notes:
            raise datagen_beam.DataAugmentationError('Transposition caused out-of-range pitch(es).')
        return augmented_ns
    augment_params = itertools.product(self.stretch_factors, self.transpose_amounts)
    augment_fns = [functools.partial(augment_note_sequence, stretch_factor=s, transpose_amount=t) for (s, t) in augment_params]
    datagen_beam.generate_conditional_examples(input_transform=self.performances_input_transform(tmp_dir), output_dir=data_dir, problem_name=self.dataset_filename(), splits=self.splits, min_pitch=MIN_PITCH, max_pitch=MAX_PITCH, melody=False, noisy=False, encode_performance_fn=self.performance_encoder().encode_note_sequence, encode_score_fns=dict(((name, encoder.encode_note_sequence) for (name, encoder) in self.score_encoders())), augment_fns=augment_fns, num_replications=self.num_replications)