Skip to content
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 broken torch._inductor.config import #104477

Closed
wants to merge 1 commit into from

Conversation

huydhn
Copy link
Contributor

@huydhn huydhn commented Jun 30, 2023

This fixes the bug in profiler code exposed by #104368 that introduced on the fact that import torch._dynamo also imports torch._inductor.config:

$ python -c "import torch._inductor;print(torch._inductor.config)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'torch._inductor' has no attribute 'config'
(base) $ python -c "import torch._dynamo;print(torch._inductor.config)"
<module 'torch._inductor.config' from '/home/nshulga/git/pytorch/pytorch/torch/_inductor/config.py'>

Testing

D47159397

Summary: The test is failing with `module 'torch._inductor' has no attribute 'config'` error after lazy import `_inductor`. So DK is trying to revert it D47150544. https://www.internalfb.com/intern/sandcastle/job/18014399494319443

Test Plan: `buck2 test 'fbcode//mode/opt-split-dwarf' fbcode//aps/trainer/plugin/tests:gpu_tracer_test -- --exact 'aps/trainer/plugin/tests:gpu_tracer_test - test_consistent_metric_collecting_regardless_of_memory_usage (aps.trainer.plugin.tests.gpu_tracer_test.GpuTracerTest)'`

Differential Revision: D47159397

fbshipit-source-id: ec8cbc4dffe654478473776ba0a38f70621c24a0
@pytorch-bot
Copy link

pytorch-bot bot commented Jun 30, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/104477

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 1928a0b:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47159397

@huydhn huydhn requested a review from malfet June 30, 2023 19:10
@huydhn huydhn added the topic: not user facing topic category label Jun 30, 2023
@huydhn huydhn changed the title Fix broken torch._inductor.config import after D47115935 Fix broken torch._inductor.config import after #104368 Jun 30, 2023
Copy link
Member

@aaronenyeshi aaronenyeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix!

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix, investigating how it's worked in the past (as torch._inductor indeed does not have a config module, it needs to be explicitly imported.

@huydhn huydhn changed the title Fix broken torch._inductor.config import after #104368 Fix broken torch._inductor.config import Jun 30, 2023
@huydhn
Copy link
Contributor Author

huydhn commented Jun 30, 2023

Confirm with @malfet that this is not related to the lazy import #104368, but it's a legit bug anyway so this would fix the issue. Ideally, we need to have a test on OSS to capture this case.

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 1, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants