diff --git a/docs.json b/docs.json index 07d49c61..2c4b48de 100644 --- a/docs.json +++ b/docs.json @@ -231,6 +231,7 @@ { "group": "Pods", "pages": [ + "tutorials/pods/comfyui-flux", "tutorials/pods/run-your-first", "tutorials/pods/run-fooocus", "tutorials/pods/run-ollama", diff --git a/tutorials/pods/comfyui-flux.mdx b/tutorials/pods/comfyui-flux.mdx new file mode 100644 index 00000000..0f9f7e39 --- /dev/null +++ b/tutorials/pods/comfyui-flux.mdx @@ -0,0 +1,168 @@ +--- +title: "Generate images with ComfyUI and Flux" +sidebarTitle: "Generate images with ComfyUI" +description: "Deploy ComfyUI on RunPod to create AI-generated images." +--- + +Learn how to set up ComfyUI on RunPod Pods and generate images using the Flux text-to-image model. + +## What you'll learn + +In this tutorial you'll learn how to: + +- Deploy a Pod with ComfyUI pre-installed. +- Connect to the ComfyUI web interface. +- Import and use Flux workflows. +- Generate your first AI image. + +## Requirements + +Before you begin, you'll need: + +- A [RunPod account](/get-started/manage-accounts). +- At least $10 in credits. +- Basic understanding of AI image generation. + +## Overview of ComfyUI and Flux + +**ComfyUI** is a node-based graphical interface for creating AI image generation workflows. Instead of writing code, you connect different components visually to build custom image generation pipelines. This approach provides flexibility to experiment with various models and techniques while maintaining an intuitive interface. + +**Flux** is a state-of-the-art text-to-image AI model developed by Black Forest Labs. It generates high-quality images from text descriptions and comes in three versions: + +- **Flux 1 Pro**: Premium version available through API access. +- **Flux 1 Dev**: Open-weight model for non-commercial experimentation. +- **Flux 1 Schnell**: Fast, open-source model requiring only 4 generation steps. + +## Step 1: Deploy a ComfyUI Pod + +First, deploy a Pod with ComfyUI and Flux models pre-configured: + + + + Go to the [ComfyUI with Flux template](https://www.runpod.io/console/explore/y1vexvzg7r) in the RunPod console. + + + + Click **Deploy** and configure these settings: + + - **GPU selection:** Choose an L40 or RTX 4090 for optimal performance with Flux models. Lower VRAM GPUs may work for smaller projects. + - **Storage:** The default container and disk volume sizes should be sufficient for Flux Dev. + - **Deployment type:** Select **On-Demand** for flexibility. + + + + Click **Deploy On-Demand** to create your Pod. + + The Pod will take up to 30 minutes to initialize the container, download the Flux models, and start the ComfyUI service. + + + +## Step 2: Connect to ComfyUI + +Once your Pod is running, connect to the ComfyUI interface: + +1. Navigate to the [Pods section](https://www.runpod.io/console/pods) in the RunPod console. +2. Find your deployed Pod in the list. +3. Click **Connect** on your Pod. +4. Select **Connect to HTTP Service [Port 7860]**. + +This opens the ComfyUI interface in a new browser tab. The URL follows the format: `https://[pod-id]-7860.proxy.runpod.net`. + + +If you see an error when first connecting, wait 2-3 minutes for the service to fully start, then refresh the page. + + +## Step 3: Import a Flux workflow + +ComfyUI uses workflows to define the image generation process. To import a pre-configured Flux workflow: + + + + Visit the [flux-runpod repository](https://github.com/camenduru/flux-runpod/tree/main), locate the `Flux.1-Dev-ComfyUI.json` file, and click the download button in the top right corner of the code block. + + + + In the ComfyUI interface, click **Load** in the bottom right corner and select the downloaded `Flux.1-Dev-ComfyUI.json` file. The workflow loads automatically, displaying connected nodes for the Flux pipeline. + + + +## Step 4: Generate your first image + +With the workflow loaded, you're ready to generate images: + + + + Locate the text input node labeled "prompt" in the workflow. + + Click on the text field containing the default prompt and replace it with your desired image description. + + Example prompts: + - "A serene mountain landscape at sunset with a crystal clear lake" + - "A futuristic cityscape with neon lights and flying vehicles" + - "A detailed portrait of a robot reading a book in a library" + + + + Click **Queue Prompt** to begin the image generation process. + + Watch as the workflow progresses through each node: + - Text encoding. + - Model loading. + - Image generation steps. + - Final output processing. + + + + The generated image appears in the output node when complete. + + Right-click the image to save it to your local machine, view it at full resolution, or copy it to your clipboard. + + + +## Advanced workflow customization + +Once comfortable with basic generation, explore these customization options: + +### Adjust generation parameters + +- **Steps**: Increase for higher quality (Dev model typically uses 20-50 steps). +- **CFG Scale**: Control how closely the model follows your prompt (7-12 is typical). +- **Seed**: Set a specific number for reproducible results. + +### Experiment with different models + +The template includes multiple Flux versions. To switch between them, double-click the model loader node, select a different checkpoint from the dropdown, and then re-run your workflow. + +### Create custom workflows + +Build your own workflows by: + +1. Right-clicking the canvas to add new nodes. +2. Connecting node outputs to inputs by dragging between connection points. +3. Saving your custom workflow using **Save** in the interface. + +## Managing your Pod + +While working with ComfyUI, monitor your usage by checking GPU utilization and generation times in the Pod console. + +Stop your Pod when you're finished to avoid unnecessary charges. + +It's also a good practice to download any custom workflows before stopping the Pod. For persistent storage of models and outputs across sessions, consider using a [network volume](/pods/storage/create-network-volumes). + +## Troubleshooting + +Common issues and solutions: + +- **Connection errors**: Wait for the Pod to fully initialize (up to 30 minutes for first deployment). +- **Out of memory errors**: Reduce image resolution or batch size in your workflow. +- **Slow generation**: Ensure you're using an appropriate GPU for your selected model. +- **Missing models**: The pre-configured template should include all necessary models. If missing, check the Pod logs. + +## Next steps + +Now that you've mastered the basics of running ComfyUI on RunPod: + +- Explore [other AI templates](/pods/templates/overview) available on RunPod. +- Learn about [persistent storage options](/pods/storage/types) for saving your work. +- Connect to your Pod via [SSH](/pods/configuration/use-ssh) for advanced customization. +- Join the [RunPod Discord](https://discord.gg/runpod) to share your creations and get support. \ No newline at end of file