-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[tests] refactor b* pipeline tests #14625
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
Open
sayakpaul
wants to merge
1
commit into
main
Choose a base branch
from
b-pipeline-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+79
−13
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,9 @@ | |
| from ...testing_utils import assert_tensors_close, torch_device | ||
| from ..testing_utils import ( | ||
| BasePipelineTesterConfig, | ||
| PipelineOffloadTesterMixin, | ||
| LoraMemoryTesterMixin, | ||
| LoraTesterMixin, | ||
| MemoryTesterMixin, | ||
| PipelineTesterMixin, | ||
| ) | ||
|
|
||
|
|
@@ -73,7 +75,17 @@ def get_dummy_components(self): | |
| z_dim=16, | ||
| ) | ||
| scheduler = FlowMatchEulerDiscreteScheduler() | ||
| text_encoder = SmolLM3ForCausalLM(SmolLM3Config(hidden_size=32)) | ||
| text_encoder = SmolLM3ForCausalLM( | ||
| SmolLM3Config( | ||
| hidden_size=32, | ||
| intermediate_size=64, | ||
| num_hidden_layers=2, | ||
| num_attention_heads=2, | ||
| num_key_value_heads=1, | ||
| # `vocab_size` stays at the SmolLM3 default: the pipeline hardcodes the beginning-of-text id | ||
| # (128000) for empty prompts, so a smaller vocabulary would not be a valid text encoder here. | ||
| ) | ||
| ) | ||
| tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5") | ||
|
|
||
| return { | ||
|
|
@@ -111,7 +123,7 @@ def test_inference(self): | |
| assert generated_image.shape == self.output_shape | ||
|
|
||
| # fmt: off | ||
| expected_slice = torch.tensor([0.5615, 0.4469, 0.4043, 0.4312, 0.3783, 0.4426, 0.4081, 0.4446, 0.6549, 0.6302, 0.6324, 0.5871, 0.6117, 0.6647, 0.5871, 0.6246]) | ||
| expected_slice = torch.tensor([0.5594, 0.4469, 0.4011, 0.4329, 0.3747, 0.4408, 0.4074, 0.4452, 0.6472, 0.6353, 0.6258, 0.5867, 0.6104, 0.6624, 0.5824, 0.6277]) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a small text encoder, that is why. |
||
| # fmt: on | ||
|
|
||
| generated_slice = generated_image.flatten() | ||
|
|
@@ -233,5 +245,22 @@ def test_bria_fibo_edit_mask_no_image(self): | |
| pipe(**inputs) | ||
|
|
||
|
|
||
| class TestBriaFiboEditPipelineMemory(BriaFiboEditPipelineTesterConfig, PipelineOffloadTesterMixin): | ||
| pass | ||
| class TestBriaFiboEditPipelineMemory(BriaFiboEditPipelineTesterConfig, MemoryTesterMixin): | ||
| """Memory optimization tests (CPU offload, group offload, layerwise casting) for the Bria FIBO Edit pipeline.""" | ||
|
|
||
|
|
||
| class TestBriaFiboEditPipelineLoRA(BriaFiboEditPipelineTesterConfig, LoraTesterMixin): | ||
| """LoRA tests for the Bria FIBO Edit pipeline.""" | ||
|
|
||
| @pytest.mark.skip( | ||
| "`_load_lora_into_text_encoder` only infers per-module ranks for CLIP-style names " | ||
| "(`.q_proj`/`.k_proj`/`.v_proj`/`.out_proj`/`.fc1`/`.fc2`, see `src/diffusers/loaders/lora_base.py`), so the " | ||
| "LLaMA-style `.o_proj` on the SmolLM3 text encoder falls back to the default rank and the non-uniform " | ||
| "`rank_pattern` this test builds cannot round-trip." | ||
| ) | ||
| def test_simple_inference_with_partial_text_lora(self): | ||
| pass | ||
|
|
||
|
|
||
| class TestBriaFiboEditPipelineLoRAMemory(BriaFiboEditPipelineTesterConfig, LoraMemoryTesterMixin): | ||
| """LoRA x memory-optimization tests (group offload, CPU offload) for the Bria FIBO Edit pipeline.""" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Using a small text encoder that is why