-
-
Notifications
You must be signed in to change notification settings - Fork 483
Magcache Support #1877
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?
Magcache Support #1877
Conversation
Looks interesting. I have two requests:
|
ai_diffusion/workflow.py
Outdated
# Apply MagCache as a model patch if enabled | ||
if checkpoint.magcache_enabled: | ||
if arch in [Arch.flux, Arch.flux_k]: | ||
print(f"Applying MagCache patch for {arch}") |
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.
Please remove all the prints
|
||
model_type = "flux_kontext" if arch is Arch.flux_k else "flux" | ||
|
||
try: |
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.
no need to wrap in try/except, this should not fail (or do so loudly if the code is broken)
ai_diffusion/ui/settings.py
Outdated
else "" | ||
) | ||
|
||
has_wave_speed = hasattr(client.features, 'wave_speed') and client.features.wave_speed |
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.
the hasattr
is not needed
(see also below)
ai_diffusion/api.py
Outdated
@@ -64,7 +63,12 @@ class CheckpointInput: | |||
self_attention_guidance: bool = False | |||
dynamic_caching: bool = False | |||
tiled_vae: bool = False | |||
|
|||
magcache_enabled: bool = False | |||
magcache_thresh: float = 0.24 |
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.
Please remove the parameters also from here and settings.py
.
They can be dug up from git if ever needed, but I'd rather not have them in the code without a good reason.
And if more configurability is desired at some point, a single "strength" value or some preset would be a more user friendly way to control it anyway.
…lear printing messages and other fix
Thanks for Acly's detailed review. I'll try to address these issues. I think we might keep a threshold setting to accommodate models that will use MagCache in the future, but clean up unnecessary code |
Added support for MagCache. It has been tested locally link (custom server) with ComfyUI. MagCache is commonly used in video models such as FramePack and Wan, and it also supports models like Flux and Flux Kontext. This support includes updates to nodes and adjustments to detailed parameters.
https://github.com/Zehong-Ma/ComfyUI-MagCache