serverless
My serverless docker gives me every time these error 3T20:58:50.721146693Z Loading weights [338b85bc4f] from /stable-diffusion-webui/models/Stable-diffusion/juggernaut_reborn.safetensors
2024-07-03T20:58:50.721150623Z Creating model from config: /stable-diffusion-webui/configs/v1-inference.yaml
2024-07-03T20:58:50.721154093Z INFO: 127.0.0.1:55652 - "GET /sdapi/v1/txt2img HTTP/1.1" 405 Method Not Allowed
2024-07-03T20:58:50.721921286Z WebUI API Service is ready. Starting RunPod...
2024-07-03T20:58:50.721937646Z --- Starting Serverless Worker | Version 1.6.2 ---
2024-07-03T20:58:51.755354070Z {"requestId": "0723bde1-f4f1-413b-a169-252c55b46c1b-u1", "message": "Started.", "level": "INFO"}
2024-07-03T20:58:51.763588079Z INFO: 127.0.0.1:55666 - "POST /sdapi/v1/img2img HTTP/1.1" 404 Not Found
2024-07-03T20:58:51.764382832Z HTTP error occurred: 404 Client Error: Not Found for url: http://127.0.0.1:3000/sdapi/v1/img2img
2024-07-03T20:58:52.073700443Z {"requestId": "0723bde1-f4f1-413b-a169-252c55b46c1b-u1", Any ideas?
8 Replies
It looks like you are trying to run a web server inside of your handler. That will not work. The RunPod module will handle gettting the POST data from the end user and passing that info to your handler function and you can get input from there. Like this:
def handler(job):
job_input = job['input']
You don't need to run a web server inside your image.
Yeah I figured, the thing is I want to run img2img with control net and an extension. My handler is the one in the image
Yeah, I don't think that is a good way to go about it. You should be able to run inference from a python script without having to run a web server. Find the code that the webserver is running and convert that into a script that takes in ["input'] and returns the JSON. Put that code in your handler function. Since return is an image file you'll either need to convert it into BASE 64 or upload it to a S3 bucket.
Looks like you're using the GenerativeLabs worker, use this one instead:
https://github.com/ashleykleynhans/runpod-worker-a1111
GitHub
GitHub - ashleykleynhans/runpod-worker-a1111: RunPod Serverless Wor...
RunPod Serverless Worker for the Automatic1111 Stable Diffusion API - ashleykleynhans/runpod-worker-a1111
And its perfectly fine to run A1111 and connect to it from your handler, @Encyrption is wrong about that.
Yeah but at the moment my main problems is now whenever I do a prediction it works but it just hangs and wastes gpu hours like in the picture, techinicaly within my local docker it finishes calculating the weights but using runpod it stays. Any suggestions?
If you haven't already I suggest you check out https://blog.runpod.io/custom-serverless-api-step-by-step-tutorial/
RunPod Blog
A1111 Serverless API, Step-by-Step Video Tutorial
This blog post features a video tutorial from generativelabs.co that provides step-by-step instructions on how to use the Stable Diffusion A1111 API with RunPod Serverless.
Whether you're a beginner or an experienced user, the RunPod & Stable Diffusion Serverless video tutorial offers useful information.
Beginners will find the instructions clear
It doesn't have xformers etc, use the link I sent, it works well.