[BT] add BetterTransformer support for ViLT architecture#508
Conversation
There was a problem hiding this comment.
Very nice! Thank you very much for adding BetterTransformer support for ViLT model!
I think we need 2 more additional steps before merging:
1- Could you add a new class on the testing suite since the model expected text + image. So inside tests_bettertransformer_vision.py you can just add something like:
ALL_VISION_TEXT_MODELS_TO_TEST = ("hf-internal-testing/tiny-random-ViltModel")
class BetterTransformersViLTTest(BetterTransformersTestMixin, unittest.TestCase):
r"""
Testing suite for Vision Models - tests all the tests defined in `BetterTransformersTestMixin`
"""
all_models_to_test = ALL_VISION_TEXT_MODELS_TO_TEST
def prepare_inputs_for_class(self, model_id=None):
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-ViltModel")
....
return inputs
And tweak the function prepare_inputs_for_class based on this example: https://huggingface.co/dandelin/vilt-b32-finetuned-vqa
2- Can you add the new architecture on the documentation? 🙏 this would require adding just a line here (don't forget to respect the alphabetical order ;) )
Also don't forget to run make style before pushing! ;)
Thanks a bunch!
|
The documentation is not available anymore as the PR was closed or merged. |
Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
BetterTransformer support for ViLT architecture
younesbelkada
left a comment
There was a problem hiding this comment.
Very clean and super fast implementation of ViLT support for BetterTransformer! Thanks also for taking care of slightly refactoring the documentation.
Thanks a lot for adding this, you really did a great job here! 💪
I have nothing to add on my side, gently pinging @fxmarty and @michaelbenayoun for a last review!
|
@younesbelkada Thank you for your support and making this first contribution so smooth 😄 Glad I could help 💪 |
What does this PR do?
Added BetterTransformer support for ViLT architecture.
Added test model for ViltModel.
Tested the conversion of ViltLayer:
To: @younesbelkada @michaelbenayoun @fxmarty