UI is a gradio interface that you can use to run stable diffusion batch prediction jobs with different model types without writing any code.
Using Google cloud to create jobs has the following benefits:
- Managed infrastructure makes deployment fast an intuitive.
- Jobs in Vertex AI are ephemeral, meaning, resources are not long lasting. You only pay for the time you use and infrastructure is destroyed after job completion, making it more secure than downloading models in your own computer and only paying for the time you use resources.
-
You'll first need to install the
gcloud
cli. You can find the instructions here. -
Open a new shell window and install the requirements. It is recommeneded to use a virtual python environment such as
pipenv
.pip install -r requirements.txt
-
There are different ways to authenticate to the GCP account, such as creating a service account and setting
GOOGLE_APPLICATION_CREDENTIALS
or usinggcloud auth
. Here we'll use the latter.gcloud auth application-default login
-
Set your project id. Run the command below and change
<project_id>
to your project name.gcloud config set project <project_id>
-
Create a bucket to store all outputs. The name can be anything but needs to be unique across all of GCP.
gsutil mb gs://<project_id>-serving-models-folder
-
If this is the first time you are using this project, then you'll need to enable the services to run this job.
gcloud services enable compute.googleapis.com containerregistry.googleapis.com aiplatform.googleapis.com cloudbuild.googleapis.com cloudfunctions.googleapis.com dataflow.googleapis.com
-
You might need to create a quota increase. View here to read about quota increases. In the quotas page, search for custom model training for the GPU type you like to use. For example, for a
T4
GPU, you can search forCustom model training Nvidia T4 GPUs per region (default)
and ask for a quota increase for this GPU. -
Start the gradio app.
gradio ui.py