Closed younesbelkada closed 11 months ago
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
BetterTransformer
implementation.
It's not on your list, but would you complain if I did this for DebertaV2Model?
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.
Yes I second what @michaelbenayoun said, please see related: https://github.com/huggingface/optimum/issues/487
makes a lot of sense - sorry I should have thought about that a bit harder before posting!
I noticed that Better Transformers for the T5 model has not been implemented yet. Will it be implemented in the future (if possible)? Thanks.
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!
Hi :) I would like to work on the implementation for RemBertLayer.
What are the next steps in getting started?
Thank you!
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 https://github.com/huggingface/optimum/pull/494 and https://github.com/huggingface/optimum/pull/508 to see what exactly needs to be done ;) Ping us (myself, @michaelbenayoun & @fxmarty) whenever you feel that you need help!
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 🙏
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.
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.
Seconding what @michaelbenayoun said, feel free to check some example PRs https://github.com/huggingface/optimum/pull/508 or https://github.com/huggingface/optimum/pull/494 for reference! @shogohida , you can take RocBERT, actually it copies from Bert so the conversion will be very easy :)
Thanks guys for your replies! I will take RocBERT then!
Thanks @michaelbenayoun ! I will take TapasLayer !
Hi! Thank you so much for opening this issue.
Hello @younesbelkada,
I would like to take DetrLayer. Nice tutorial btw 😀
Hi @blakechi ! Sure you can take it ;) let me know if you need help opening a PR!
Hi @ravenouse ! Thanks for your help! Yes you can take MBART ;) Regarding the dead link could you open an issue at optimum? Thanks!
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!
Thank you for the info!
Hello @michaelbenayoun and @younesbelkada !
First time contributing for me :)
I would like to handle the implementation for Speech2Text
What are the first steps ? Create a PR ?
Thanks in advance.
Hello @michaelbenayoun and @younesbelkada !
First time contributing for me :)
I would like to handle the implementation for Speech2Text
What are the first steps ? Create a PR ?
Thanks in advance.
Hello, I am absolutely sure that they will give you a better suggestion than what I have.
I would like to share that it is good to read CONTRIBUTING.md
in the transformer repository.
I read through every content very carefully and made my first contribution!
Hello @michaelbenayoun and @younesbelkada ! First time contributing for me :) I would like to handle the implementation for Speech2Text What are the first steps ? Create a PR ? Thanks in advance.
Hello, I am absolutely sure that they will give you a better suggestion than what I have. I would like to share that it is good to read
CONTRIBUTING.md
in the transformer repository. I read through every content very carefully and made my first contribution!
Hello @JuheonChu :)
I am definitely have a look at it ! thanks
Hi @lucaspct,
Yes the first steps would be to read the guide explaining how to contribute to optimum.bettertransformer
, and then opening a PR on Optimum, we will support you there!
Hi @younesbelkada @michaelbenayoun I'd love to take on the RoFormer model if it isn't claimed yet. Will open a PR after I read through the guide!
I would like to take a crack at the ProphetNet encoder if it has not been claimed yet
Thank you very much @miyu386 & @adit299 !
Of course yes you can give a try on that ;) feel free to start to open a PR on optimum
and we'll guide you from there 💪
I would like to work on the ASTLayer
if no one has taken it!
Hi @younesbelkada I'd like to tackle the FlavaLayer
if it has not been taken!
Hi @katiele47 Sure no problem! Feel free to open a PR and tag us there! I will update the table above once the PRs are open ;)
Hi, @younesbelkada I'd like to take GLPNLayer
if no one has claimed it. will open the PR soon for this :)
Hi @hazrulakmal ! Sure! Let me know once you open the PR ;)
Hi! I'd love to contribute wherever I can be useful.
Hi @younesbelkada !
I found the torch._transformer_encoder_layer_fwd()
function is called to execute forwarding in our BetterTransformerBaseLayer
. To better understand what's going on under the hood, I searched this function online but didn't find much information about it. Could you tell me where I can check the source code of it?
Thank you so much!
Hello,
I'd like to work on RocBert
layer. I'll go over the contributing guide and open a PR. Anything else I need to go through as a starting point?
Hi @younesbelkada, I added a PR for RemBERT. Since RemBERT's primary changes are in embeddings (decoupling in/output embeddings, increasing output embeddings during pre-training to improve downstream performance, etc), the needed changes should be straightforward. But please kindly let me know if I missed anything.
I also want to apologize to @RJZauner, I realized you've claimed RemBERT after re-reading this thread now. I'll be more careful next time!! And lmk if you want me to withdraw the PR to use your changes instead. If not, feel free to add on top of it and hopefully we can both learn together 🙏🙏.
Hi @M0315G
Thanks so much! Unfortunately this is already a WIP from @shogohida here: https://github.com/huggingface/optimum/pull/542
Feel free to take another model that is free ;) also more models will be added in the list as transformers
is continuing integrating more models
Should I take RoFormer then?
Yes, I think that you can take this one. From my understanding of RoFormer
it consists of a LM similar as BERT, but uses Rotary positional embedding and the attention mechanism is classic, i.e. similar as BERT. Ideally you can double check that too but for me BetterTransformer
should be supported on RoFormer
so I would say that you can take it yes
Understood. Will go through the docs and open a PR in optimum. Any other things I should take care of?
Just take some inspiration from other PRs and everything should go smoothly!
Hi @hchings ! Just reviewed your PR ;) will merge that soon!
Hi @blakechi I saw that you wanted to work on DertLayer a week ago ? How is your progress now? Just asking cus If you are not working on it anymore, I’m more than happy to help you out with the conversion and take over the PR? :)
Hi @hazrulakmal I realized that DPT model (Depth Estimation model) can be supported too as it uses ViT as a backbone. Would you like to give it a try with this one instead? 🙏 We are currently looking at speeding up this model so this will be a nice addition
Hi @younesbelkada, is there any model left that I can work on? Seems like the Detr was claimed a while ago but not sure if there is a PR opened for that.
@younesbelkada yup! definitely. I can take this up! I checked on the encoder layer and it looks possible to integrate with BT, should I name the new class as DPTViTLayerBetterTransformer
?
(encoder): DPTViTEncoder(
(layer): ModuleList(
(0): DPTViTLayer(
(attention): DPTViTAttention(
(attention): DPTViTSelfAttention(
(query): Linear(in_features=32, out_features=32, bias=True)
(key): Linear(in_features=32, out_features=32, bias=True)
(value): Linear(in_features=32, out_features=32, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(output): DPTViTSelfOutput(
(dense): Linear(in_features=32, out_features=32, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)
)
(intermediate): DPTViTIntermediate(
(dense): Linear(in_features=32, out_features=37, bias=True)
(intermediate_act_fn): GELUActivation()
)
(output): DPTViTOutput(
(dense): Linear(in_features=37, out_features=32, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(layernorm_before): LayerNorm((32,), eps=1e-12, elementwise_affine=True)
(layernorm_after): LayerNorm((32,), eps=1e-12, elementwise_affine=True)
)
Very cool! Yes you can name it like this ;) Looking forward to seeing your PR 💪
Hi @miyu386
ViT-Hybrid has just been integrated to transformers
would you like to take this one?
https://github.com/huggingface/transformers/blob/d151a8c55032d5a21800ea0813c4304af8b8e9f7/src/transformers/models/vit_hybrid/modeling_vit_hybrid.py#L362
Hi @younesbelkada, I added a PR for RemBERT. Since RemBERT's primary changes are in embeddings (decoupling in/output embeddings, increasing output embeddings during pre-training to improve downstream performance, etc), the needed changes should be straightforward. But please kindly let me know if I missed anything.
I also want to apologize to @RJZauner, I realized you've claimed RemBERT after re-reading this thread now. I'll be more careful next time!! And lmk if you want me to withdraw the PR to use your changes instead. If not, feel free to add on top of it and hopefully we can both learn together 🙏🙏.
Hey :) don't sweat it - no need to withdraw your PR.
Your implementation looks great - thanks!
@younesbelkada Yes, I'd like to give it a try! Thanks
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
https://github.com/huggingface/optimum/issues/488