Replicate
- You don't have good GPU to run your ML models
- You just want to deploy ML model into cloud with 1-line-command
- You want a cheaper bill than Colab Pro or AWS/GCP/Azure
Replicate is a platform that can deploy your ML model into cloud with 1-click.
Introduction
- Run models in the cloud at scale
- Replicate allows running ML models with minimal coding, without deep understanding of ML.
curl -s -X POST \
-d '{"version": "db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf", \
"input": { "prompt": "an astronaut riding on a horse" } }' \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.replicate.com/v1/predictions - It has thousands of ready-to-use models shared by its community.
- Push: Package ML models easily
- Cog, an open-source tool by Replicate, packages ML models into production-ready containers
- only 4 steps to push your model into cloud
- define the environment your model runs in with
cog.yaml
build:
gpu: true
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"
python_version: "3.10"
python_packages:
- "torch==1.13.1"
predict: "predict.py:Predictor" - define how predictions are run on your model with
predict.py
from cog import BasePredictor, Input, Path
import torch
class Predictor(BasePredictor):
def setup(self):
"""Load the model into memory to make running multiple predictions efficient"""
self.model = torch.load("./weights.pth")
# The arguments and types the model takes as input
def predict(self,
image: Path = Input(description="Grayscale input image")
) -> Path:
"""Run a single prediction on the model"""
processed_image = preprocess(image)
output = self.model(processed_image)
return postprocess(output) - then you can run predictions on this model locally
cog predict -i @input.jpg
- Finally, push your model to Replicate, and you can run it in the cloud with a few lines of code
cog push
- define the environment your model runs in with
- Scale: Deploy ML models at scale
- scaling is 100% your choice
- Automatic scale
- Automatic API
- Pay by second billing system
Investment Info
Please be duly advised that the content herein does not constitute investment guidance or advice. The material presented is purely for informational purposes and should not be construed as, nor relied upon as a recommendation for investment or financial decision-making. The reader bears sole responsibility for any investment decisions made, and it is recommended that they seek independent financial advice as required.
2023-May-27
Please be duly advised that the content herein does not constitute investment guidance or advice. The material presented is purely for informational purposes and should not be construed as, nor relied upon as a recommendation for investment or financial decision-making. The reader bears sole responsibility for any investment decisions made, and it is recommended that they seek independent financial advice as required.