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

Add logging for NO_SUCH_SUBOBJ #125410

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yf225
Copy link
Contributor

@yf225 yf225 commented May 2, 2024

It's difficult to tell where NO_SUCH_SUBOBJ occurs from current log, which happens often during compiled autograd enablement. This PR should help surface more information.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang

Copy link

pytorch-bot bot commented May 2, 2024

🔗 Helpful Links

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

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

❌ 7 New Failures, 1 Unrelated Failure

As of commit ff622d7 with merge base da991fa (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@@ -828,6 +832,7 @@ def var_getattr(self, tx, name):
subobj = self._getattr_static(name)
except AttributeError:
subobj = NO_SUCH_SUBOBJ
log.warning(f"NO_SUCH_SUBOBJ: {self.value} {name}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just log the exception with logging.exception?

@@ -828,6 +832,7 @@ def var_getattr(self, tx, name):
subobj = self._getattr_static(name)
except AttributeError:
subobj = NO_SUCH_SUBOBJ
log.warning(f"NO_SUCH_SUBOBJ: {self.value} {name}")
Copy link
Member

Choose a reason for hiding this comment

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

More user-facing? e.g. "Attribute {name} does not exist on {self.value}, falling back to NO_SUCH_SUBOBJ"

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add the log of self.value.__class__?

@xmfan
Copy link
Member

xmfan commented May 2, 2024

Can we also add the fallback warning to

cls_var = inspect.getattr_static(
self.value.__class__, name, NO_SUCH_SUBOBJ
)

@@ -828,6 +832,7 @@ def var_getattr(self, tx, name):
subobj = self._getattr_static(name)
except AttributeError:
subobj = NO_SUCH_SUBOBJ
log.warning(f"NO_SUCH_SUBOBJ: {self.value} {name}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like something we should warn on. This is valid user code:

try:
   x = foo.x
except AttributeError:
   x = None

It would be super annoying to emit a warning for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's pass exc_info=True too to get the full exception stack trace + exception object.

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