Skip to content

[eval] fix check for language arg#139

Open
sanchit-gandhi wants to merge 1 commit into
mainfrom
eval-order
Open

[eval] fix check for language arg#139
sanchit-gandhi wants to merge 1 commit into
mainfrom
eval-order

Conversation

@sanchit-gandhi

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

Copy link
Copy Markdown
Contributor

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.

Comment thread training/run_eval.py
# 8. Preprocessing the datasets.
# 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

@sanchit-gandhi sanchit-gandhi Jun 18, 2024

Copy link
Copy Markdown
Contributor Author

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 thread training/run_eval.py
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
Copy Markdown
Contributor 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

@eustlb eustlb left a comment

Copy link
Copy Markdown
Collaborator

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