From f5012770c565e9f900f02574b316d0f8b9c00d17 Mon Sep 17 00:00:00 2001 From: Hana Joo Date: Wed, 1 Jul 2026 16:15:19 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 941348726 --- .github/workflows/build.yaml | 2 +- mt3/__init__.py | 2 +- mt3/datasets.py | 2 +- mt3/event_codec.py | 2 +- mt3/event_codec_test.py | 2 +- mt3/inference.py | 4 +-- mt3/layers.py | 22 ++++++------- mt3/layers_test.py | 2 +- mt3/metrics.py | 2 +- mt3/metrics_utils.py | 2 +- mt3/metrics_utils_test.py | 2 +- mt3/mixing.py | 6 ++-- mt3/models.py | 4 +-- mt3/network.py | 4 +-- mt3/note_sequences.py | 2 +- mt3/note_sequences_test.py | 2 +- mt3/preprocessors.py | 22 ++++++------- mt3/run_length_encoding.py | 8 ++--- mt3/run_length_encoding_test.py | 2 +- mt3/scripts/dump_task.py | 2 +- mt3/scripts/extract_monophonic_examples.py | 4 +-- mt3/spectral_ops.py | 2 +- mt3/spectrograms.py | 2 +- mt3/summaries.py | 38 +++++++++++----------- mt3/tasks.py | 14 ++++---- mt3/version.py | 2 +- mt3/vocabularies.py | 8 ++--- mt3/vocabularies_test.py | 2 +- setup.py | 2 +- 29 files changed, 85 insertions(+), 85 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6d8dd4f..d7bc511 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/__init__.py b/mt3/__init__.py index 694de90..e410e83 100644 --- a/mt3/__init__.py +++ b/mt3/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/datasets.py b/mt3/datasets.py index 24cd303..039c8fc 100644 --- a/mt3/datasets.py +++ b/mt3/datasets.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/event_codec.py b/mt3/event_codec.py index 22f928e..3acc952 100644 --- a/mt3/event_codec.py +++ b/mt3/event_codec.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/event_codec_test.py b/mt3/event_codec_test.py index d18b2c8..441c836 100644 --- a/mt3/event_codec_test.py +++ b/mt3/event_codec_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/inference.py b/mt3/inference.py index d51ebba..d48ce0e 100644 --- a/mt3/inference.py +++ b/mt3/inference.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ def write_inferences_to_file( else: encoding_spec = note_sequences.NoteEncodingWithTiesSpec - codec = vocabularies.build_codec(vocab_config) + codec = vocabularies.build_codec(vocab_config) # pyrefly: ignore[bad-argument-type] targets = [] predictions = [] diff --git a/mt3/layers.py b/mt3/layers.py index 1db61d2..861ada8 100644 --- a/mt3/layers.py +++ b/mt3/layers.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -147,7 +147,7 @@ def dot_product_attention(query: Array, # corresponds to in positional dimensions here, assuming query dim. dropout_shape = list(attn_weights.shape) dropout_shape[-2] = 1 - keep = random.bernoulli(dropout_rng, keep_prob, dropout_shape) + keep = random.bernoulli(dropout_rng, keep_prob, dropout_shape) # pyrefly: ignore[bad-argument-type] keep = jnp.broadcast_to(keep, attn_weights.shape) multiplier = ( keep.astype(attn_weights.dtype) / jnp.asarray(keep_prob, dtype=dtype)) @@ -357,7 +357,7 @@ def __call__(self, def _normalize_axes(axes: Iterable[int], ndim: int) -> Tuple[int]: # A tuple by convention. len(axes_tuple) then also gives the rank efficiently. - return tuple([ax if ax >= 0 else ndim + ax for ax in axes]) + return tuple([ax if ax >= 0 else ndim + ax for ax in axes]) # pyrefly: ignore[bad-return] def _canonicalize_tuple(x): @@ -593,7 +593,7 @@ def __call__(self, i = position_embedder_index.value position_embedder_index.value = i + 1 return jax.lax.dynamic_slice(self.embedding, jnp.array((i, 0)), - np.array((1, self.features))) + np.array((1, self.features))) # pyrefly: ignore[bad-argument-type] return jnp.take(self.embedding, inputs, axis=0) @@ -700,15 +700,15 @@ def combine_masks(*masks: Optional[Array], dtype: DType = jnp.float32): Returns: Combined mask, reduced by logical and, returns None if no masks given. """ - masks = [m for m in masks if m is not None] + masks = [m for m in masks if m is not None] # pyrefly: ignore[bad-assignment] if not masks: return None - assert all(map(lambda x: x.ndim == masks[0].ndim, masks)), ( + assert all(map(lambda x: x.ndim == masks[0].ndim, masks)), ( # pyrefly: ignore[missing-attribute] f'masks must have same rank: {tuple(map(lambda x: x.ndim, masks))}') mask, *other_masks = masks for other_mask in other_masks: - mask = jnp.logical_and(mask, other_mask) - return mask.astype(dtype) + mask = jnp.logical_and(mask, other_mask) # pyrefly: ignore[bad-argument-type] + return mask.astype(dtype) # pyrefly: ignore[missing-attribute] def combine_biases(*masks: Optional[Array]): @@ -720,14 +720,14 @@ def combine_biases(*masks: Optional[Array]): Returns: Combined mask, reduced by summation, returns None if no masks given. """ - masks = [m for m in masks if m is not None] + masks = [m for m in masks if m is not None] # pyrefly: ignore[bad-assignment] if not masks: return None - assert all(map(lambda x: x.ndim == masks[0].ndim, masks)), ( + assert all(map(lambda x: x.ndim == masks[0].ndim, masks)), ( # pyrefly: ignore[missing-attribute] f'masks must have same rank: {tuple(map(lambda x: x.ndim, masks))}') mask, *other_masks = masks for other_mask in other_masks: - mask = mask + other_mask + mask = mask + other_mask # pyrefly: ignore[unsupported-operation] return mask diff --git a/mt3/layers_test.py b/mt3/layers_test.py index a806b8c..39c2d7d 100644 --- a/mt3/layers_test.py +++ b/mt3/layers_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/metrics.py b/mt3/metrics.py index 77ced45..171f53f 100644 --- a/mt3/metrics.py +++ b/mt3/metrics.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/metrics_utils.py b/mt3/metrics_utils.py index dffa8c5..dac16a3 100644 --- a/mt3/metrics_utils.py +++ b/mt3/metrics_utils.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/metrics_utils_test.py b/mt3/metrics_utils_test.py index 86bb921..af66e0d 100644 --- a/mt3/metrics_utils_test.py +++ b/mt3/metrics_utils_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/mixing.py b/mt3/mixing.py index 93aca13..cdc63e9 100644 --- a/mt3/mixing.py +++ b/mt3/mixing.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,10 +59,10 @@ def mix_transcription_examples( Dataset containing mixed examples. """ if max_examples_per_mix is None: - return ds + return ds # pyrefly: ignore[bad-return] # TODO(iansimon): is there a way to use seqio's seed? - ds = tf.data.Dataset.sample_from_datasets([ + ds = tf.data.Dataset.sample_from_datasets([ # pyrefly: ignore[bad-argument-type] ds.shuffle( buffer_size=shuffle_buffer_size // max_examples_per_mix ).padded_batch(batch_size=i) for i in range(1, max_examples_per_mix + 1) diff --git a/mt3/models.py b/mt3/models.py index b5b2804..3da1e2d 100644 --- a/mt3/models.py +++ b/mt3/models.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -131,7 +131,7 @@ def __init__(self, module, input_vocabulary, output_vocabulary, optimizer_def, input_vocabulary=input_vocabulary, output_vocabulary=output_vocabulary, optimizer_def=optimizer_def, - decode_fn=decode_fn, + decode_fn=decode_fn, # pyrefly: ignore[bad-argument-type] label_smoothing=label_smoothing, z_loss=z_loss, loss_normalizing_factor=loss_normalizing_factor) diff --git a/mt3/network.py b/mt3/network.py index 47a0612..ea41a6d 100644 --- a/mt3/network.py +++ b/mt3/network.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -344,7 +344,7 @@ def decode( encoder_decoder_mask = layers.combine_masks( encoder_decoder_mask, layers.make_attention_mask( - decoder_segment_ids, + decoder_segment_ids, # pyrefly: ignore[bad-argument-type] encoder_segment_ids, jnp.equal, dtype=cfg.dtype)) diff --git a/mt3/note_sequences.py b/mt3/note_sequences.py index a5f7157..b5ec862 100644 --- a/mt3/note_sequences.py +++ b/mt3/note_sequences.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/note_sequences_test.py b/mt3/note_sequences_test.py index ce0cea8..c1cf216 100644 --- a/mt3/note_sequences_test.py +++ b/mt3/note_sequences_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/preprocessors.py b/mt3/preprocessors.py index 06323ae..30ced69 100644 --- a/mt3/preprocessors.py +++ b/mt3/preprocessors.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ def _audio_to_frames( """Convert audio samples to non-overlapping frames and frame times.""" frame_size = spectrogram_config.hop_width logging.info('Padding %d samples to multiple of %d', len(samples), frame_size) - samples = np.pad(samples, + samples = np.pad(samples, # pyrefly: ignore[bad-assignment] [0, frame_size - len(samples) % frame_size], mode='constant') @@ -167,9 +167,9 @@ def tokenize(sequence, audio, sample_rate, example_id=None): event_values=values, encode_event_fn=note_sequences.note_event_data_to_events, codec=codec, - frame_times=frame_times, + frame_times=frame_times, # pyrefly: ignore[bad-argument-type] encoding_state_to_events_fn=( - note_sequences.note_encoding_state_to_events + note_sequences.note_encoding_state_to_events # pyrefly: ignore[bad-argument-type] if include_ties else None))) yield { @@ -196,7 +196,7 @@ def process_record(input_record): args.append(input_record[id_feature_key]) ds = tf.data.Dataset.from_generator( - tokenize, + tokenize, # pyrefly: ignore[bad-argument-type] output_signature={ 'inputs': tf.TensorSpec( @@ -339,9 +339,9 @@ def tokenize(sequences, inst_names, audio, example_id=None): event_values=values, encode_event_fn=note_sequences.note_event_data_to_events, codec=codec, - frame_times=frame_times, + frame_times=frame_times, # pyrefly: ignore[bad-argument-type] encoding_state_to_events_fn=( - note_sequences.note_encoding_state_to_events + note_sequences.note_encoding_state_to_events # pyrefly: ignore[bad-argument-type] if include_ties else None))) yield { @@ -365,7 +365,7 @@ def process_record(input_record): args.append(input_record[id_feature_key]) ds = tf.data.Dataset.from_generator( - tokenize, + tokenize, # pyrefly: ignore[bad-argument-type] output_signature={ 'inputs': tf.TensorSpec( @@ -556,9 +556,9 @@ def tokenize(sequences, samples, sample_rate, inst_names, example_id): event_values=values, encode_event_fn=note_sequences.note_event_data_to_events, codec=codec, - frame_times=frame_times, + frame_times=frame_times, # pyrefly: ignore[bad-argument-type] encoding_state_to_events_fn=( - note_sequences.note_encoding_state_to_events + note_sequences.note_encoding_state_to_events # pyrefly: ignore[bad-argument-type] if include_ties else None))) yield { @@ -574,7 +574,7 @@ def tokenize(sequences, samples, sample_rate, inst_names, example_id): def process_record(input_record): ds = tf.data.Dataset.from_generator( - tokenize, + tokenize, # pyrefly: ignore[bad-argument-type] output_signature={ 'inputs': tf.TensorSpec( diff --git a/mt3/run_length_encoding.py b/mt3/run_length_encoding.py index fb5e0fa..3d8a397 100644 --- a/mt3/run_length_encoding.py +++ b/mt3/run_length_encoding.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -124,8 +124,8 @@ def fill_event_start_indices_to_cur_step(): while(len(event_start_indices) < len(frame_times) and frame_times[len(event_start_indices)] < cur_step / codec.steps_per_second): - event_start_indices.append(cur_event_idx) - state_event_indices.append(cur_state_event_idx) + event_start_indices.append(cur_event_idx) # pyrefly: ignore[missing-attribute] + state_event_indices.append(cur_state_event_idx) # pyrefly: ignore[missing-attribute] for event_step, event_value in zip(event_steps, event_values): while event_step > cur_step: @@ -163,7 +163,7 @@ def fill_event_start_indices_to_cur_step(): event_end_indices = np.array(event_end_indices) state_event_indices = np.array(state_event_indices) - return (events, event_start_indices, event_end_indices, + return (events, event_start_indices, event_end_indices, # pyrefly: ignore[bad-return] state_events, state_event_indices) diff --git a/mt3/run_length_encoding_test.py b/mt3/run_length_encoding_test.py index 3071696..48eb431 100644 --- a/mt3/run_length_encoding_test.py +++ b/mt3/run_length_encoding_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/scripts/dump_task.py b/mt3/scripts/dump_task.py index e64612d..cceb11e 100644 --- a/mt3/scripts/dump_task.py +++ b/mt3/scripts/dump_task.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/scripts/extract_monophonic_examples.py b/mt3/scripts/extract_monophonic_examples.py index 3ccbe31..5301b6b 100644 --- a/mt3/scripts/extract_monophonic_examples.py +++ b/mt3/scripts/extract_monophonic_examples.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ def main(unused_argv): continue logging.info('processing %s...', filename) for ex in process_wav_file( - os.path.join(_INPUT_DIR.value, filename), crepe, counters): + os.path.join(_INPUT_DIR.value, filename), crepe, counters): # pyrefly: ignore[no-matching-overload] writer.write(ex.SerializeToString()) counters['wav_files_processed'] += 1 for k, v in counters.items(): diff --git a/mt3/spectral_ops.py b/mt3/spectral_ops.py index 078a36b..be07adf 100644 --- a/mt3/spectral_ops.py +++ b/mt3/spectral_ops.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/spectrograms.py b/mt3/spectrograms.py index 05c6b70..06e179d 100644 --- a/mt3/spectrograms.py +++ b/mt3/spectrograms.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/summaries.py b/mt3/summaries.py index e1e2590..2c13a4f 100644 --- a/mt3/summaries.py +++ b/mt3/summaries.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -98,12 +98,12 @@ def _example_to_note_sequence( assert len(onset_times) == len(velocities) ns = note_sequences.note_arrays_to_note_sequence( - onset_times=onset_times, offset_times=offset_times, - pitches=pitches, velocities=velocities) + onset_times=onset_times, offset_times=offset_times, # pyrefly: ignore[bad-argument-type] + pitches=pitches, velocities=velocities) # pyrefly: ignore[bad-argument-type] else: ns = note_sequences.note_arrays_to_note_sequence( - onset_times=onset_times, pitches=pitches) + onset_times=onset_times, pitches=pitches) # pyrefly: ignore[bad-argument-type] return sequences_lib.trim_note_sequence(ns, 0, num_seconds) @@ -205,17 +205,17 @@ def _examples_to_pianorolls( def ex_to_ns(example, prefix): return _example_to_note_sequence( example=example, - ns_feature_name=(prefix + ns_feature_suffix + ns_feature_name=(prefix + ns_feature_suffix # pyrefly: ignore[bad-argument-type] if ns_feature_suffix else None), - note_onset_feature_name=(prefix + note_onset_feature_suffix + note_onset_feature_name=(prefix + note_onset_feature_suffix # pyrefly: ignore[bad-argument-type] if note_onset_feature_suffix else None), - note_offset_feature_name=(prefix + note_offset_feature_suffix + note_offset_feature_name=(prefix + note_offset_feature_suffix # pyrefly: ignore[bad-argument-type] if note_offset_feature_suffix else None), note_frequency_feature_name=( - prefix + note_frequency_feature_suffix + prefix + note_frequency_feature_suffix # pyrefly: ignore[bad-argument-type] if note_frequency_feature_suffix else None), note_confidence_feature_name=( - prefix + note_confidence_feature_suffix + prefix + note_confidence_feature_suffix # pyrefly: ignore[bad-argument-type] if note_confidence_feature_suffix else None), num_seconds=num_seconds) @@ -426,17 +426,17 @@ def transcription_summaries( def synthesize(examples, prefix): return _synthesize_example_notes( examples=examples, - ns_feature_name=(prefix + ns_feature_suffix + ns_feature_name=(prefix + ns_feature_suffix # pyrefly: ignore[bad-argument-type] if ns_feature_suffix else None), - note_onset_feature_name=(prefix + note_onset_feature_suffix + note_onset_feature_name=(prefix + note_onset_feature_suffix # pyrefly: ignore[bad-argument-type] if note_onset_feature_suffix else None), - note_offset_feature_name=(prefix + note_offset_feature_suffix + note_offset_feature_name=(prefix + note_offset_feature_suffix # pyrefly: ignore[bad-argument-type] if note_offset_feature_suffix else None), note_frequency_feature_name=( - prefix + note_frequency_feature_suffix + prefix + note_frequency_feature_suffix # pyrefly: ignore[bad-argument-type] if note_frequency_feature_suffix else None), note_confidence_feature_name=( - prefix + note_confidence_feature_suffix + prefix + note_confidence_feature_suffix # pyrefly: ignore[bad-argument-type] if note_confidence_feature_suffix else None), sample_rate=spectrogram_config.sample_rate, num_seconds=num_seconds) @@ -446,11 +446,11 @@ def synthesize(examples, prefix): onset_pianoroll_images, full_pianoroll_images = _examples_to_pianorolls( targets=targets, predictions=predictions, - ns_feature_suffix=ns_feature_suffix, - note_onset_feature_suffix=note_onset_feature_suffix, - note_offset_feature_suffix=note_offset_feature_suffix, - note_frequency_feature_suffix=note_frequency_feature_suffix, - note_confidence_feature_suffix=note_confidence_feature_suffix, + ns_feature_suffix=ns_feature_suffix, # pyrefly: ignore[bad-argument-type] + note_onset_feature_suffix=note_onset_feature_suffix, # pyrefly: ignore[bad-argument-type] + note_offset_feature_suffix=note_offset_feature_suffix, # pyrefly: ignore[bad-argument-type] + note_frequency_feature_suffix=note_frequency_feature_suffix, # pyrefly: ignore[bad-argument-type] + note_confidence_feature_suffix=note_confidence_feature_suffix, # pyrefly: ignore[bad-argument-type] track_specs=track_specs, num_seconds=num_seconds, frames_per_second=pianoroll_frames_per_second) diff --git a/mt3/tasks.py b/mt3/tasks.py index 3bfcff7..78b38d9 100644 --- a/mt3/tasks.py +++ b/mt3/tasks.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,10 +57,10 @@ def construct_task_name( def trim_eos(tokens: Sequence[int]) -> np.ndarray: """If EOS is present, remove it and everything after.""" - tokens = np.array(tokens, np.int32) + tokens = np.array(tokens, np.int32) # pyrefly: ignore[bad-assignment] if vocabularies.DECODED_EOS_ID in tokens: - tokens = tokens[:np.argmax(tokens == vocabularies.DECODED_EOS_ID)] - return tokens + tokens = tokens[:np.argmax(tokens == vocabularies.DECODED_EOS_ID)] # pyrefly: ignore[bad-index] + return tokens # pyrefly: ignore[bad-return] def postprocess(tokens, example, is_target, codec): @@ -102,7 +102,7 @@ def add_transcription_task_to_registry( output_features = { 'targets': seqio.Feature(vocabulary=vocabulary), - 'inputs': seqio.ContinuousFeature(dtype=tf.float32, rank=2) + 'inputs': seqio.ContinuousFeature(dtype=tf.float32, rank=2) # pyrefly: ignore[unexpected-keyword] } task_name = 'onsets' if onsets_only else 'notes' @@ -125,7 +125,7 @@ def add_transcription_task_to_registry( # Add transcription training task. seqio.TaskRegistry.add( train_task_name, - source=seqio.TFExampleDataSource( + source=seqio.TFExampleDataSource( # pyrefly: ignore[bad-argument-type] split_to_filepattern={ 'train': dataset_config.paths[dataset_config.train_split], 'eval': dataset_config.paths[dataset_config.train_eval_split] @@ -196,7 +196,7 @@ def add_transcription_task_to_registry( seqio.TaskRegistry.add( eval_task_name, - source=seqio.TFExampleDataSource( + source=seqio.TFExampleDataSource( # pyrefly: ignore[bad-argument-type] split_to_filepattern={'eval': dataset_config.paths[split.name]}, feature_description=dataset_config.features), output_features=output_features, diff --git a/mt3/version.py b/mt3/version.py index 0ac7de2..5a4d377 100644 --- a/mt3/version.py +++ b/mt3/version.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/mt3/vocabularies.py b/mt3/vocabularies.py index 22e2fb0..5b98787 100644 --- a/mt3/vocabularies.py +++ b/mt3/vocabularies.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -235,8 +235,8 @@ def _encode_tf(self, token_ids: tf.Tensor) -> tf.Tensor: tf.debugging.assert_greater_equal( token_ids, tf.cast(0, token_ids.dtype)) ]): - tf_ids = token_ids + self._num_special_tokens - return tf_ids + tf_ids = token_ids + self._num_special_tokens # pyrefly: ignore[unsupported-operation] + return tf_ids # pyrefly: ignore[bad-return] def _decode_tf(self, ids: tf.Tensor) -> tf.Tensor: """Decode in TensorFlow. @@ -267,7 +267,7 @@ def _decode_tf(self, ids: tf.Tensor) -> tf.Tensor: tf.logical_and( tf.greater_equal(ids, self._num_special_tokens), tf.less(ids, self._base_vocab_size)), - ids - self._num_special_tokens, + ids - self._num_special_tokens, # pyrefly: ignore[unsupported-operation] DECODED_INVALID_ID)) def __eq__(self, other): diff --git a/mt3/vocabularies_test.py b/mt3/vocabularies_test.py index af5af18..7f24de5 100644 --- a/mt3/vocabularies_test.py +++ b/mt3/vocabularies_test.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index 5113c25..ac1c17d 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright 2025 The MT3 Authors. +# Copyright 2026 The MT3 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.