Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mt3/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def write_inferences_to_file(
else:
encoding_spec = note_sequences.NoteEncodingWithTiesSpec

codec = vocabularies.build_codec(vocab_config) # pyrefly: ignore[bad-argument-type]
codec = vocabularies.build_codec(vocab_config)

targets = []
predictions = []
Expand Down
4 changes: 2 additions & 2 deletions mt3/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class FixedEmbed(nn.Module):
def setup(self):
# The key is set to None because sinusoid init is deterministic.
shape = (self.max_length, self.features)
self.embedding = self.embedding_init(None, shape, self.dtype) # pylint: disable=too-many-function-args # pytype: disable=wrong-arg-types # jax-ndarray
self.embedding = self.embedding_init(None, shape, self.dtype) # pylint: disable=too-many-function-args # pyrefly: ignore[bad-argument-type]

@nn.compact
def __call__(self,
Expand Down Expand Up @@ -827,4 +827,4 @@ def make_decoder_mask(decoder_target_tokens: Array,
make_attention_mask(
decoder_segment_ids, decoder_segment_ids, jnp.equal, dtype=dtype))

return combine_masks(*masks, dtype=dtype) # pytype: disable=bad-return-type # jax-ndarray
return combine_masks(*masks, dtype=dtype)
2 changes: 1 addition & 1 deletion mt3/mixing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def mix_transcription_examples(
return ds # pyrefly: ignore[bad-return]

# TODO(iansimon): is there a way to use seqio's seed?
ds = tf.data.Dataset.sample_from_datasets([ # pyrefly: ignore[bad-argument-type]
ds = tf.data.Dataset.sample_from_datasets([
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)
Expand Down
4 changes: 2 additions & 2 deletions mt3/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def __call__(self,
inputs_positions = jnp.arange(seq_length)[None, :]

# [batch, length, depth] -> [batch, length, emb_dim]
x = layers.DenseGeneral( # pytype: disable=wrong-arg-types # jax-types
x = layers.DenseGeneral(
cfg.emb_dim,
dtype=cfg.dtype,
kernel_init=nn.linear.default_kernel_init,
Expand Down Expand Up @@ -214,7 +214,7 @@ def __call__(self,
decoder_positions = jnp.arange(seq_length)[None, :]

# [batch, length] -> [batch, length, emb_dim]
y = layers.Embed( # pytype: disable=wrong-arg-types # jax-types
y = layers.Embed(
num_embeddings=cfg.vocab_size,
features=cfg.emb_dim,
dtype=cfg.dtype,
Expand Down
6 changes: 3 additions & 3 deletions mt3/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def process_record(input_record):
args.append(input_record[id_feature_key])

ds = tf.data.Dataset.from_generator(
tokenize, # pyrefly: ignore[bad-argument-type]
tokenize,
output_signature={
'inputs':
tf.TensorSpec(
Expand Down Expand Up @@ -365,7 +365,7 @@ def process_record(input_record):
args.append(input_record[id_feature_key])

ds = tf.data.Dataset.from_generator(
tokenize, # pyrefly: ignore[bad-argument-type]
tokenize,
output_signature={
'inputs':
tf.TensorSpec(
Expand Down Expand Up @@ -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, # pyrefly: ignore[bad-argument-type]
tokenize,
output_signature={
'inputs':
tf.TensorSpec(
Expand Down
6 changes: 3 additions & 3 deletions mt3/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 # pyrefly: ignore[unsupported-operation]
return tf_ids # pyrefly: ignore[bad-return]
tf_ids = token_ids + self._num_special_tokens
return tf_ids

def _decode_tf(self, ids: tf.Tensor) -> tf.Tensor:
"""Decode in TensorFlow.
Expand Down Expand Up @@ -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, # pyrefly: ignore[unsupported-operation]
ids - self._num_special_tokens,
DECODED_INVALID_ID))

def __eq__(self, other):
Expand Down
Loading