If you’re venturing into the world of machine learning (ML) and experimenting with different models, you might find yourself asking: “How do I keep track of all my experiments?” Enter Keepsake—a Python library designed to manage version control specifically for your ML projects. In this blog, I’ll guide you on how to use Keepsake effectively, troubleshoot common issues, and ensure your experiments are well-organized.
What is Keepsake?
Keepsake is a robust tool that allows you to upload files and metadata, like hyperparameters, to Amazon S3 or Google Cloud Storage. It provides features like:
- Automatic tracking of experiments
- Ability to retrieve past checkpoints
- Version control for model weights, making it easier to integrate into production systems
Getting Started
To start using Keepsake, simply add two lines to your training code. Here’s a simple analogy to explain how this works:
Think of Keepsake as your diligent assistant at a science fair. Every time you conduct an experiment (train a model), your assistant takes detailed notes (uploads files and metadata) about what you did, including the ingredients (hyperparameters) you used and the results (metrics). At any point, if you need to recreate your experiment, you can ask your assistant to bring out the notes from the archive.
Code Installation
First, install Keepsake using pip:
pip install -U keepsake
Integrating Keepsake into Your Code
Here’s how to save your training scripts and track your experiments:
import torch
import keepsake
def train():
# Save training code and hyperparameters
experiment = keepsake.init(path='.', params={'learning_rate': 0.001})
model = Model()
for epoch in range(num_epochs):
# Save model weights and metrics
torch.save(model, 'model.pth')
experiment.checkpoint(path='model.pth', metrics={'train_loss': ..., 'val_loss': ...})
Key Features
Let’s quickly highlight some of the standout features of Keepsake:
- Throw away your spreadsheet: View and manage all your experiments in one place with powerful filtering and sorting.
- Analyze results easily: Retrieve, analyze, and plot results from within a notebook.
- Compare experiments: Keep track of changes across different versions of your models and metrics.
Troubleshooting
While Keepsake is user-friendly, you might encounter issues along the way. Here are some common troubleshooting tips:
- I can’t find my uploaded files: Check whether you have the correct permissions set on your Amazon S3 or Google Cloud Storage account.
- My experiments aren’t tracked: Make sure you’re calling the
experiment.checkpoint()method correctly in your training loop. - Installation issues: Double-check that your Python environment is correctly set up and that you have the latest version of pip.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
As machine learning becomes more prevalent, managing experiments efficiently is crucial. With Keepsake, you have an open-source solution ready to track your ML projects easily. This tool empowers you to focus on your experiments without getting lost amidst your files. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

