Fix failing MusicgenTest .test_pipeline_text_to_audio (#26586)

* fix

* fix

* Fix

* Fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar 2023-10-06 15:53:59 +02:00 committed by GitHub
parent 87499420bf
commit e840aa67e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -502,8 +502,12 @@ def validate_test_components(test_case, task, model, tokenizer, processor):
if tokenizer is not None:
config_vocab_size = getattr(model.config, "vocab_size", None)
# For CLIP-like models
if config_vocab_size is None and hasattr(model.config, "text_config"):
config_vocab_size = getattr(model.config.text_config, "vocab_size", None)
if config_vocab_size is None:
if hasattr(model.config, "text_config"):
config_vocab_size = getattr(model.config.text_config, "vocab_size", None)
elif hasattr(model.config, "text_encoder"):
config_vocab_size = getattr(model.config.text_encoder, "vocab_size", None)
if config_vocab_size is None and model.config.__class__.__name__ not in CONFIG_WITHOUT_VOCAB_SIZE:
raise ValueError(
"Could not determine `vocab_size` from model configuration while `tokenizer` is not `None`."

View File

@ -4151,7 +4151,7 @@
],
"processor_classes": [],
"model_classes": [],
"sha": "37e9ae5dafb601daa8364e9ac17da31cd82b274b"
"sha": "f67d387eaaa7c71ddf88af95eda4bf14ace08d49"
},
"MusicgenForConditionalGeneration": {
"tokenizer_classes": [
@ -4161,7 +4161,7 @@
"model_classes": [
"MusicgenForConditionalGeneration"
],
"sha": "b71611b88832e53370e676da53b65042f7fc78ee"
"sha": "16102cdf580e70cf0b4e0e2cda5bc75b934da92c"
},
"MvpForCausalLM": {
"tokenizer_classes": [