A ComfyUI custom node that implements DyPE (Dynamic Position Extrapolation), enabling FLUX-based models to generate ultra-high-resolution images (4K and beyond) with exceptional coherence and detail.
Report Bug
·
Request Feature
A simple, single-node integration to patch your FLUX model for high-resolution generation.
══════════════════════════════════
Beyond the code, I believe in the power of community and continuous learning. I invite you to join the 'TokenDiff AI News' and 'TokenDiff Community Hub'
TokenDiff AI News🗞️ AI for every home, creativity for every mind! |
TokenDiff Community Hub💬 questions, help, and thoughtful discussion. |
══════════════════════════════════
## 🚀 Getting Started The easiest way to install is via **ComfyUI Manager**. Search for `ComfyUI-DyPE` and click "Install". Alternatively, to install manually: 1. **Clone the Repository:** Navigate to your `ComfyUI/custom_nodes/` directory and clone this repository: ```sh git clone https://github.com/wildminder/ComfyUI-DyPE.git ``` 2. **Start/Restart ComfyUI:** Launch ComfyUI. No further dependency installation is required. ## 🛠️ Usage Using the node is straightforward and designed for minimal workflow disruption. 1. **Load Your FLUX Model:** Use a standard `Load Checkpoint` node to load your FLUX model (e.g., `FLUX.1-Krea-dev`). 2. **Add the DyPE Node:** Add the `DyPE for FLUX` node to your graph (found under `model_patches/unet`). 3. **Connect the Model:** Connect the `MODEL` output from your loader to the `model` input of the DyPE node. 4. **Set Resolution:** Set the `width` and `height` on the DyPE node to match the resolution of your `Empty Latent Image`. 5. **Connect to KSampler:** Use the `MODEL` output from the DyPE node as the input for your `KSampler`. 6. **Generate!** That's it. Your workflow is now DyPE-enabled. > [!NOTE] > This node specifically patches the **diffusion model (UNet)**. It does not modify the CLIP or VAE models. It is designed exclusively for **FLUX-based** architectures. ### Node Inputs * **`model`**: The FLUX model to be patched. * **`width` / `height`**: The target image resolution. **This must match the resolution set in your `Empty Latent Image` node.** * **`method`**: The core position encoding extrapolation method. `yarn` is the recommended default, as it forms the basis of the paper's best-performing "DY-YaRN" variant. * **`enable_dype`**: Enables or disables the **dynamic, time-aware** component of DyPE. * **Enabled (True):** Both the noise schedule and RoPE will be dynamically adjusted throughout sampling. This is the full DyPE algorithm. * **Disabled (False):** The node will only apply the dynamic noise schedule shift. The RoPE will use a static extrapolation method (e.g., standard YARN). This can be useful for comparison or if you find it works better at certain moderate resolutions. * **`dype_exponent`**: (λt) Controls the "strength" of the dynamic effect over time. This is the most important tuning parameter. * `2.0` (Exponential): Recommended for **4K+** resolutions. It's an aggressive schedule that transitions quickly. * `1.0` (Linear): A good starting point for **~2K-3K** resolutions. * `0.5` (Sub-linear): A gentler schedule that may work best for resolutions just above the model's native 1K. * **`base_shift` / `max_shift`** (Advanced): These parameters control the interpolation of the dynamic noise schedule shift (`mu`). The default values (`0.5`, `1.15`) are taken directly from the FLUX architecture and are generally optimal. Adjust only if you are an advanced user experimenting with the noise schedule. > [!WARNING] > It seems the width/height parameters in the node are buggy. Keep the values below 1024x1024; doing so won’t affect your output. ## ⚠️ Known Issues and Limitations * **FLUX Only:** This implementation is highly specific to the architecture of the FLUX model and will not work on standard U-Net models (like SD 1.5/SDXL) or other Diffusion Transformers. * **Parameter Tuning:** The optimal `dype_exponent` can vary based on your target resolution. Experimentation is key to finding the best setting for your use case. The default of `2.0` is optimized for 4K. ## License The original DyPE project is patent pending. For commercial use or licensing inquiries regarding the underlying method, please contact the [original authors](mailto:noam.issachar@mail.huji.ac.il). ## Acknowledgments * **Noam Issachar, Guy Yariv, and the co-authors** for their groundbreaking research and for open-sourcing the [DyPE](https://github.com/guyyariv/DyPE) project. * **The ComfyUI team** for creating such a powerful and extensible platform for diffusion model research and creativity. [stars-shield]: https://img.shields.io/github/stars/wildminder/ComfyUI-DyPE.svg?style=for-the-badge [stars-url]: https://github.com/wildminder/ComfyUI-DyPE/stargazers [issues-shield]: https://img.shields.io/github/issues/wildminder/ComfyUI-DyPE.svg?style=for-the-badge [issues-url]: https://github.com/wildminder/ComfyUI-DyPE/issues [forks-shield]: https://img.shields.io/github/forks/wildminder/ComfyUI-DyPE.svg?style=for-the-badge [forks-url]: https://github.com/wildminder/ComfyUI-DyPE/network/members