[tests] refactor c* pipeline tests. - #14626
Open
sayakpaul wants to merge 2 commits into
Open
Conversation
Migrate the remaining `tests/pipelines/` directories starting with C to the config class + composable pytest mixins introduced in #14113: chroma, chronoedit, cogview3, consisid, consistency_models, controlnet, controlnet_flux, controlnet_hunyuandit, controlnet_sd3 and cosmos. cogvideo and cogview4 were already migrated. Notable points beyond the mechanical conversion: - Expected slices switch from the `"np"` layout (`[0, -3:, -3:, -1]`) to the `"pt"` one (`[0, -1, -3:, -3:]`); the values themselves are unchanged. - The Cosmos `safety_checker` overrides (save/load, variants, dtype dict, encode_prompt) were duplicated across five files and now live in a shared `CosmosSafetyCheckerTesterMixin` in `tests/pipelines/cosmos/testing_utils.py`. - chroma and controlnet_flux import `FluxIPAdapterTesterMixin` from `..flux.testing_utils` rather than the old `..test_pipelines_common` one. - `PipelineTesterMixin.test_save_load_float16` now passes the non-deprecated `dtype=` to `from_pretrained` instead of `torch_dtype=`, which the Cosmos2.5 `from_pretrained` wrappers read when casting the safety checker they inject. - Dropped along the way, matching #14619: `PipelineLatentTesterMixin`, `PipelineKarrasSchedulerTesterMixin`, the attention-slicing and xformers tests, and the `test_ip_adapter` overrides that only supplied an `expected_pipe_slice`. `pytest tests/pipelines/{chroma,chronoedit,cogview3,consisid,consistency_models,controlnet,controlnet_flux,controlnet_hunyuandit,controlnet_sd3,cosmos}` gives 14 failed, 1014 passed, 82 skipped. All 14 failures are in cosmos and reproduce unchanged on main: `DummyCosmosSafetyChecker` is a parameter-less `ModelMixin` with a single non-persistent buffer, so accelerate does not hook it for sequential offload and a reloaded pipeline gets a fresh fp32 one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sayakpaul
commented
Aug 27, 2026
|
|
||
| pipe.save_pretrained(tmp_path) | ||
| pipe_loaded = self.pipeline_class.from_pretrained(tmp_path, torch_dtype=torch.float16) | ||
| pipe_loaded = self.pipeline_class.from_pretrained(tmp_path, dtype=torch.float16) |
Member
Author
There was a problem hiding this comment.
Just promote the use of dtype rather than torch_type.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Similar to #14622