Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Vertex AI endpoint of pre-trained model for Inferencing. #9

Open
StateGovernment opened this issue Mar 20, 2023 · 3 comments

Comments

@StateGovernment
Copy link

Labels : How to/ Suggestions.

I am looking for suggestions on, how to create a Vertex AI endpoint out of a Trained Dreambooth stable diffusion model. Inorder to run inference on the model through endpoint. How do I go about this

@entrpn
Copy link
Owner

entrpn commented Mar 21, 2023

@StateGovernment take a look at this example. This is pytorch only, so you'll have to convert the model to pytorch as demonstrated in the training dreambooth repo.

In your case, where you are using a local model, you need to modify the Dockerfile to copy your model. Add a new line here

COPY dreambooth-folder .

Then call the docker build like:

PROJECT_ID=<project-id>
docker build -t gcr.io/$PROJECT_ID/serving-sd:latest --build-arg model_name=dreambooth-folder --build-arg use_xformers=1 --build-arg model_revision=main.

use_xformers only works with fp16 weights. If you have a fp32 model, then use use_xformers=0.

I think that should work.

@StateGovernment
Copy link
Author

StateGovernment commented Mar 21, 2023

Thank you for the suggestion.

I see, following the code I believe a REST endpoint is being deployed using FastAPI through Docker. But our use-case actually involves creating a pure vertex ai Endpoint that could serve inference requests, is there a way to deploy the model to a vertex Endpoint instead of FastAPI?

Ref: https://console.cloud.google.com/vertex-ai/endpoints

@entrpn
Copy link
Owner

entrpn commented Mar 21, 2023

This is a deployment pattern for Vertex endpoints using custom containers. The readme describes how to deploy it to the endpoint as described in the Vertex AI documentation https://cloud.google.com/vertex-ai/docs/predictions/use-custom-container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants