Skip to content

Output hiddens states from all the transformer layers of huggingface_wav2vec#1570

Merged
Adel-Moumen merged 2 commits into
speechbrain:developfrom
BenoitWang:wav2vec2-output
Sep 17, 2022
Merged

Output hiddens states from all the transformer layers of huggingface_wav2vec#1570
Adel-Moumen merged 2 commits into
speechbrain:developfrom
BenoitWang:wav2vec2-output

Conversation

@BenoitWang

Copy link
Copy Markdown
Collaborator

Hello, this PR intends to add an option to ouput all the layers of HuggingFaceWav2Vec2. Some works have shown that different layers of wav2vec/HuBert/WavLM have different impact on different speech tasks. So this change may allow to study this effect.

An attribute output_all_hiddens (default: False) is added:
If True: outputs the hidden states from all transformer layers
If False: outputs the hidden states only from the last transformer layer

@Adel-Moumen Adel-Moumen self-requested a review September 13, 2022 19:40

@Adel-Moumen Adel-Moumen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR!

Please fix some minor issues.

Note: I will refactor the hugging face interface so it might be possible that this code will change in the future.

Comment thread speechbrain/lobes/models/huggingface_wav2vec.py Outdated
Comment thread speechbrain/lobes/models/huggingface_wav2vec.py Outdated
Comment thread speechbrain/lobes/models/huggingface_wav2vec.py Outdated
@BenoitWang

Copy link
Copy Markdown
Collaborator Author

Hi @Adel-Moumen, thanks for the review, the fix is done.

@Adel-Moumen Adel-Moumen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm ! Thanks for the pr. 🤗

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