Skip to content
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

[Wav2Vec2] Rename model's feature extractor to feature encoder #14959

Conversation

patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Dec 28, 2021

What does this PR do?

In this PR all <SpeechModel>FeatureExtractor are renamed to <SpeechModel>FeatureEncoder and --freeze_feature_extractor is renamed to --freeze_feature_encoder

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@patrickvonplaten patrickvonplaten changed the title [Wav2Vec2] Correct wav2vec2 feature extractor naming [Wav2Vec2] Rename model's feature extractor to feature encoder Dec 28, 2021
@patrickvonplaten patrickvonplaten force-pushed the correct_wav2vec2_feature_extractor_naming branch from d530b58 to 5050232 Compare December 28, 2021 12:11
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.

Thanks a lot for doing the switch.

The PR is slightly breaking without a typealias from the old ModelTypeFeatureExtractor to the new ModelTypeFeatureEncoder class, but this is tiny and for an internal class of the modeling file, so I think this is acceptable for recent models (I wouldn't say the same thing for Bert for instance!)

"Please use the equivalent `freeze_feature_encoder` method instead.",
FutureWarning,
)
self.hubert.feature_extractor._freeze_parameters()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good practice is to call the method that will replace it, so if you change code there for some reason, the code is automatically up to date.

Putting it just here once, but it's valid for all other models.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for doing the switch.

The PR is slightly breaking without a typealias from the old ModelTypeFeatureExtractor to the new ModelTypeFeatureEncoder class, but this is tiny and for an internal class of the modeling file, so I think this is acceptable for recent models (I wouldn't say the same thing for Bert for instance!)

Yeah good point - will actually leave an alias

@patrickvonplaten patrickvonplaten merged commit 600496f into huggingface:master Dec 28, 2021
@patrickvonplaten patrickvonplaten deleted the correct_wav2vec2_feature_extractor_naming branch December 28, 2021 19:33
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jan 6, 2022
…ngface#14959)

* rename classes

* clean up more namings

* remove bogus file

* Apply suggestions from code review

* Apply suggestions from code review

* replace more names

* more regex replace

* make style

* correct

* correct more

* make style

* finish

* correct more in wav2vec2

* make style

* improve freeze_extractor

* add aliases

* add tf aliases
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