diff --git a/.github/workflows/manual-push-dockerhub.yml b/.github/workflows/manual-push-dockerhub.yml index 739cf79e..ed51d3da 100644 --- a/.github/workflows/manual-push-dockerhub.yml +++ b/.github/workflows/manual-push-dockerhub.yml @@ -8,7 +8,7 @@ on: required: true type: string target_to_build: - description: "The specific target to build (e.g., base, sdxl, sd3, flux1-schnell, flux1-dev)" + description: "The specific target to build (e.g., base, sdxl, sd3, flux1-schnell, flux1-dev, flux1-dev-kontext)" required: true type: string diff --git a/Dockerfile b/Dockerfile index 2d7e08e3..60f8048f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -133,6 +133,13 @@ RUN if [ "$MODEL_TYPE" = "flux1-dev-fp8" ]; then \ wget -q -O models/checkpoints/flux1-dev-fp8.safetensors https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors; \ fi +RUN if [ "$MODEL_TYPE" = "flux1-dev-kontext" ]; then \ + wget -q --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/diffusion_models/flux1-kontext-dev.safetensors https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev/resolve/main/flux1-kontext-dev.safetensors; \ + wget -q -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \ + wget -q -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors && \ + wget -q --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/vae/ae.safetensors https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev/resolve/main/ae.safetensors; \ + fi + # Stage 3: Final image FROM base AS final diff --git a/README.md b/README.md index e006969e..755b7893 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ These images are available on Docker Hub under `runpod/worker-comfyui`: - **`runpod/worker-comfyui:-base`**: Clean ComfyUI install with no models. - **`runpod/worker-comfyui:-flux1-schnell`**: Includes checkpoint, text encoders, and VAE for [FLUX.1 schnell](https://huggingface.co/black-forest-labs/FLUX.1-schnell). - **`runpod/worker-comfyui:-flux1-dev`**: Includes checkpoint, text encoders, and VAE for [FLUX.1 dev](https://huggingface.co/black-forest-labs/FLUX.1-dev). +- **`runpod/worker-comfyui:-flux1-dev-kontext`**: Includes checkpoint, text encoders, and VAE for [FLUX.1 Kontext dev](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev). - **`runpod/worker-comfyui:-sdxl`**: Includes checkpoint and VAEs for [Stable Diffusion XL](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0). - **`runpod/worker-comfyui:-sd3`**: Includes checkpoint for [Stable Diffusion 3 medium](https://huggingface.co/stabilityai/stable-diffusion-3-medium). diff --git a/docker-bake.hcl b/docker-bake.hcl index 28d27e36..5eff415d 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -138,6 +138,23 @@ target "flux1-dev-fp8" { inherits = ["base"] } +target "flux1-dev-kontext" { + context = "." + dockerfile = "Dockerfile" + target = "final" + args = { + BASE_IMAGE = "${BASE_IMAGE}" + COMFYUI_VERSION = "${COMFYUI_VERSION}" + CUDA_VERSION_FOR_COMFY = "${CUDA_VERSION_FOR_COMFY}" + ENABLE_PYTORCH_UPGRADE = "${ENABLE_PYTORCH_UPGRADE}" + PYTORCH_INDEX_URL = "${PYTORCH_INDEX_URL}" + MODEL_TYPE = "flux1-dev-kontext" + HUGGINGFACE_ACCESS_TOKEN = "${HUGGINGFACE_ACCESS_TOKEN}" + } + tags = ["${DOCKERHUB_REPO}/${DOCKERHUB_IMG}:${RELEASE_VERSION}-flux1-dev-kontext"] + inherits = ["base"] +} + target "base-cuda12-8-1" { context = "." dockerfile = "Dockerfile" diff --git a/docs/ci-cd.md b/docs/ci-cd.md index 9bde6e66..bf3a3f07 100644 --- a/docs/ci-cd.md +++ b/docs/ci-cd.md @@ -15,11 +15,11 @@ If you have forked this repository and want to use these actions to publish imag 1. **Secrets** (`Settings > Secrets and variables > Actions > New repository secret`): - | Secret Name | Description | Example Value | - | -------------------------- | -------------------------------------------------------------------------- | ------------------- | - | `DOCKERHUB_USERNAME` | Your Docker Hub username. | `your-dockerhub-id` | - | `DOCKERHUB_TOKEN` | Your Docker Hub access token with read/write permissions. | `dckr_pat_...` | - | `HUGGINGFACE_ACCESS_TOKEN` | Your READ access token from Hugging Face (required only for building SD3). | `hf_...` | + | Secret Name | Description | Example Value | + | -------------------------- | --------------------------------------------------------------------------------- | ------------------- | + | `DOCKERHUB_USERNAME` | Your Docker Hub username. | `your-dockerhub-id` | + | `DOCKERHUB_TOKEN` | Your Docker Hub access token with read/write permissions. | `dckr_pat_...` | + | `HUGGINGFACE_ACCESS_TOKEN` | Your READ access token from Hugging Face (required for SD3, non fp8 flux models). | `hf_...` | 2. **Variables** (`Settings > Secrets and variables > Actions > New repository variable`): diff --git a/docs/deployment.md b/docs/deployment.md index 28b59e38..b4625b9d 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -39,13 +39,14 @@ This is the simplest method if the official images meet your needs. ### GPU recommendations (for Official Images) -| Model | Image Tag Suffix | Minimum VRAM Required | Recommended Container Size | -| ------------------------- | ---------------- | --------------------- | -------------------------- | -| Stable Diffusion XL | `sdxl` | 8 GB | 15 GB | -| Stable Diffusion 3 Medium | `sd3` | 5 GB | 20 GB | -| FLUX.1 Schnell | `flux1-schnell` | 24 GB | 30 GB | -| FLUX.1 dev | `flux1-dev` | 24 GB | 30 GB | -| Base (No models) | `base` | N/A | 5 GB | +| Model | Image Tag Suffix | Minimum VRAM Required | Recommended Container Size | +| ------------------------- | -------------------- | --------------------- | -------------------------- | +| Stable Diffusion XL | `sdxl` | 8 GB | 15 GB | +| Stable Diffusion 3 Medium | `sd3` | 5 GB | 20 GB | +| FLUX.1 Schnell | `flux1-schnell` | 24 GB | 30 GB | +| FLUX.1 dev | `flux1-dev` | 24 GB | 30 GB | +| FLUX.1 dev kontext | `flux1-kontext` | 24 GB | 30 GB | +| Base (No models) | `base` | N/A | 5 GB | _Note: Container sizes are approximate and might vary slightly. Custom images will vary based on included models/nodes._ diff --git a/test_resources/workflows/workflow_flux1_dev_kontext.json b/test_resources/workflows/workflow_flux1_dev_kontext.json new file mode 100644 index 00000000..85475f5f --- /dev/null +++ b/test_resources/workflows/workflow_flux1_dev_kontext.json @@ -0,0 +1,166 @@ +{ + "input": { + "workflow": { + "5": { + "inputs": { + "width": 1024, + "height": 1024, + "batch_size": 1 + }, + "class_type": "EmptyLatentImage", + "_meta": { + "title": "Empty Latent Image" + } + }, + "6": { + "inputs": { + "text": "grey cat wearing a harry potter hat and programming in javascript in its ultramodern computer", + "clip": [ + "11", + 0 + ] + }, + "class_type": "CLIPTextEncode", + "_meta": { + "title": "CLIP Text Encode (Prompt)" + } + }, + "8": { + "inputs": { + "samples": [ + "13", + 0 + ], + "vae": [ + "10", + 0 + ] + }, + "class_type": "VAEDecode", + "_meta": { + "title": "VAE Decode" + } + }, + "9": { + "inputs": { + "filename_prefix": "ComfyUI", + "images": [ + "8", + 0 + ] + }, + "class_type": "SaveImage", + "_meta": { + "title": "Save Image" + } + }, + "10": { + "inputs": { + "vae_name": "ae.safetensors" + }, + "class_type": "VAELoader", + "_meta": { + "title": "Load VAE" + } + }, + "11": { + "inputs": { + "clip_name1": "t5xxl_fp8_e4m3fn.safetensors", + "clip_name2": "clip_l.safetensors", + "type": "flux" + }, + "class_type": "DualCLIPLoader", + "_meta": { + "title": "DualCLIPLoader" + } + }, + "12": { + "inputs": { + "unet_name": "flux1-kontext-dev.safetensors", + "weight_dtype": "default" + }, + "class_type": "UNETLoader", + "_meta": { + "title": "Load Diffusion Model" + } + }, + "13": { + "inputs": { + "noise": [ + "25", + 0 + ], + "guider": [ + "22", + 0 + ], + "sampler": [ + "16", + 0 + ], + "sigmas": [ + "17", + 0 + ], + "latent_image": [ + "5", + 0 + ] + }, + "class_type": "SamplerCustomAdvanced", + "_meta": { + "title": "SamplerCustomAdvanced" + } + }, + "16": { + "inputs": { + "sampler_name": "euler" + }, + "class_type": "KSamplerSelect", + "_meta": { + "title": "KSamplerSelect" + } + }, + "17": { + "inputs": { + "scheduler": "sgm_uniform", + "steps": 4, + "denoise": 1, + "model": [ + "12", + 0 + ] + }, + "class_type": "BasicScheduler", + "_meta": { + "title": "BasicScheduler" + } + }, + "22": { + "inputs": { + "model": [ + "12", + 0 + ], + "conditioning": [ + "6", + 0 + ] + }, + "class_type": "BasicGuider", + "_meta": { + "title": "BasicGuider" + } + }, + "25": { + "inputs": { + "noise_seed": 108076821791990 + }, + "class_type": "RandomNoise", + "_meta": { + "title": "RandomNoise" + } + } + } + } +} \ No newline at end of file