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

Pass train_state to update_params #790

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Niccolo-Ajroldi
Copy link
Contributor

@Niccolo-Ajroldi Niccolo-Ajroldi commented Oct 3, 2024

This pull-request adds train_state to the arguments of update_params.

This allows for example to implement a time-based LR scheduler (see #785).

Since train_state is a dictionary, we have to avoid that a submission modifies its content.
The solution adopted here passes train_state by copy. We use a shallow copying, since all values in train_state are primitive types, and cannot be modified in-place. Although very fast, this copying operation would however be counted as part of the submission time.

A possible alternative solution that would avoid this problem would be to pass train_state['accumulated_submission_time'] directly instead of passing the entire dictionary.

@Niccolo-Ajroldi Niccolo-Ajroldi requested a review from a team as a code owner October 3, 2024 15:51
Copy link

github-actions bot commented Oct 3, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@@ -422,6 +423,7 @@ def update_params(workload: Workload,
batch: Dict[str, Tensor],
loss_type: LossType,
optimizer_state: OptimizerState,
train_state: Dict[str, Any],
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 make this an optional kwarg and default it to None for backwards compatibility?

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.

2 participants