Skip to content

feat: extended flora to flux, added fora_backbone_calls_per_step parameter #494

Merged
try1233 merged 5 commits intomainfrom
new_branch
Jan 20, 2026
Merged

feat: extended flora to flux, added fora_backbone_calls_per_step parameter #494
try1233 merged 5 commits intomainfrom
new_branch

Conversation

@try1233
Copy link
Contributor

@try1233 try1233 commented Jan 16, 2026

Description

Added flux2 compatibility to fora, as well as fora torch compile logic. Added CFG logic to fora.

Related Issue

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Ran it with flux 1dev, flux2klein 4b and flux2klein 4b base to test backwards compatibility, and the compatibility of the backbone_calls_per_step with all three models.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

test_fora_flux2klein.ipynb

@try1233 try1233 requested a review from minettekaum January 16, 2026 17:32
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

model.vae = compile_callable(model.vae, smash_config)
#model.text_encoder = compile_callable(model.text_encoder, smash_config)
#model.text_encoder_2 = compile_callable(model.text_encoder_2, smash_config)
#model.vae = compile_callable(model.vae, smash_config)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally committed commented-out compilation code

Medium Severity

The compilation of text_encoder, text_encoder_2, and vae in fora_logic has been commented out rather than deleted. The analogous deepcache_logic function still compiles these components (lines 332-333). This appears to be debugging code that was accidentally left in, reducing the optimization benefits of torch_compile when used with FORA-enabled models. The PR description doesn't mention intentionally removing this compilation.

Fix in Cursor Fix in Web

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -0,0 +1,640 @@
{
Copy link
Contributor

@minettekaum minettekaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a information on how to down load install pruna.

# if you are not running the latest version of this tutorial, make sure to install the matching version of pruna

# the following command will install the latest version of pruna

%pip install pruna


Reply via ReviewNB

@@ -0,0 +1,640 @@
{
Copy link
Contributor

@minettekaum minettekaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 Instead of having this as a comment

#Login to HuggingFace (required for Flux2 model access)

To have it as text before the code block and link to the model:https://huggingface.co/black-forest-labs/FLUX.2-klein-4B

Then, have the code regarding the unoptimized model. So loading it, prompting, benchmark baseline. And after that, the optimisation of the model and results.


Reply via ReviewNB

@@ -0,0 +1,640 @@
{
Copy link
Contributor

@minettekaum minettekaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import the smash_configs from pruna here.


Reply via ReviewNB

@@ -0,0 +1,640 @@
{
Copy link
Contributor

@minettekaum minettekaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be good to add why we do the cleanups.


Reply via ReviewNB

@@ -0,0 +1,640 @@
{
Copy link
Contributor

@minettekaum minettekaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A summary of what has happened in this tutorial. Something like this

"In this tutorial, we demonstrated a standard workflow for optimizing and evaluating an image generation model using Pruna.

We defined our optimization strategy using the SmashConfig object and applied it to the model with the smash function.

The results show that we can significantly improve runtime performance while maintaining a high level of output quality."


Reply via ReviewNB

Copy link
Contributor

@minettekaum minettekaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all, it looks good to me. I added some comments about the tutorial's order and a bit more elaboration 😄

@try1233 try1233 merged commit 148da61 into main Jan 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants