-
Notifications
You must be signed in to change notification settings - Fork 350
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: Repair version checking system for Torch #2118
Conversation
py/torch_tensorrt/__init__.py
Outdated
@@ -94,7 +94,11 @@ def _find_lib(name, paths): | |||
|
|||
from torch_tensorrt import fx | |||
|
|||
if version.parse(torch.__version__) >= version.parse("2.1.dev"): | |||
if version.parse( | |||
torch.__version__ |
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.
Make a little macro function in utils that just returns the cleaned torch version
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.
Something like
# //py/torch_tensorrt/_utils.py
import torch
def sanitized_torch_version() -> str:
return torch.__version__ if ".nv" not in torch.__version__ else torch.__version__.split(".nv")[0]
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.
Could this function instead go in py/torch_tensorrt/_version.py
, to avoid the from torch_tensorrt import _C
which occurs in the py/torch_tensorrt/_util.py
file?
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.
_version.py gets generated by setup.py so probably not a great choice, but i dont really care where it goes, could go in __init__.py
or somewhere else
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.
Alternatively, we probably should be moving _C dep code into .ts anyway. Half the functions could probably be reimplemented without _C
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.
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 think lets put it in _util.py with an AI to move the _C code out pre 2.1
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.
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 makes sense, I can add the task. I did some minor refactoring of _util.py
in this PR since it was a minimal change. Let me know if this change is within the scope of the PR/is favorable.
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.
d07a815
to
a8df33a
Compare
- Move _C utilities into `ts` directory - Address version parsing issue for NV versions of Torch - Add specialized check for NV Torch versions such as `2.0.0.nv23.05`
a8df33a
to
38a2c4c
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
Description
ts
directory2.0.0.nv23.05
Versions such as
2.0.0.nv23.05
are incompatible with thepackaging.version
semantic style, and cause invalid version errors upon parsing. Adapting the solution proposed in #2112, we are able to resolve this issue by removing the specialized portion of the version, leaving only the major, minor, and patch values (x.y.z
).Fixes #2112
Type of change
Checklist: