Skip to content

Commit

Permalink
feat: added github workflow; bake LoRA into image; removed discord in…
Browse files Browse the repository at this point in the history
…tegration; return image as base64
  • Loading branch information
TimPietrusky committed Oct 5, 2024
1 parent 0c160ea commit 91929ff
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 528 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Development

on:
workflow_dispatch:
push:

jobs:
dev:
runs-on: ubuntu-latest-l
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Clear space to remove unused folders
run: |
rm -rf /usr/share/dotnet
rm -rf /opt/ghc
rm -rf "/usr/local/share/boost"
rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Image to Docker Hub
uses: docker/build-push-action@v5
with:
push: true
tags: |
${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:latest
28 changes: 22 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,41 @@ FROM runpod/pytorch:2.2.1-py3.10-cuda12.1.1-devel-ubuntu22.04
WORKDIR /content
ENV PATH="/home/camenduru/.local/bin:${PATH}"

# Add and configure the 'camenduru' user
RUN adduser --disabled-password --gecos '' camenduru && \
adduser camenduru sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
chown -R camenduru:camenduru /content && \
chmod -R 777 /content && \
chown -R camenduru:camenduru /home && \
chmod -R 777 /home && \
apt update -y && add-apt-repository -y ppa:git-core/ppa && apt update -y && apt install -y aria2 git git-lfs unzip ffmpeg
apt update -y && \
add-apt-repository -y ppa:git-core/ppa && \
apt update -y && \
apt install -y aria2 git git-lfs unzip ffmpeg

USER camenduru

# Install Python dependencies, clone ComfyUI, and download necessary models & LoRA
RUN pip install -q opencv-python imageio imageio-ffmpeg ffmpeg-python av runpod \
xformers==0.0.25 torchsde==0.2.6 einops==0.8.0 diffusers==0.28.0 transformers==4.41.2 accelerate==0.30.1 && \
git clone https://github.com/comfyanonymous/ComfyUI /content/ComfyUI && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/flux1-dev.sft -d /content/ComfyUI/models/unet -o flux1-dev.sft && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/clip_l.safetensors -d /content/ComfyUI/models/clip -o clip_l.safetensors && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/t5xxl_fp16.safetensors -d /content/ComfyUI/models/clip -o t5xxl_fp16.safetensors && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/ae.sft -d /content/ComfyUI/models/vae -o ae.sft
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M \
https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/flux1-dev.sft -d /content/ComfyUI/models/unet -o flux1-dev.sft && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M \
https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/clip_l.safetensors -d /content/ComfyUI/models/clip -o clip_l.safetensors && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M \
https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/t5xxl_fp16.safetensors -d /content/ComfyUI/models/clip -o t5xxl_fp16.safetensors && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M \
https://huggingface.co/camenduru/FLUX.1-dev/resolve/main/ae.sft -d /content/ComfyUI/models/vae -o ae.sft && \
mkdir -p /content/ComfyUI/models/loras && \
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M \
https://civitai.com/api/download/models/896422?type=Model&format=SafeTensor -d /content/ComfyUI/models/loras -o zanshou-kin-flux-ueno-manga-style.safetensors

# Copy the updated worker script into the container
COPY ./worker_runpod.py /content/ComfyUI/worker_runpod.py

WORKDIR /content/ComfyUI
CMD python worker_runpod.py

# Define the command to run the worker
CMD python worker_runpod.py
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
🐣 Please follow me for new updates https://twitter.com/camenduru <br />
🔥 Please join our discord server https://discord.gg/k5BwmmvJJU <br />
🥳 Please join my patreon community https://patreon.com/camenduru <br />
# flux.1-dev LoRA worker

### 🥪 Tost
https://tost.ai
> run flux.1-dev + LoRA on RunPod as serverless endpoint
### 🧬 Code
https://github.com/black-forest-labs/flux
This is a fork of [camenduru/flux.1-dev-lora-tost](https://github.com/camenduru/flux.1-dev-lora-tost), I just wanted to simplify it and make sure I understand how it works.

### 🌐 Page
https://blackforestlabs.ai/
## Acknowledgements

### 🖼 Output
![ComfyUI_00854_](https://github.com/user-attachments/assets/06af2e9f-1a9b-44b9-bf55-a4632cc08ef5)
![Screenshot 2024-08-01 225221](https://github.com/user-attachments/assets/89523ac4-9e18-4ad1-90c2-e6aa979be769)

### 🏢 Sponsor
https://runpod.io
- [camenduru](https://github.com/camenduru)
- [ComfyUI](https://github.com/comfyanonymous/ComfyUI)
- [FLUX](https://github.com/black-forest-labs/flux)
241 changes: 0 additions & 241 deletions schema.json

This file was deleted.

Loading

0 comments on commit 91929ff

Please sign in to comment.