An EXPERIMENTAL checkpoint decorator for Metaflow
Project description
Metaflow Checkpoint
Imagine running a machine learning training job or any data processing task that takes hours or even days to complete. In such scenarios, you don't want failures or collaboration complexities to force you to start over and lose all the progress made. This is where Metaflow's new decorators—@checkpoint
, @model
, and @huggingface_hub
—come into play. These decorators are specifically designed to address these challenges by simplifying checkpointing, model management, and efficient loading of external models, ensuring that your long-running jobs can be resumed seamlessly after a failure and that models and checkpoints are properly versioned in multi-user environments.
This repository introduces three new decorators for Metaflow that address these challenges:
@checkpoint
: Simplifies saving and reloading checkpoints within your Metaflow flows.@huggingface_hub
: Enables efficient loading and caching of large models from Hugging Face Hub.@model
: Allows for easy saving and loading of models created during your Metaflow flows.
Examples for these decorators can be found in this repository.
Features
@checkpoint
Decorator
The @checkpoint
decorator alleviates the pain points associated with saving and reloading the state of your program (a Metaflow @step
) in Metaflow flows. It also handles version control in multi-user settings by isolating checkpoints per user and run. Whether it's a checkpoint created by a machine learning model or intermediate data required in case of crashes, this decorator simplifies state management and failure recovery.
- Checkpointing: Save the state of your
@step
at designated points. - Seamless Recovery: Restart your job from the last checkpoint upon retries without any manual intervention.
- User Isolation: Checkpoints are managed per user to prevent overwriting in collaborative environments.
- Ease of Use: Minimal code changes required to implement checkpointing.
@huggingface_hub
Decorator
The @huggingface_hub
decorator allows you to load large models from Hugging Face Hub and cache them for increased performance benefits. It also ensures that models are versioned and managed appropriately in multi-user environments.
- Efficient Model Loading: Load models on-the-fly from Hugging Face Hub.
- Caching Mechanism: Cache models locally to avoid redundant downloads.
- Version Control: Manages different versions of models to prevent conflicts.
- Integration with Metaflow: Easily incorporate models across your Metaflow flows.
@model
Decorator
The @model
decorator provides a trivial way to save and load models/checkpoints created as part of your Metaflow flow.
- Simplified Model Loading: Automatically load models based on references and identifiers created by decorators such as
@model
/@checkpoint
/@huggingface_hub
. - Model Identity: Associates a uniquie identity to models so that there is clear distinction between different versions making it easy to track their lineage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file metaflow_checkpoint-0.1.1.tar.gz
.
File metadata
- Download URL: metaflow_checkpoint-0.1.1.tar.gz
- Upload date:
- Size: 55.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6341da6284a6a049771a0cd3396c1ac42d6b8561490554d3138fe3089f7f84 |
|
MD5 | 3265c451814488bc1ae54d57395d0d64 |
|
BLAKE2b-256 | 242f13185ae7cea2272cd65c542548290b8d5b17f6001369ef35a25e28f38425 |
File details
Details for the file metaflow_checkpoint-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: metaflow_checkpoint-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 76.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c3e70d118b5da33c40fddf3eeb49151d8fb3fac57f0db5b88cf1826c6f01fed |
|
MD5 | 752bbeb6edd78c2f68d515e648971c11 |
|
BLAKE2b-256 | 825d82edbd3835381e73dc62436d1f441dd2b844a4f10e1b3a5cd1f507eacfcd |