Skip to content

Conversation

@KAIWEILIUCC
Copy link

Description

Fix IndexError that occurs when using batch_size > 1 in get_transfer_index_dynamic function.

Problem

When batch_size > 1, different samples may have different numbers of masked tokens. If a sample has no masked tokens (num_transfer_tokens[j] == 0), the threshs list becomes empty, causing an IndexError when accessing threshs[0].

Solution

Added a check to skip samples with no masked tokens before accessing the threshs list.

Changes

  • Added if num_transfer_tokens[j] == 0: continue check

…n batch_size > 1

- Add check for empty mask tokens to prevent IndexError
- Handle edge case where num_transfer_tokens[j] == 0

Fixes issue where batch_size > 1 causes IndexError when
accessing threshs[0] on empty list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant