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
Nvfuser python API import fix #94036
Nvfuser python API import fix #94036
Conversation
jjsjann123
commented
Feb 3, 2023
- Having nvfuser python API import working with both devel and upstream;
- Add environment variable to allow custom nvfuser code base to be built with upstream pytorch core.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/94036
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 23638af: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This would help our internal container nightly build to merge the nvfuser & pytorch container. |
this will need a lint fix - maybe there's a way to skip that check for these import locations? I'll give @malfet a chance to comment on the other change |
Ah, the python import is done lazily in pytorch and that seems to be ok... Let me patch these. |
torch/_prims/nvfuser_executor.py
Outdated
@@ -20,11 +20,12 @@ | |||
|
|||
if torch.cuda.is_available(): | |||
import nvfuser | |||
from packaging.version import Version | |||
from packaging.version import Version # type: ignore[import] |
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'm not sure about this repo's way of importing packaging
module. at glance,
pytorch/test/onnx/test_verification.py
Line 14 in d2b82fe
from packaging import version |
pkg_resources
or #71902
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.
Yeah I think upstream relies on pkg_package in absence of packaging
, tho I don't know what the difference is. I think I can use the lazy import from torch_version.py to handle this instead.
I'm not sure about the dependency between that with prim. We'll see if it breaks anything 🤞
Will ping you once I have it updated.
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.
switched to torch.torch_version.Version instead. Local testing seems to be working fine.
@davidberard98 Do we still have concern on this PR? |
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.
Please use more pythonic paradigms(rather then version checks) to check whether old or new nvfuser is around
No idea what's wrong the the linter failing. Looks like infra issue. I'll restart it later. |
Patched a linter error that was missed. CI looks good from previous run otherwise. |
CI looks green~~ 🥳 pinging @malfet to approve changes per request |
Bumping for update. cc'ing @malfet |
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.
looks like @malfet's requested changes have been resolved
@pytorchbot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
….Version to avoid extra dependency
move from hasattr to pythonic import Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com>
Successfully rebased |
98a5bcd
to
23638af
Compare
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
This reverts commit 21eb7f7.
1. Having nvfuser python API import working with both devel and upstream; 2. Add environment variable to allow custom nvfuser code base to be built with upstream pytorch core. Pull Request resolved: pytorch#94036 Approved by: https://github.com/malfet, https://github.com/davidberard98