-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Feature: Add DyPE (Dynamic Position Extrapolation) support to FLUX models for improved high-resolution image generation #8763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add detailed plan for porting ComfyUI-DyPE (Dynamic Position Extrapolation) to InvokeAI, enabling 4K+ image generation with FLUX models without training. Estimated effort: 5-7 developer days.
- Integrate DyPE directly into FluxDenoise (no separate node) - Add 4K preset and "auto" mode for automatic activation - Confirm FLUX Schnell support (same base resolution as Dev)
FLUX can handle resolutions up to ~1.5x natively without artifacts. Set activation_threshold=1536 so DyPE only kicks in above that.
Add Dynamic Position Extrapolation (DyPE) support to FLUX models, enabling artifact-free generation at 4K+ resolutions. New files: - invokeai/backend/flux/dype/base.py: DyPEConfig and scaling calculations - invokeai/backend/flux/dype/rope.py: DyPE-enhanced RoPE functions - invokeai/backend/flux/dype/embed.py: DyPEEmbedND position embedder - invokeai/backend/flux/dype/presets.py: Presets (off, auto, 4k) - invokeai/backend/flux/extensions/dype_extension.py: Pipeline integration Modified files: - invokeai/backend/flux/denoise.py: Add dype_extension parameter - invokeai/app/invocations/flux_denoise.py: Add UI parameters UI parameters: - dype_preset: off | auto | 4k - dype_scale: Custom magnitude override (0-8) - dype_exponent: Custom decay speed override (0-1000) Auto mode activates DyPE for resolutions > 1536px. Based on: https://github.com/wildminder/ComfyUI-DyPE
Merged main to get latest changes including: - FLUX scheduler support (heun, lcm) - Z-Image Seed Variance Enhancer - Canvas transform smoothing - Various fixes and improvements DyPE now works with both the original Euler sampler and the new diffusers scheduler support.
Add Linear UI integration for FLUX DyPE (Dynamic Position Extrapolation): - Add ParamFluxDypePreset component with Off/Auto/4K options - Integrate preset selector in GenerationSettingsAccordion for FLUX models - Add state management (paramsSlice, types) for fluxDypePreset - Add dype_preset to FLUX denoise graph builder and metadata - Add translations for DyPE preset label and popover - Add zFluxDypePresetField schema definition Fix DyPE frequency computation: - Remove incorrect mscale multiplication on frequencies - Use only NTK-aware theta scaling for position extrapolation
- Add FluxDypePreset handler to ImageMetadataHandlers - Parse dype_preset from metadata and dispatch setFluxDypePreset on recall - Add translation key metadata.dypePreset
Remove internal planning document from the branch.
| activation_threshold: int = 1536, | ||
| ) -> DyPEConfig | None: | ||
| """Automatically determine DyPE config based on target resolution. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you experimented with looking at the area of the desired image and comparing to the base area instead of a pure dimensional comparison? Curious if this yields better results for something like 1152x1440 images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pfannkuchensack Wanted to make sure you saw this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did saw it but i did not experimented with anything else beside the implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is this activation threshold part of the reference implementation then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the implementation I did. I looked at common flux resolutions and then increased the bar a bit.
Version bump for dype_preset field addition.
|
I also wonder if this should be part of the standard metadata that can be recalled. Thoughts? |
Summary
Add DyPE (Dynamic Position Extrapolation) support to FLUX models for improved high-resolution image generation.
Features:
Technical Details:
theta_scaled = theta * scale^(dim/(dim-2))Related Issues / Discussions
DyPE paper: Dynamic Position Extrapolation for high-resolution diffusion models
QA Instructions
Merge Plan
Standard merge. Redux slice changes include new
fluxDypePresetstate field.Checklist
What's Newcopy (if doing a release after this PR)