-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[tests] refactor o and p series pipeline tests #14646
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
2
commits into
main
Choose a base branch
from
o-p-series-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.
+1,796
−3,095
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ | |
| AutoencoderKL, | ||
| DDIMScheduler, | ||
| MotionAdapter, | ||
| StableDiffusionPipeline, | ||
|
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. Just import level changes in the animdatediff series because we moved the |
||
| UNet2DConditionModel, | ||
| ) | ||
|
|
||
|
|
@@ -22,16 +21,15 @@ | |
| torch_device, | ||
| ) | ||
| from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS | ||
| from ..test_pipelines_common import PipelineFromPipeTesterMixin | ||
| from ..testing_utils import ( | ||
| FromPipeTesterMixin, | ||
| IPAdapterTesterMixin, | ||
| LoraMemoryTesterMixin, | ||
| LoraTesterMixin, | ||
| MemoryTesterMixin, | ||
| UNetLoraTesterMixin, | ||
| ) | ||
| from .testing_utils import ( | ||
| FROM_PIPE_SKIP_REASON, | ||
| FreeInitTesterMixin, | ||
| FreeNoiseSplitInferenceTesterMixin, | ||
| MotionPipelineTesterConfig, | ||
|
|
@@ -128,32 +126,6 @@ class TestAnimateDiffPipeline( | |
| FreeInitTesterMixin, | ||
| FreeNoiseSplitInferenceTesterMixin, | ||
| ): | ||
| def test_from_pipe_consistent_config(self): | ||
| original_repo = "hf-internal-testing/tinier-stable-diffusion-pipe" | ||
|
|
||
| # create StableDiffusionPipeline | ||
| pipe_original = StableDiffusionPipeline.from_pretrained(original_repo, requires_safety_checker=False) | ||
|
|
||
| # StableDiffusionPipeline -> AnimateDiffPipeline | ||
| pipe_components = self.get_dummy_components() | ||
| pipe_additional_components = { | ||
| name: component for name, component in pipe_components.items() if name not in pipe_original.components | ||
| } | ||
| pipe = self.pipeline_class.from_pipe(pipe_original, **pipe_additional_components) | ||
|
|
||
| # AnimateDiffPipeline -> StableDiffusionPipeline | ||
| original_pipe_additional_components = {} | ||
| for name, component in pipe_original.components.items(): | ||
| if name not in pipe.components or not isinstance(component, pipe.components[name].__class__): | ||
| original_pipe_additional_components[name] = component | ||
|
|
||
| pipe_original_2 = StableDiffusionPipeline.from_pipe(pipe, **original_pipe_additional_components) | ||
|
|
||
| # compare the config | ||
| original_config = {k: v for k, v in pipe_original.config.items() if not k.startswith("_")} | ||
| original_config_2 = {k: v for k, v in pipe_original_2.config.items() if not k.startswith("_")} | ||
| assert original_config_2 == original_config | ||
|
|
||
| def test_dict_tuple_outputs_equivalent(self, expected_slice=None, expected_max_difference=1e-4): | ||
| if torch_device == "cpu" and expected_slice is None: | ||
| # fmt: off | ||
|
|
@@ -244,10 +216,7 @@ def test_animatediff(self): | |
| assert numpy_cosine_similarity_distance(image_slice.flatten(), expected_slice.flatten()) < 1e-3 | ||
|
|
||
|
|
||
| @pytest.mark.skip(FROM_PIPE_SKIP_REASON) | ||
| class TestAnimateDiffPipelineFromPipe(AnimateDiffPipelineTesterConfig, PipelineFromPipeTesterMixin): | ||
| """`from_pipe` forward-pass parity and offload round trip for the AnimateDiff pipeline. | ||
| class TestAnimateDiffPipelineFromPipe(AnimateDiffPipelineTesterConfig, FromPipeTesterMixin): | ||
| """`from_pipe` round-trip tests against `StableDiffusionPipeline` for the AnimateDiff pipeline.""" | ||
|
|
||
| Parked, not deleted: `test_from_pipe_consistent_config` runs for real as a method on the main test class above, | ||
| but the forward-pass checks in `PipelineFromPipeTesterMixin` have no pytest-style equivalent yet. | ||
| """ | ||
| original_pipeline_repo = "hf-internal-testing/tinier-stable-diffusion-pipe" | ||
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
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.
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.
I think it's better to xfail things where we need core changes while doing test PRs. xfail is better than skipping the tests.