Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eval] fix check for language arg #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[eval] fix check for language arg #139

wants to merge 1 commit into from

Conversation

sanchit-gandhi
Copy link
Collaborator

@sanchit-gandhi sanchit-gandhi commented Jun 18, 2024

Fixes distil-medium.en/discussions/14 by re-ordering the set-up steps such that we:

  1. Set the generation config args, throwing an error if we get a language arg for an English-only checkpoint
  2. Define the normalizer after the generation config is set

Doing 1 before 2 means we can be certain here that if the language arg is passed, we are dealing with a multilingual checkpoint.

# We need to read the audio files as arrays and tokenize the targets.
audio_column_name = data_args.audio_column_name
language = language_to_id(data_args.language, model.generation_config) if data_args.language else None
Copy link
Collaborator Author

@sanchit-gandhi sanchit-gandhi Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue previously was that we could have passed the language arg for an English-only checkpoint, which is invalid. We now check this case first, and then set the normalizer afterwards

Comment on lines +570 to +574
elif data_args.language is not None:
raise ValueError(
"Setting language token for an English-only checkpoint is not permitted. The language argument should "
"only be set for multilingual checkpoints."
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informative error that will be thrown if language is passed but the checkpoint is English-only

@sanchit-gandhi sanchit-gandhi requested a review from eustlb June 25, 2024 10:14
Copy link
Collaborator

@eustlb eustlb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solve this edge case but also improves readability, thanks @sanchit-gandhi !

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.

2 participants