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 support for sparse updates #75

Closed
wants to merge 1 commit into from
Closed

Add support for sparse updates #75

wants to merge 1 commit into from

Conversation

vishalathreya
Copy link
Contributor

@vishalathreya vishalathreya commented Nov 16, 2022

Add function to "checkout" latest committed model state

When git theta add is run with the --update_type sparse argument, sparse updates are computed by comparing current model checkpoint with the latest committed checkpoint under .git_theta and are stored under updates subfolder under each parameter group. Latest committed checkpoint can be retrieved (checkout) by loading the dense values under params folder and sequentially applying all files under updates

Add function to "checkout" latest committed model state
logging.debug(f"Writing {param_name} updates to {param_file}")
# file_io.write_tracked_file(param_file, param)
os.makedirs(updates_dir, exist_ok=True)
sparse.save_npz(param_file, param)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Encountered an issue when storing sparse CSR matrices using TensorStore. Saved it as npz files to git as a temporary solution.

return final_val


def get_prev_param_dict(theta_model_dir):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

replace the for loop in the smudge filter with this function to "checkout" latest committed state of model

@craffel
Copy link
Contributor

craffel commented Jan 19, 2023

Fixed in #128

@craffel craffel closed this Jan 19, 2023
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.

None yet

2 participants