Skip to content

Commit

Permalink
convert to np array
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchit-gandhi committed Jun 24, 2022
1 parent 6279fec commit d9ce68c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions run_flax_speech_recognition_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ def get_grouped_indices(
# We need to use JAX for the random permutation as the PRNG key will be set based on the seed outside of the sampler.
num_samples = len(lengths)
indices = jax.random.permutation(rng, np.arange(num_samples)) if rng is not None else np.arange(num_samples)
indices = np.asarray(indices)

megabatch_size = mega_batch_mult * batch_size
megabatches = [indices[i : i + megabatch_size].tolist() for i in range(0, len(lengths), megabatch_size)]
Expand Down

0 comments on commit d9ce68c

Please sign in to comment.