Skip to content
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

VisualBertOnnx #663

Closed
wants to merge 8 commits into from
Closed

Conversation

mszsorondo
Copy link
Contributor

What does this PR do?

Start implementing VisualBERT for Onnx exporting

Pending:

Implement outputs
Executing one export for each VisualBERT implementation
VisualBertDummyInputGenerator

Questions

@fxmarty @younesbelkada I would appreciate any help with this

  1. Is inputs() is correctly implemented?

>>> base_model = AutoModel.from_pretrained("uclanlp/visualbert-vqa")

raises the following warning:

Some weights of the model checkpoint at uclanlp/visualbert-vqa were not used when initializing VisualBertModel: ['cls.weight', 'cls.bias']
- This IS expected if you are initializing VisualBertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing VisualBertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).

So this is not expected, any hint on how to solve this?

Fixes #555 (issue)

…) correctness and doing export for every vbert task
…) correctness and doing export for every vbert task
@fxmarty
Copy link
Contributor

fxmarty commented Jan 2, 2023

Looks good to me so far! Maybe you'll just run into the issue that DummyTextInputGenerator and DummyVisionInputGenerator will probably not accept the inputs (in SUPPORTED_INPUT_NAMES), as we discussed in the issue.

For 2., I guess it's because of a head in VisualBertForQuestionAnswering that is not used in the base model: https://github.com/huggingface/transformers/blob/588faad1062198e45cf3aebed21dc1fc1e1ed0d7/src/transformers/models/visual_bert/modeling_visual_bert.py#L1184 . If it is just for testing purposes, the warnings are expected. Otherwise you can try base_model = AutoModelForQuestionAnswering.from_pretrained("uclanlp/visualbert-vqa"), or try this dummy model for testing: https://huggingface.co/hf-internal-testing/tiny-random-VisualBertModel

fxmarty and others added 6 commits January 3, 2023 17:34
* improve doc

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

Co-authored-by: Michael Benayoun <[email protected]>

* fix reference to ortmodel

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

* Update docs/source/exporters/onnx/usage_guides/export_a_model.mdx

Co-authored-by: Michael Benayoun <[email protected]>
* get_exporter_config_constructor and export parameter order updated + added 1 missing import

* Update docs/source/exporters/onnx/usage_guides/contribute.mdx

Co-authored-by: fxmarty <[email protected]>

Co-authored-by: fxmarty <[email protected]>
…) correctness and doing export for every vbert task
…) correctness and doing export for every vbert task
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 4, 2023

The documentation is not available anymore as the PR was closed or merged.

@fxmarty
Copy link
Contributor

fxmarty commented Jan 4, 2023

Hi @mszsorondo , not sure why these two show in the commit history but it should probably not:

image

Github commit history / diff is sometimes bugged on PRs, but maybe something is messed up?

@mszsorondo
Copy link
Contributor Author

mszsorondo commented Jan 4, 2023

@fxmarty
This is indeed strange, those two commits were from a different PR, and there are some commits that are repeated and I don't remember pushing them again. Maybe I accidentally touched some command or it is a Github bug. I also see some of the tests failed.
I'll open a new draft PR from a new branch and commit the changes more separately so that the history is clear.

@fxmarty
Copy link
Contributor

fxmarty commented Jan 4, 2023

@mszsorondo All good! for the check_code_quality test, you will just need to run make style. For the rest you would have to check in "details" what's wrong. It appears it is that it's missing args in the CLI for the shapes.

@mszsorondo
Copy link
Contributor Author

@fxmarty moved to draft PR #672

@mszsorondo mszsorondo closed this Jan 5, 2023
@mszsorondo mszsorondo deleted the VisualBERTONNX branch August 11, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community contribution - optimum.exporters.onnx support for new models!
3 participants