[core] Refactor condition embedders (and others) modules from pipelines#13781
[core] Refactor condition embedders (and others) modules from pipelines#13781sayakpaul wants to merge 17 commits into
pipelines#13781Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import torch |
There was a problem hiding this comment.
Open to suggestions on where to place these other than others.
| @@ -0,0 +1,476 @@ | |||
| # Copyright 2025 The ACE-Step Team and The HuggingFace Team. All rights reserved. | |||
There was a problem hiding this comment.
Going by the implementation of the module, it encodes into a tokenized representation (not the existing sense of tokenization done in language models). So, decided keep them under autoencoders.
| @@ -0,0 +1,192 @@ | |||
| # Copyright 2025 Lightricks and The HuggingFace Team. All rights reserved. | |||
There was a problem hiding this comment.
Open to moving them elsewhere. Since upsampling could be interpreted as decoding to a higher resolution, I thought of keeping them under autoencoders.
|
|
||
| # Reroutes pretrained loads past pipeline-local deprecation shims onto the canonical | ||
| # top-level diffusers export. | ||
| _RELOCATED_PIPELINE_CLASSES: dict[tuple[str, str], tuple[str, str]] = { |
There was a problem hiding this comment.
This is so that we don't hit deprecation warnings.
What does this PR do?
We have a bunch of model-level components under
src/diffusers/pipelinesmodule. This PR factors them out of thepipelinesmodule and places them undersrc/diffusers/modelsmodule strategically.The main changes are in
src/pipelines/pipeline_loading_utils.pywhich basically remaps to the components that were moved tosrc/diffusersmodels/. Open to other ways of handling it.For reviewers
Main changes can be summarized as follows:
audio_tokenizer_ace_step.py) tosrc/diffusers/modelsand deprecate gracefully.autoencodersandcondition_embedders. When I wasn't sure, I simply placed them underothers. No strong opinions here.scripts/smoke_test_relocated_pretrained.pyis for transient testing until the PR is merged. Will delete it after. I have run the tests and models and pipelines load as expected.tests/models/test_relocated_class_loading.pywhich will check if deprecation warnings are raised and will also help to remove those deprecation paths once the cycle is over.tests/pipelines/test_relocated_class_loading.py. It ensures that no deprecation warnings for the refactored modules are raised when loading the affected pipelines.