[tests] migrate lora tests for pipelines to use new mixins - #14268
[tests] migrate lora tests for pipelines to use new mixins#14268sayakpaul wants to merge 15 commits into
Conversation
| class TestFluxPipelineLoRA(FluxPipelineTesterConfig, LoraTesterMixin): | ||
| """LoRA tests for the Flux pipeline.""" | ||
|
|
||
| def test_with_alpha_in_state_dict(self, tmp_path, denoiser_lora_config): |
There was a problem hiding this comment.
These are all very specific to Flux.
| from diffusers.pipelines.ace_step import AceStepConditionEncoder, AceStepPipeline | ||
| from diffusers.utils.import_utils import is_peft_available | ||
|
|
||
| from ..testing_utils import ( |
There was a problem hiding this comment.
The changes in the test_lora_layers_*.py (except for Flux), are related to the fact that some tests didn't really belong at the pipeline-level and are better off in the model-level (tests/models/testing_utils/lora.py).
|
|
||
|
|
||
| class TestSanaTransformerLoRA(SanaTransformerTesterConfig, LoraTesterMixin): | ||
| @pytest.mark.skipif(IS_GITHUB_ACTIONS, reason="Skipping test inside GitHub Actions environment") |
There was a problem hiding this comment.
Any idea what the underlying issue is here?
There was a problem hiding this comment.
Because the conv kernel is missing for the matmuls needed on our CI runners.
|
|
||
| @require_peft_version_greater("0.13.1") | ||
| @torch.no_grad() | ||
| def test_lora_low_cpu_mem_usage_with_injection(self): |
There was a problem hiding this comment.
Here it feels like we're testing PEFT functionality rather than diffusers?
There was a problem hiding this comment.
Yes but this is also interfaced in our model classes which is why the tests.
|
@DN6 very reasonable asks. I have addressed all of them along with some further improvements. |
tests/models/testing_utils/lora.py, this PR introduces atests/pipelines/testing_utils/lora.py. The newly introduced mixins follow the same principles as the existing ones. This PR only migrates the pipeline-level LoRA tests for Flux. Others will follow in a different PR.tests/lora/utils.pythere are better tested at the model-level. This PR migrates those fromtests/lora/utils.pytotests/models/testing_utils/lora.py.LoRATesterMixinfromtests/models/testing_utils/lora.pywhich were previously being tested through pipelines intests/lora.