Skip to content

Commit

Permalink
Fix failing MusicgenTest .test_pipeline_text_to_audio (huggingface#…
Browse files Browse the repository at this point in the history
…26586)

* fix

* fix

* Fix

* Fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
ydshieh and ydshieh authored Oct 6, 2023
1 parent 8749942 commit e840aa6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tests/test_pipeline_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`."
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/tiny_model_summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -4151,7 +4151,7 @@
],
"processor_classes": [],
"model_classes": [],
"sha": "37e9ae5dafb601daa8364e9ac17da31cd82b274b"
"sha": "f67d387eaaa7c71ddf88af95eda4bf14ace08d49"
},
"MusicgenForConditionalGeneration": {
"tokenizer_classes": [
Expand All @@ -4161,7 +4161,7 @@
"model_classes": [
"MusicgenForConditionalGeneration"
],
"sha": "b71611b88832e53370e676da53b65042f7fc78ee"
"sha": "16102cdf580e70cf0b4e0e2cda5bc75b934da92c"
},
"MvpForCausalLM": {
"tokenizer_classes": [
Expand Down

0 comments on commit e840aa6

Please sign in to comment.