-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix: move onnxruntime import to function scope #204
Conversation
|
||
from onnxscript import autocast, irbuilder, onnx_opset, tensor, utils, values | ||
|
||
if typing.TYPE_CHECKING: | ||
import onnxruntime as ort |
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.
Just wondering: why is this necessary?
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 is for type annotation (for _cache_models
). ort will be imported by type checkers but not in run time, so we don't fail if the environment doesn't have ort.
238f0b4
to
23b7e9f
Compare
Codecov Report
@@ Coverage Diff @@
## main #204 +/- ##
==========================================
- Coverage 75.50% 75.50% -0.01%
==========================================
Files 89 89
Lines 7198 7201 +3
==========================================
+ Hits 5435 5437 +2
- Misses 1763 1764 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Move ort import into functions so onnx script still works without ort. This is also more friendly for new potential evaluators that do not require ORT.
fixes: #81