Skip to content

save/load ML models#120

Open
SCiarella wants to merge 8 commits into
mainfrom
ml_saveload
Open

save/load ML models#120
SCiarella wants to merge 8 commits into
mainfrom
ml_saveload

Conversation

@SCiarella
Copy link
Copy Markdown
Collaborator

@SCiarella SCiarella commented May 19, 2026

This closes #110, by adding a save/load utility for the ML modules using safetensors

Main changes:

  • add safetensors as a dependency
  • add diffwofost.ml_models.io with:
    • save_model(model, ...)
    • load_model(path, ...)
  • store enough metadata to rebuild a saved model
  • give models a default checkpoint name based on model structure
  • add tests for save/load
  • show how to use save/load in hybrid notebook
  • add new function to API (docs)

Design choices:

  • save_model(model) saves to a default temp location (ignored by git)
  • the default filename depends on model class + init kwargs (deterministically)
  • so the same model structure reuses the same checkpoint path
  • saving again after retraining overwrites that file
  • if you want multiple saved variants, you have to pass a custom filename

@SCiarella SCiarella requested a review from SarahAlidoost May 19, 2026 09:20
@sonarqubecloud
Copy link
Copy Markdown

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.

[Task]: Save/load models

1 participant