-
Notifications
You must be signed in to change notification settings - Fork 487
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
move check_dummy_inputs_allowed to common export utils #2114
move check_dummy_inputs_allowed to common export utils #2114
Conversation
@echarlaix @IlyasMoutawwakil could you please review? |
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 ! Thanks !
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
together with huggingface/optimum-intel#1048 and huggingface/optimum#2114 allow me run wwb with already exported models on windows platform
import onnx | ||
from transformers.utils import is_accelerate_available, is_torch_available | ||
|
||
from ...onnx import remove_duplicate_weights_from_tied_info | ||
|
||
|
||
if is_torch_available(): | ||
import torch.nn as nn | ||
|
||
from ...onnx import merge_decoders |
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.
would prefer to keep import there, why moving ?
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.
merge_decoders imported from graph_transformations submodule that contains onnx import
https://github.com/huggingface/optimum/blob/main/optimum/onnx/graph_transformations.py#L19
as this file heavily depends on onnx functionality, while merge decoders used only for specific configs postprocessing triggered only if specific config behaviour is selected, I think it may be better to allow use other functional from this module without necessarily to use onnx import.
As I said there is case, when import onnx crashed on windows. This file contains basic functionality for configs that we also reuse for enabling new models in optimum-intel moving this import allow us continue usage of base config classes even if onnx broken
What does this PR do?
check_dummy_inputs_allowed
is helpful function for any optimum that involves pytorch models conversion (e.g. openvino). Current place of it import trigger initialization of full onnx configuration for other backends that wish to reuse it and it may lead to some troubles with resolving dependencies. I suggest to move it to common utilities for avoiding unexpected errors like represented bellow:Example of logs (issue visible on windows with onnx>1.16.2 and related to onnx/onnx#6267):
workaround for this problem also proposed on optimum-intel side huggingface/optimum-intel#1048