diff --git a/.github/workflows/CD-docker_release.yml b/.github/workflows/CD-docker_release.yml index 17665a3..52a183f 100644 --- a/.github/workflows/CD-docker_release.yml +++ b/.github/workflows/CD-docker_release.yml @@ -6,6 +6,29 @@ on: jobs: docker: + strategy: + matrix: + include: + - model_name: stable-diffusion-v1-5 + model_tag: runwayml/stable-diffusion-v1-5 + model_url: https://huggingface.co/runwayml/stable-diffusion-v1-5 + + - model_name: anything-v3 + model_tag: Linaqruf/anything-v3.0 + model_url: https://huggingface.co/Linaqruf/anything-v3.0 + + - model_name: anything-v4 + model_tag: andite/anything-v4.0 + model_url: https://huggingface.co/andite/anything-v4.0 + + - model_name: openjourney + model_tag: prompthero/openjourney + model_url: https://huggingface.co/prompthero/openjourney + + - model_name: realistic-vision + model_tag: SG161222/Realistic_Vision_V1.4 + model_url: https://huggingface.co/SG161222/Realistic_Vision_V1.4 + runs-on: ubuntu-latest steps: - name: Clear Space @@ -30,5 +53,8 @@ jobs: - name: Build and push uses: docker/build-push-action@v4 with: + build-args: | + MODEL_URL=${{ matrix.model_url }} + MODEL_TAG=${{ matrix.model_tag }} push: true - tags: ${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:${{ github.event.release.tag_name }} + tags: ${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:${{ matrix.model_name }}-${{ github.event.release.tag_name }} diff --git a/Dockerfile b/Dockerfile index 33769ba..cb6c461 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,6 @@ RUN rm /model_fetcher.py # Add src files (Worker Template) ADD src . +ENV RUNPOD_DEBUG_LEVEL=INFO + CMD python -u /rp_handler.py --model_tag=${MODEL_TAG} diff --git a/README.md b/README.md index ff741ee..cecb0ec 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,24 @@
-

Template | Worker

+

Stable Diffusion v1.5 | Worker

[![Docker Image](https://github.com/runpod-workers/worker-template/actions/workflows/CD-docker_dev.yml/badge.svg)](https://github.com/runpod-workers/worker-template/actions/workflows/CD-docker_dev.yml) -🚀 | A simple worker that can be used as a starting point to build your own custom RunPod Endpoint API worker.
-## 📖 | Getting Started +## RunPod Endpoint -1. Clone this repository. -2. (Optional) Add DockerHub credentials to GitHub Secrets. -3. Add your code to the `src` directory. -4. Update the `handler.py` file to load models and process requests. -5. Add any dependencies to the `requirements.txt` file. -6. Add any other build time scripts to the`builder` directory, for example, downloading models. -7. Update the `Dockerfile` to include any additional dependencies. +This repository contains the worker for the SDv1 AI Endpoints. The following docs can be referenced to make direct calls to the running endpoints on runpod.io -### CI/CD +- [Stable Diffusion v1](https://docs.runpod.io/reference/stable-diffusion-v1) +- [Anything v3](https://docs.runpod.io/reference/anything-v3) +- [Anything v4](https://docs.runpod.io/reference/anything-v4) +- [OpenJourney](https://docs.runpod.io/reference/openjourney-sd-v15) -This repository is setup to automatically build and push a docker image to the GitHub Container Registry. You will need to add the following to the GitHub Secrets for this repository to enable this functionality: +## Docker Image -- `DOCKERHUB_USERNAME` | Your DockerHub username for logging in. -- `DOCKERHUB_TOKEN` | Your DockerHub token for logging in. -- `DOCKERHUB_REPO` | The name of the repository you want to push to. -- `DOCKERHUB_IMG` | The name of the image you want to push to. +The docker image requires two build arguments `MODEL_URL` and `Model_TAG` to build the image. The `MODEL_URL` is the url of the model repository and the `Model_TAG` is the tag of the model repository. -The `CD-docker_dev.yml` file will build the image and push it to the `dev` tag, while the `CD-docker_release.yml` file will build the image on releases and tag it with the release version. - -## Best Practices - -Models should be part of your docker image, this can be accomplished by either copying them into the image or downloading them during the build process. - -If using the input validation utility from the runpod python package, create a `schemas` python file where you can define the schemas, then import that file into your `handler.py` file. +```bash +docker build --build-arg MODEL_URL=https://huggingface.co/runwayml/stable-diffusion-v1-5 --build-arg MODEL_TAG=main -t runwayml/stable-diffusion-v1-5 . +``` diff --git a/builder/requirements.txt b/builder/requirements.txt index 39abcb9..2b913e1 100644 --- a/builder/requirements.txt +++ b/builder/requirements.txt @@ -1,7 +1,7 @@ # Required Python packages get listed here, one per line. # Reccomended to lock the version number to avoid unexpected changes. -runpod==0.9.3 +runpod==0.9.7 diffusers==0.12.1 torch==1.13.1 --extra-index-url=https://download.pytorch.org/whl/cu116 ftfy==6.1.1