-
Notifications
You must be signed in to change notification settings - Fork 454
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
Add pix2struct support to ONNX #962
Conversation
@@ -636,6 +636,10 @@ class TasksManager: | |||
"sequence-classification", | |||
onnx="PerceiverOnnxConfig", | |||
), | |||
"pix2struct": supported_tasks_mapping( | |||
"default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably remove the default
here (AutoModel can not load pix2struct), and just have image-to-text
.
The issue is that there is no autoclass in transformers for image-to-text, so we will need to add a way to specify explicitly in tasks.py that for pix2struct the class to use is Pix2StructForConditionalGeneration. Let me do a PR for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -82,6 +82,7 @@ | |||
"hf-internal-testing/tiny-random-language_perceiver": ["masked-lm", "sequence-classification"], | |||
"hf-internal-testing/tiny-random-vision_perceiver_conv": ["image-classification"], | |||
}, | |||
"pix2struct": "google/pix2struct-base", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if you can upload a tiny model to the hub
@arvisioncode The mapping |
Hi @arvisioncode , #967 was merged. You can see I added pix2strcut in a custom class dict optimum/optimum/exporters/tasks.py Line 214 in f7f1ef1
All you need should be to add the entry Then then only thing I am not sure of is whether |
Hello @fxmarty and sorry for the delay in answering... I show you here the traces of executing the tests with
Do you know from which class the pix2struct config should inherit? Any idea how to fix the errors? Thank you so much! |
This PR adds support for pix2struct models to be exported to ONNX format.
Before submitting