-
Notifications
You must be signed in to change notification settings - Fork 490
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
Enable export of model with fixed shape #1643
Conversation
optimum/exporters/onnx/__main__.py
Outdated
if library_name == "timm" and no_dynamic_axes is False and "vovnet" in model_type: | ||
raise ValueError( | ||
f"The export of {model_type} is not supported with dynamic axes. Please pass --no-dynamic-axes to export the model with fixed shapes" | ||
) |
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.
I wonder rather avoid adding more model-specific code in here. Is it possible to move it elsewhere (like model_configs.py
)?
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.
This could not be possible, as the variable (no_dynamic_axes
) is not under the scope of model_configs.py.
For now I have removed this from here. In documentation, it is mentioned that the following architecture support is limited.
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.
Can you write a test to test that when specifying shapes for the dummy inputs with no dynamic axes requested, the proper shapes are used in the exported model?
optimum/exporters/onnx/__main__.py
Outdated
@@ -444,6 +447,11 @@ def main_export( | |||
f" `--task {task_non_past} --monolith`, or `--task {task}` without the monolith argument." | |||
) | |||
|
|||
if library_name == "timm" and no_dynamic_axes is False and "vovnet" in model_type: |
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.
if library_name == "timm" and no_dynamic_axes is False and "vovnet" in model_type: | |
if library_name == "timm" and not no_dynamic_axes and "vovnet" in model_type: |
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.
Added a small test, testing only a few models from transformers
and vovnet
from timm. This should be sufficient to see if it functionally works.
Should we extend testing to cover all supported models?
9d2e762
to
b1af6f3
Compare
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.
LGTM
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.
LGTM
What does this PR do?
Enable export of the models with fixed shapes.
This is required to support export of model like "vovnet" which cannot be exported with dynamic shapes.
optimum-cli export onnx --model timm/ese_vovnet39b.ra_in1k out_vov --no-dynamic-axes
Before submitting