-
Notifications
You must be signed in to change notification settings - Fork 51
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 interface to trace events in custom runtimes #584
Conversation
@@ -311,6 +311,17 @@ def map( | |||
""" | |||
raise NotImplementedError() | |||
|
|||
@classmethod | |||
@contextlib.contextmanager | |||
def trace(cls, event_name: str, arg: Any) -> Generator[None, None, None]: |
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 is a class method since we can have multiple runtime instances (one per module created with ppe.to
). I think we should address these issues in other PR since the ppe.to and nested modules semantics changed and can be tricky.
415a591
to
7d3d518
Compare
@@ -218,6 +218,8 @@ def run(self, | |||
self._train_len = train_len | |||
self._eval_len = eval_len | |||
|
|||
device = self.handler._entry_runtime.device_spec # type: ignore[attr-defined] |
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.
wonder if we should pass the device spec as a trainer arg instead of accessing it like this. It would be much simpler.
Sorry for the delay, LGTM! |
/test |
No description provided.