-
Notifications
You must be signed in to change notification settings - Fork 173
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
[minor] allow overriding args/kwargs behavior in Runtime #587
Conversation
hivemind/moe/server/runtime.py
Outdated
if self.stats_report_interval is not None: | ||
self.stats_reporter.report_stats(pool.name, batch_size, batch_processing_time) |
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 think it might lead to unintended "0 batches processed" log entries if the user overrides this without carefully considering the original function. Best to leave only the batch size computation inside the function and keep all the logging/time measuring logic outside the function
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.
good catch, fixed it now, please take another look
Codecov Report
@@ Coverage Diff @@
## master #587 +/- ##
==========================================
+ Coverage 85.38% 85.42% +0.04%
==========================================
Files 81 81
Lines 8006 8009 +3
==========================================
+ Hits 6836 6842 +6
+ Misses 1170 1167 -3
|
@@ -108,6 +105,11 @@ def run(self): | |||
if not self.shutdown_trigger.is_set(): | |||
self.shutdown() | |||
|
|||
def process_batch(self, pool: TaskPoolBase, batch_index: int, *batch: torch.Tensor) -> Tuple[Any, int]: |
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.
batch_index
is not used, is it okay?
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.
yep, it is meant to be exposed for subclassing
* allow overriding args/kwargs in Runtime * switch stats time to time.perf_counter --------- Co-authored-by: Your Name <you@example.com> Co-authored-by: Max Ryabinin <mryabinin0@gmail.com> (cherry picked from commit 33a9a41)
This PR extracts a part of runtime that is responsible for calling pool's process func.
This is to allow developer to extend this behavior in
petalsdownstream applications without having to rewrite the whole runtime.run method.