Library to handle versioning and serialization of AI/ML models into Redis.
Project description
🧠 Redis Model Store
Store, version, and manage your ML models in Redis with ease. redis-model-store provides a simple yet powerful interface for handling machine learning model artifacts in Redis.
✨ Features
- 🔄 Automatic Versioning: Track and manage multiple versions of your models
- 📦 Smart Storage: Large models are automatically sharded for optimal storage
- 🔌 Pluggable Serialization: Works with any Python object (NumPy, PyTorch, TensorFlow, etc.)
- 🏃♂️ High Performance: Efficient storage and retrieval using Redis pipelining
- 🛡️ Safe Operations: Atomic operations with automatic cleanup on failures
🚀 Quick Start
Installation
# Using pip
pip install redis-model-store
# Or using poetry
poetry add redis-model-store
Basic Usage
Here's a simple example using scikit-learn:
from redis import Redis
from redis_model_store import ModelStore
from sklearn.ensemble import RandomForestClassifier
# Connect to Redis and initialize store
redis = Redis(host="localhost", port=6379)
store = ModelStore(redis)
# Train your model
model = RandomForestClassifier()
model.fit(X_train, y_train)
# Save model with version tracking
version = store.save_model(
model,
name="my-classifier",
description="Random forest trained on dataset v1"
)
# List available models
models = store.list_models()
print(f"Available models: {models}")
# Load latest version
model = store.load_model("my-classifier")
# Load specific version
model = store.load_model("my-classifier", version=version)
# View all versions
versions = store.get_all_versions("my-classifier")
for v in versions:
print(f"Version: {v.version}, Created: {v.created_at}")
🛠️ Contributing
We welcome contributions! Here's how to get started:
Development Setup
- Clone the repository:
git clone https://github.com/redis-applied-ai/redis-model-store.git
cd redis-model-store
- Install poetry if you haven't:
curl -sSL https://install.python-poetry.org | python3 -
- Install dependencies:
poetry install --all-extras
Linting and Tests
poetry run format
poetry run check-mypy
poetry run test
poetry run test-verbose
Making Changes
- Create a new branch:
git checkout -b feat/your-feature-name
-
Make your changes and ensure:
- All tests pass (covering new functionality)
- Code is formatted
- Type hints are valid
- Examples/docs added as notebooks to the
docs/directory.
-
Push changes and open a PR
📚 Documentation
For more usage examples check out tbhis Example Notebook.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis_model_store-0.0.2.tar.gz.
File metadata
- Download URL: redis_model_store-0.0.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.12 Linux/6.11.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8220b6400da77bf2529be54081d9fa541c49fe277960f17826e5f42ade46bf5
|
|
| MD5 |
f859a06ffceb3b3db82783ad2db1a78a
|
|
| BLAKE2b-256 |
1495f79e401bbe5de3bed1ef35807e9c7a621fe2f198bc7c564a1cd293623a5e
|
File details
Details for the file redis_model_store-0.0.2-py3-none-any.whl.
File metadata
- Download URL: redis_model_store-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.12 Linux/6.11.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f70873367966d289a73a4ea92a72941e2f3f96e813717a59baad8f37e959e60
|
|
| MD5 |
3b252fdbd845a81f64b5184ca35398f3
|
|
| BLAKE2b-256 |
5b9e1dd4f808bf58e9c858c15ff37ec08c4765df88d1194bcbad2c81ce33b7a5
|