Skip to content

Conversation

@anton-l
Copy link
Member

@anton-l anton-l commented Sep 1, 2021

Quick fix to allow Hubert models to auto-load Wav2Vec2FeatureExtractor.

Caught this while trying to load Hubert without an explicit feature extractor in pipeline("audio-classification")



_import_structure = {
".wav2vec2.feature_extraction_wav2vec2": ["Wav2Vec2FeatureExtractor"],
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO - this is ok. What do you think @sgugger ? In short we need to make HuBERT work with AutoFeatureExtractor and it uses the exact same feature extractor than Wav2Vec2. Either we import Wav2Vec2 here or we add a hack to how feature extractors are loaded in models/auto/modeling_auto_feature_extractor.py WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is less hacky than what we did with MT5. Works for me.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Not super happy with the result but this is the simplest we got with the current way the Auto API is implemented. We could think of a way to deal with those duplicates processors/tokenizers in the future, if we are more use cases like this one.

Thanks for the PR!



_import_structure = {
".wav2vec2.feature_extraction_wav2vec2": ["Wav2Vec2FeatureExtractor"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is less hacky than what we did with MT5. Works for me.

@anton-l anton-l merged commit 2406892 into huggingface:master Sep 1, 2021
@anton-l anton-l deleted the fix-hubert-pipeline branch September 8, 2021 21:06
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.

3 participants