Different cloud providers and storage systems require unique implementation methods, making retrieving and loading stored models for deployment or further use complex.
modelstore
offers a unified interface for storing models across multiple cloud platforms (AWS, GCP, Azure) and local storage. It provides easy methods to download models by ID or load them directly into memory.
modelstore supports the following storages:
- AWS S3 Bucket
- Azure Blob Storage
- Google Cloud Storage Bucket
- Any s3-compatible object storage that you can access via MinIO
- A filesystem directory
Here is an example of how to use modelstore:
from modelstore import ModelStore
# Train your model
clf = RandomForestClassifier(n_estimators=10)
clf.fit(X, Y)
# Create a model store with a GCP bucket
model_store = ModelStore.from_gcloud(
project_name="my-project",
bucket_name="my-bucket",
)
# Upload the model to your model store
domain = "example-model"
meta_data = model_store.upload(domain, model=clf)
# Load the model back
clf = model_store.load(
domain=model_domain,
model_id=meta["model"]["model_id"]
)