Skip to content

Community contribution - BetterTransformer integration for more models! #20372

Closed
huggingface/optimum
#542

Description

@younesbelkada

BetterTransformer integration for more models!

BetterTransformer API provides faster inference on CPU & GPU through a simple interface!

Models can benefit from very interesting speedups using a one liner and by making sure to install the latest version of PyTorch. A complete guideline on how to convert a new model has been created on the BetterTransformer documentation!

Here is a list of models that could be potentially supported, pick one of the architecture below and let's discuss about the conversion!

Text models 🖊️ :

Vision models 📷 :

Audio models 🔉 :

Let us also know if you think that some architectures can be supported that we missed. Note that for encoder-decoder based models below, we expect to convert the encoder only.

Support for decoder-based models coming soon!

cc @michaelbenayoun @fxmarty

huggingface/optimum#488

Activity

  1. hamishdickson commented on Nov 22, 2022

    @hamishdickson

    NotImplementedError: The Better Transformers implementation for the model DebertaV2Model has not beenimplemented yet. Please open an issue requesting the addition of this model with its BetterTransformerimplementation.

    It's not on your list, but would you complain if I did this for DebertaV2Model?

  2. michaelbenayoun commented on Nov 22, 2022

    @michaelbenayoun
    Member

    It is not in the list because DebertaV2 does not have a regular attention mechanism, so it is not possible to use it with BetterTransformer.

  3. younesbelkada commented on Nov 22, 2022

    @younesbelkada
    ContributorAuthor

    Yes I second what @michaelbenayoun said, please see related: huggingface/optimum#487

  4. hamishdickson commented on Nov 22, 2022

    @hamishdickson

    makes a lot of sense - sorry I should have thought about that a bit harder before posting!

  5. GenVr commented on Nov 23, 2022

    @GenVr

    I noticed that Better Transformers for the T5 model has not been implemented yet. Will it be implemented in the future (if possible)? Thanks.

  6. younesbelkada commented on Nov 23, 2022

    @younesbelkada
    ContributorAuthor

    Hi @GenVr
    Thanks a lot for your reply! Unfortunately T5 cannot be supported because of the nature of its attention mechanism. In fact T5 uses attention bias and this is not supported for BetterTransformer
    Thanks!

  7. RJZauner commented on Nov 25, 2022

    @RJZauner

    Hi :) I would like to work on the implementation for RemBertLayer.

    What are the next steps in getting started?

    Thank you!

  8. younesbelkada commented on Nov 25, 2022

    @younesbelkada
    ContributorAuthor

    Hey @RJZauner !
    Thanks so much for your interest in helping us integrating more models for BetterTransformer !
    RemBert seems to use the same attention mechanism as BERT, the only difference should be on the Embedding layer, which is fine for us! So I would say you can move ahead and start forking optimum library, create a new branch and open a draft PR. Feel free to have some inspiration from what has been done by huggingface/optimum#494 and huggingface/optimum#508 to see what exactly needs to be done ;) Ping us (myself, @michaelbenayoun & @fxmarty) whenever you feel that you need help!

  9. shogohida commented on Nov 25, 2022

    @shogohida
    Contributor

    Hi @younesbelkada, I would like to work on the easiest of the models mentioned above. Which one do you recommend? What I said might sound a bit weird but I want to tackle a simple one since I'm not very familiar with these models 🙏

  10. JuheonChu commented on Nov 25, 2022

    @JuheonChu
    Contributor

    Hello, I would like to tackle the implementation for TapasLayer.

    May I ask you how I can start the further steps?

    Thank you for your time.

  11. michaelbenayoun commented on Nov 25, 2022

    @michaelbenayoun
    Member

    Hi @shogohida and @JuheonChu ,

    You can read this page for learning how to contribute. You can then open a PR with your code, and ask questions there, we will be glad to help!

    Also @shogohida, I think they are all similar in terms of difficulty, so do not block on that, maybe choose a model with the modality the most familiar to you.

  12. younesbelkada commented on Nov 25, 2022

    @younesbelkada
    ContributorAuthor

    Seconding what @michaelbenayoun said, feel free to check some example PRs huggingface/optimum#508 or huggingface/optimum#494 for reference!
    @shogohida , you can take RocBERT, actually it copies from Bert so the conversion will be very easy :)

  13. shogohida commented on Nov 25, 2022

    @shogohida
    Contributor

    Thanks guys for your replies! I will take RocBERT then!

  14. JuheonChu commented on Nov 25, 2022

    @JuheonChu
    Contributor

    Thanks @michaelbenayoun ! I will take TapasLayer !

  15. 54 remaining items

  16. dewasahu2003 commented on May 4, 2023

    @dewasahu2003
    Contributor

    @younesbelkada Hey 👋

    I have submitted the pr for BetterTransformer for detr
    I mentioned you there PR
    From next time i would keep in mind to ask pr authors

  17. mobley-trent commented on May 8, 2023

    @mobley-trent

    Hi, @younesbelkada I'd like to work on ProphetNet 😀

  18. mszsorondo commented on May 8, 2023

    @mszsorondo

    @younesbelkada I would like to work on Detr.

    @mszsorondo Are you still working on it? There has not been any activity on your PR since Jan 8. I can pull from your PR and fix the failing tests.

    Go for it! Sorry for the delay

  19. Jack-Chuang commented on May 27, 2023

    @Jack-Chuang

    Hi @younesbelkada, @michaelbenayoun, and @fxmarty,

    I would like to work on Speech2TextLayer.

    What are the next steps in getting started?

    Thank you!

  20. jucamohedano commented on May 27, 2023

    @jucamohedano

    Hi! @younesbelkada @michaelbenayoun @fxmarty
    I'm interested in adding support for one of the models in the list. Although, I believe that the only model left might be Speech2TextLayer and has been claimed by @Jack-Chuang

  21. mobley-trent commented on May 28, 2023

    @mobley-trent

    Hello @younesbelkada @fxmarty and @michaelbenayoun
    I would like to work on the RoFormer layer since I saw that someone had already worked on ProphetNet. Has the model been claimed ?

  22. RoboTuan commented on Jun 11, 2023

    @RoboTuan

    Hello @younesbelkada @fxmarty and @michaelbenayoun
    I would love to help you with the integration of more models for BetterTransformer! I'm happy to take what is left since a lot of developers are already contributing to most of the models I think. Let me know if I can still help with something!

  23. mohammedElfatihSalah commented on Jun 29, 2023

    @mohammedElfatihSalah

    @younesbelkada is there anything I can help with in this issue?

  24. deepwilson commented on Sep 20, 2023

    @deepwilson

    @younesbelkada please could you update the original list of pending items?
    Or has this project been stalled?

  25. sam-h-bean commented on Sep 27, 2023

    @sam-h-bean
    Contributor

    Is splade possible?

  26. adeepbiswas commented on Oct 6, 2023

    @adeepbiswas

    Hi @younesbelkada,
    Can I take up ProphetNet task? I'm new to open source and might take some time but eager to try my hands at this.

  27. younesbelkada commented on Oct 6, 2023

    @younesbelkada
    ContributorAuthor

    Hi everyone,
    Sorry for the delay in replying to this issue and community contribution - we had some internal discussion and we decided to migrate the BetterTransformer API into transformers core by directly supporting torch.scaled_dot_product_attention in the modeling files. Check out this issue: #26557 for more details and this PR for the PoC: #26572
    We will possibly open a community contribution for that to extend the support for all architectures but not sure. I will keep you all posted!
    Thanks again for all your effort and amazing contribution! 🎉

  28. vu0607 commented on Jan 24, 2024

    @vu0607

    Hi @younesbelkada, @michaelbenayoun, and @fxmarty
    The model type vision-encoder-decoder is not yet supported to be used with BetterTransformer !!!
    Hope you to support soon <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions