forked from pytorch/audio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BC-Breaking] Move fine-tune specific module out of wav2vec2 encoder (p…
…ytorch#1782) Previously, the Linear module (called `readout`, which is used only for an ASR fine-tuning task) was placed in encoder module. Conceptually, the encoder has nothing to do with a module specific to fine-tuning / downstream task. The problems here are that; 1. encoder can be also used in pre-training phase, in which such a module should not present 2. The choice of Linear module is arbitral, and it is inconvenient for users to have hard-coded module structure in encoder. Therefore, this commit moves the Linear module out the encoder, and places it as `aux` attribute of `Wav2Vec2Model`. (as a result `Wav2Vec2Model` has `feature_extractor`, `encoder` and `aux` attributes.) An alternative approach is to define another module and place `Wav2Vec2Model` and aux module along each other. But that will introduce a new class we need to maintain. The expected use of `aux` is only for 1. loading the pre-trained parameters published by `fairseq` (and it's variations from HF) and 2. creating the same model architectures for comparison experiment. The newly introduced class will not be general enough for downstream adaptations, where there will be a bunch of different more complicated models. (i.e. s3prl) Therefore, based on the minimalistic approach, we put them inside of `Wav2Vec2Model`.
- Loading branch information
Showing
5 changed files
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters