Skip to content

[tests] refactor flux control lora tests - #14557

Merged
sayakpaul merged 4 commits into
mainfrom
flux-control-lora-refactor
Aug 25, 2026
Merged

[tests] refactor flux control lora tests#14557
sayakpaul merged 4 commits into
mainfrom
flux-control-lora-refactor

Conversation

@sayakpaul

Copy link
Copy Markdown
Member

Following #14268

@sayakpaul
sayakpaul requested a review from dg845 August 21, 2026 08:32
@github-actions github-actions Bot added tests size/L PR with diff > 200 LOC labels Aug 21, 2026

@dg845 dg845 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Left some small comments.

)


class TestFluxControlPipelineMemory(FluxControlPipelineTesterConfig, MemoryTesterMixin):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we also have tests from LoraMemoryTesterMixin? The base Flux tests has these:

class TestFluxPipelineLoRAMemory(FluxPipelineTesterConfig, LoraMemoryTesterMixin):
"""LoRA x memory-optimization tests (group offload, CPU offload, layerwise casting) for the Flux pipeline."""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Control tests din't ever test those. So, I guess it's fine to not have it now.


# This should be initialized with a Flux pipeline variant that doesn't accept `control_image`.
components["transformer"] = transformer
pipe = FluxPipeline(**components).to(torch_device)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: if I understand correctly, the components here will all be in train mode initially since get_dummy_components creates them in train mode, so pipe has all components in train mode. However, because get_pipeline sets all components to eval mode, control_pipe below has all components in eval mode. This creates a train vs eval mismatch between original_out and lora_out. Since hf-internal-testing/tiny-random-t5 uses "dropout_rate": 0.1, this means that original_out is computed with dropout but lora_out is not.

The test is still passes even with the mismatch, but should we explicitly set the components to eval mode here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's fine because we're not asserting against a precomputed value slice.

inputs = self.get_dummy_inputs(device)
image = pipe(**inputs).images
original_image_slice = image[0, -3:, -3:, -1]
image_slice = self.run_pipe(pipe)[0, -3:, -3:, -1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since we're now setting output_type to "pt" rather than "np", should we update the image_slice here? outpput_type="pt" creates a channels-first output (batch, channels, height, width) as noted in get_dummy_inputs, so we're taking a weird slice of the output currently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah but we are not asserting against a precomputed slice here which is why the testing is doing fine. But I will change it for consistency standards, thanks!

@sayakpaul
sayakpaul merged commit a949d3d into main Aug 25, 2026
11 of 14 checks passed
@sayakpaul
sayakpaul deleted the flux-control-lora-refactor branch August 25, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PR with diff > 200 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants