Skip to content

Commit

Permalink
fix: updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmerrell committed May 14, 2023
1 parent 9f24389 commit bb3dcd8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 25 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/CD-docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
35 changes: 12 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
<div align="center">

<h1>Template | Worker</h1>
<h1>Stable Diffusion v1.5 | Worker</h1>

[![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.
</div>

## 📖 | 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 .
```
2 changes: 1 addition & 1 deletion builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit bb3dcd8

Please sign in to comment.