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

Fixing m4t. #27240

Merged
merged 5 commits into from
Nov 2, 2023
Merged

Fixing m4t. #27240

merged 5 commits into from
Nov 2, 2023

Conversation

Narsil
Copy link
Contributor

@Narsil Narsil commented Nov 2, 2023

What does this PR do?

Fixed m4t which had a disparity in configuration for SpeechToText.

Fixes # (issue)

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.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 2, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@ylacombe ylacombe left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for fixing the issue here and enriching the tests!

I left a comment because I believe we should do the same with SeamlessM4TForSpeechToSpeech, WDYT ?

Comment on lines +3054 to +3056
self.shared = nn.Embedding(config.vocab_size, config.hidden_size, config.pad_token_id)
self.speech_encoder = SeamlessM4TSpeechEncoder(config)
self.text_decoder = SeamlessM4TDecoder(config)
self.text_decoder = SeamlessM4TDecoder(config, self.shared)
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand it correctly, this should also appears on the SeamlessM4TForSpeechToSpeech class right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oddly enough, the shared part is not defined in the Speech Encoder/Decoder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with the models, but Iḿ guessing the text vocabulary is not needed there.

Copy link
Contributor

Choose a reason for hiding this comment

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

The speech encoder doesn't have an embedding layer so need for a shared embeddings with it. The text decoder still needs it though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You were correct I didn't read properly that model I Supposed the SpeechDecoder decoded directly to voice, but it's actually being vocoded from the text, you are correct. However my tests do pass locally... Very odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OMG the test passes on CUDA but not CPU..... Witchcraft

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me know if I can help you here

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Thank you @Narsil ! Will merge when green

@LysandreJik LysandreJik merged commit 8801861 into main Nov 2, 2023
@LysandreJik LysandreJik deleted the fix_m4t branch November 2, 2023 14:32
@LysandreJik
Copy link
Member

Thanks @Narsil!

EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
* Fixing m4t.

* Trying to remove comparison ? Odd test failure.

* Adding shared. But why on earth does it hang ????

* Putting back the model weights checks the test is silently failing on
cuda.

* Fix style + unremoved comment.
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.

4 participants