Closed younesbelkada closed 1 year ago
@younesbelkada I am a little confused on where the list for generate-compatible models is located. I'd like to pick up this issue if I can find it!
Hello @mollerup23 Thanks for your interest, we will update the list with @gante once #21733 gets merged !
@younesbelkada Looks like it will be essentially the same fix across the other models too. Do you want me to pull that fix into a utility function once merged? Just for illustration, something like -
use_cache = should_use_cache(logger, use_cache, self.gradient_checkpointing, self.training)
presents = () if use_cache else None
and likely in modeling_utils.py -
def should_use_cache(logger: Logger, use_cache: bool, gradient_checkpointing: bool, training: bool) -> bool:
if use_cache:
if gradient_checkpointing and training:
logger.warning(
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
)
else:
return True
return False
Was looking into making the fix and realized there would be some repetition so thought I'd ask
Hey @connor-henderson 👋 Thank you for the suggestion! Usually, I'd give the green light to configuration-related DRY approaches such as the one you suggested. However, this one would sit right in forward()
, and we prioritize clear code (= avoid abstractions) in the modeling code itself.
In case you're curious about this position, we have a blog post about why we do it here 🤗
@mollerup23 the list and the instructions are updated, in case you're interested in contributing :D
Would like to take GPT-2!
I want to work on GPT-J!
I would like to work on Blenderbot
Happy to take on Git, GptNeoX, ImageGPT, LED, LongT5, M2M100, Marian, MBart, MegratronBert, MVP, OPT, Pegasus, PegasusX, RemBert, RoFormer
Thanks a mile @KMFODA ! 💯 Feel free to take those, and tag me or @gante whenever you feel ready!
Hi, I am a newbie to open source and would like to contribute. @younesbelkada can I contribute to this issue?
Hey @saswatmeher
Of course yes!!
You can pick up a model that has not been taken yet, for example BioGpt
and do the following:
1- Fork this repository
2- Clone your fork locally and create a new branch git checkout -b fix-bio-gpt-issue
3- Modify the file src/transformers/models/biogpt/modeling_biogpt.py
the same way as all the contributors have modified their files in #21818 #21833 #21815 etc. (You can check Files Changed
on the PR, on the right top of the Pull Request page)
4- Apply these changes and push the changes on your branch
5- Finally open a Pull Request between fix-bio-gpt-issue
and main
branch of transformers
(+ tag us, myself + @gante ) and we should be good to go!
Let us know if you have more questions!
I am happy to pick up other models too. Can I work on Bart, Bert, BigBird.
Hello, can I work on Bloom?
Hi @asrimanth , yes sure you can!
@mollerup23 the list and the instructions are updated, in case you're interested in contributing :D
Great! I'd like to work on OPT
HI @gante working on Whisper XGLM XLMRobertaXL
@mollerup23 hey! OPT was claimed by @KMFODA a few comments above :) Still plenty of models up for grabs, though!
Hello 👋, I would like to contribute and work on T5. Let me know, Thanks! PR for the suggested changes.
@younesbelkada Can I claim TimeSeriesTransformer?
hi @mollerup23 Of course yes! Please feel free to take it!
Hey @krypticmouse! Do you need any help for making the fix on GPT-j?
Hi @younesbelkada, Thanks for asking. My PR got merged long ago.
Thanks for the heads up, just updated the table, the only model left seems to be TimeSeries Transformer then, thank you all for the great contribution!
Hey @younesbelkada, may I work on the TimeSeries Transformer?
@annahung31 I believe @mollerup23 is working on it :) @mollerup23, can you confirm?
yes @gante @annahung31 , the PR is here: https://github.com/huggingface/transformers/pull/22272
Feature request
When using a model that uses
gradient_checkpointing
and if a user wants to callgenerate
withuse_cache
, it leads some models to bugs, such as the one described in https://github.com/huggingface/transformers/pull/21733The fix should be to slightly refactor some models following the same procedure as in the aforementioned PR
How to participate
if
block to the line above the... if use_cache else None
, in the same.forward()
function. Please note that some models may have more than one instance of this block!make fixup
in your shell -- also runmake fix-copies
if it requests you to do so)That's it! With each change, you'll be making
transformers
a little bit better for all of us 💛Models to fix: