Get Started
Overview
This guide will help you understand how to build a Docker image, deploy a Serverless endpoint, and send requests. You'll also gain a basic understanding of customizing the handler for your specific use case.
Prerequisites
This section assumes you are familiar with using the terminal and can execute commands from it.
SubModel
To proceed with this quick start, you'll need the following from SubModel:
A SubModel account
A SubModel API Key
Docker
To build your Docker image, ensure you have the following:
Docker installed
A Docker account
GitHub
To clone the worker-template repository, you'll need:
Git installed
Permissions to clone GitHub repositories
Build a Serverless Application on SubModel
Follow these steps to create a handler file, test it locally, and build a Docker image for deployment:
Create the handler file (
rp_handler.py):
Create a
test_input.jsonfile in the same folder:
Test the handler code locally:
Create a Dockerfile:
Build and push your Docker image:
Push to your container registry:
Note
When building your Docker image, you might need to specify the platform you are building for. This is particularly important if you are building on a machine with a different architecture than the one you are deploying to.
When building for SubModel providers, use
--platform=linux/amd64.
Alternatively, you can clone our worker-template repository to quickly build a Docker image and push it to your container registry for a faster start.
Now that you've pushed your container registry, you're ready to deploy your Serverless Endpoint to SubModel.
Deploy a Serverless Endpoint
This step will guide you through deploying a Serverless Endpoint to SubModel. You can refer to this walkthrough to deploy your own custom Docker image.
Log in to the SubModel Serverless console.
Select + New Endpoint.
Provide the following:
Endpoint name.
Select your GPU configuration.
Configure the number of Workers.
Select a template.
Enter the name of your Docker image.
For example,
<username>/<repo>:<tag>.
Specify enough memory for your Docker image.
Select Deploy.
Now, let's send a request to your Endpoint.
Last updated