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
Circular imports when importing einops and torch._dynamo #315
Comments
Hi @befelix , thank you for reporting, there is a circular import problem that we need to address. step-by-step what happens in
|
Seems this torch PR was trying to address the problem, but that didn't quite work: Fix wouldn't work it seems: einops needs |
Should we delete the special einops handling from |
it is preferrable to defer that logic to 'on first compile' (or when torch._dynamo is fully imported) Otherwise, we better just delete that handling code - it wouldn't work as intended |
See arogozhnikov/einops#315 ghstack-source-id: e5ad8f6da07887b7290fbae8c42af237a33dfbcb Pull Request resolved: #124084
Can you check if this fixes it: pytorch/pytorch#124084 |
See arogozhnikov/einops#315 Pull Request resolved: #124084 Approved by: https://github.com/peterbell10
Thank you @jansel for merging that. I can confirm nightly torch==2.4.0.dev20240420+cpu does not have this issue. Before fix comes live users need to use manual registration of functions: |
See arogozhnikov/einops#315 Pull Request resolved: #124084 Approved by: https://github.com/peterbell10
See arogozhnikov/einops#315 Pull Request resolved: pytorch#124084 Approved by: https://github.com/peterbell10
See arogozhnikov/einops#315 Pull Request resolved: pytorch#124084 Approved by: https://github.com/peterbell10
See arogozhnikov/einops#315 Pull Request resolved: pytorch#124084 Approved by: https://github.com/peterbell10
Describe the bug
Importing
einops
beforetorch._dynamo
currently leads to warnings. I'm not sure if this needs a fix on thepytorch
oreinops
side. This is annoying for CI pipelines, where warnings are typically treated as errors. Note that, with sorted imports,einops
will typically import before anytorch
namespaces.Reproduction steps
Steps to reproduce the behavior:
Expected behavior
No output, import order does not matter.
Your platform
Ubuntu 22.04,
torch==2.2.2
,einops==0.7.0
The text was updated successfully, but these errors were encountered: