-
Notifications
You must be signed in to change notification settings - Fork 899
Whisper: pass processing_class instead of removed tokenizer kwarg #290
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -675,7 +675,7 @@ | |||||
| " train_dataset = train_dataset,\n", | ||||||
| " data_collator = DataCollatorSpeechSeq2SeqWithPadding(processor = tokenizer),\n", | ||||||
| " eval_dataset = test_dataset,\n", | ||||||
| " tokenizer = tokenizer.feature_extractor,\n", | ||||||
| " processing_class = tokenizer.feature_extractor,\n", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the
Suggested change
|
||||||
| " compute_metrics = compute_metrics,\n", | ||||||
| " args = Seq2SeqTrainingArguments(\n", | ||||||
| " # predict_with_generate = True,\n", | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -682,7 +682,7 @@ | |||||
| " train_dataset = train_dataset,\n", | ||||||
| " data_collator = DataCollatorSpeechSeq2SeqWithPadding(processor=tokenizer),\n", | ||||||
| " eval_dataset = test_dataset,\n", | ||||||
| " tokenizer = tokenizer.feature_extractor,\n", | ||||||
| " processing_class = tokenizer.feature_extractor,\n", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the
Suggested change
|
||||||
| " compute_metrics=compute_metrics,\n", | ||||||
| " args = Seq2SeqTrainingArguments(\n", | ||||||
| " # predict_with_generate=True,\n", | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -195,7 +195,7 @@ def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> | |||||
| train_dataset = train_dataset, | ||||||
| data_collator = DataCollatorSpeechSeq2SeqWithPadding(processor = tokenizer), | ||||||
| eval_dataset = test_dataset, | ||||||
| tokenizer = tokenizer.feature_extractor, | ||||||
| processing_class = tokenizer.feature_extractor, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the
Suggested change
|
||||||
| compute_metrics = compute_metrics, | ||||||
| args = Seq2SeqTrainingArguments( | ||||||
| # predict_with_generate = True, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -195,7 +195,7 @@ def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> | |||||
| train_dataset = train_dataset, | ||||||
| data_collator = DataCollatorSpeechSeq2SeqWithPadding(processor = tokenizer), | ||||||
| eval_dataset = test_dataset, | ||||||
| tokenizer = tokenizer.feature_extractor, | ||||||
| processing_class = tokenizer.feature_extractor, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the
Suggested change
|
||||||
| compute_metrics = compute_metrics, | ||||||
| args = Seq2SeqTrainingArguments( | ||||||
| # predict_with_generate = True, | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the
tokenizervariable actually holds the full processor (as indicated byprocessor = tokenizerin the data collator), passingtokenizerdirectly toprocessing_classis highly recommended. If you only passtokenizer.feature_extractor, the trainer will only save the feature extractor configuration (preprocessor_config.json) and will omit the tokenizer configuration files (liketokenizer_config.json,vocab.json, etc.) whentrainer.save_model()is called. Passing the full processor ensures that both the feature extractor and tokenizer are properly saved, making the saved model fully self-contained and ready for inference or resuming training.