Coder Social home page Coder Social logo

deepfriedheroin / runpod-fooocus-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davefojtik/runpod-fooocus-api

0.0 0.0 0.0 39 KB

RunPod serverless endpoint worker for StableDiffusion Fooocus-API

Shell 5.39% Python 83.08% Dockerfile 11.53%

runpod-fooocus-api's Introduction

Static Badge Static Badge Static Badge Static Badge Static Badge

RunPod-Fooocus-API

This is a RunPod Fooocus-API worker that expects a Fooocus-API v0.3.29 instance installed on a RunPod Network Volume.
For ready-to-use serverless endpoint image with this repo's code use: 3wad/runpod-fooocus-api:0.3.29

How to prepare Network Volume

  • Create RunPod network volume: 17GB is just enough for the generic Foocus with Juggernaut and all controlnet models. You can increase its size any time if you need additional models, loras etc. But unfortunately, it cannot be reduced back without creating new one.
  • Create a custom Pod Template: and use the konieshadow/fooocus-api:v0.3.29 image. I went with 30GB disk sizes, mount path /workspace, and expose http 8888 and tcp 22.
  • Run a GPU pod: with network volume and custom fooocus-api template you've just created. You don't need a strong GPU pod, the installation is CPU and download-intensive, but be aware that some older-gen pods might not support the required CUDA versions. Let it download and install everything. After the Juggernaut model is downloaded, use the connect button to load into the Fooocus-API docs running on the pod's 8888 port. Here you should try all the API methods you plan to use. Not only to verify they work, but also because additional up-to-date models are downloaded once you run inpaint, outpaint, upscale, vary and img2img (canny, face swap etc.) endpoints for the first time.
  • After that you are ready to connect to the pod's console and use cp -r /app/* /workspace/ to copy everything into the persistent network volume
  • Once everything is copied successfully, you can terminate the pod. You have the network volume ready.

  • Now you can use our premade image: 3wad/runpod-fooocus-api:0.3.29 and skip the next step OR create your custom docker image from this repo that will run on the actual serverless API. Feel free to adjust the code to your needs.
  • If you built your own image, upload it to the Docker Hub.
  • Create a custom Serverless Pod Template: using the Docker Hub image you've just uploaded (or our premade one). Active container disk should be slightly bigger than the size of that docker image. In the case of our prebuild one, it's currently about 13.7GB
  • Create a new Serverless API Endpoint: Make sure to choose your (or our) Docker Hub image and not the konieshadow/fooocus-api from the step 2. In Advanced settings choose your created network volume.
  • Other settings are your choice, but I personally found that using 4090/L4 GPUs + Flashboot is the most cost-effective one. In frequent use, the 4090 is able to return a txt2img in ~8s including cold start, making it ~25x cheaper to run Fooocus on RunPod than for example using DALLE-3 API. *(01/24 prices: 0,0016usd/img vs 0,04usd/img), This fact can of course vary based on datacenter locations and GPU availability.

How to send requests

request_examples.js contain example payloads for all endpoints on your serverless worker. But don't hesitate to ask in the Discussions if you need more help.

Contributors Welcomed

Feel free to do pull requests, fixes, improvements and suggestions to the code. I can spend only limited time on this as it's a side project for our community discord bot. So any cooperation will help manage this repo better.

runpod-fooocus-api's People

Contributors

davefojtik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.