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

feat: add SPS for trainer #129

Merged
merged 2 commits into from
Nov 12, 2024
Merged

feat: add SPS for trainer #129

merged 2 commits into from
Nov 12, 2024

Conversation

EdanToledo
Copy link
Owner

What?

Add a steps per second metric to the trainer.

Why?

Useful to know how many optimiser steps are being performed per second.

How?

Multiply the number of updates per eval by the algorithms epoch number of epoch*num minibatch number.

@EdanToledo EdanToledo linked an issue Nov 11, 2024 that may be closed by this pull request
@thomashirtz
Copy link

Looks good to me!

@EdanToledo EdanToledo merged commit 5c48fea into main Nov 12, 2024
3 checks passed
@EdanToledo EdanToledo deleted the chore/add_trainer_sps branch November 12, 2024 10:05
@@ -511,7 +511,15 @@ def run_experiment(_config: DictConfig) -> float:
logger.log({"timestep": t}, t, eval_step, LogEvent.MISC)
if ep_completed: # only log episode metrics if an episode was completed in the rollout.
logger.log(episode_metrics, t, eval_step, LogEvent.ACT)

Choose a reason for hiding this comment

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

Isn't a little bit ambiguous to call that ACTOR steps_per_seconds as it is capturing the "learn" function ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm not sure i fully understand. In the anakin systems, the "Actors" generate the data within the "learn" function. The amount of data produced / elapsed time. The only real issue is that the elapsed time includes the learn step so the actual actor steps per second would be faster if you only timed that specific chunk of code.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Unless by saying capturing the learn function, you mean this issue:

The only real issue is that the elapsed time includes the learn step so the actual actor steps per second would be faster if you only timed that specific chunk of code.

Copy link

@thomashirtz thomashirtz Nov 14, 2024

Choose a reason for hiding this comment

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

That was my point, the actor sps include the learning (which include backprop + inferences e.g. within the _actor_loss_fn or the _critic_loss_fn) It makes me think that the actual "acting" time is mostly composed of this learning component than anything else

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah you are right. This is actually something necessary to fix. Its going to be annoying since it'll need to be fixed in every single file. Can you make an issue and then we can chat about it there.

Choose a reason for hiding this comment

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

I would be happy to help you fix it, we just need to investigate how to do it for one file

Copy link
Owner Author

Choose a reason for hiding this comment

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

awesome. Thanks so much.

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

Successfully merging this pull request may close these issues.

[FEATURE] Log the trainer time
2 participants