Skip to content

Conversation

@bghira
Copy link
Contributor

@bghira bghira commented Mar 31, 2024

What does this PR do?

Inside prepare_latents, it will crash if a float was inadvertently passed to the pipeline.

This will cast the input values to integers, allowing these situations to proceed.

TypeError: randn(): argument 'size' failed to unpack the object at pos 3 with error "type must be tuple of ints,but got float"

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

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.

@DN6
Copy link
Collaborator

DN6 commented Apr 1, 2024

@bghira The quality checks are likely failing because the prepare_latents method is copied in other pipelines. One option is to apply casting before passing to prepare_latents or change the affected pipelines to cast inside the method. You can run python utils/check_copies.py to find the affected files.

CI message should have been more helpful here. Will take a look into it.

@bghira
Copy link
Contributor Author

bghira commented Apr 1, 2024

@DN6 thanks usually i push a proposed change to get feedback before i copy to the rest. that's done now

Copy link
Collaborator

@DN6 DN6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good to merge once tests pass. @bghira I think you might have to run make style && make quality as well.

@bghira
Copy link
Contributor Author

bghira commented Apr 1, 2024

done

@DN6
Copy link
Collaborator

DN6 commented Apr 2, 2024

@bghira I think some extra files got added here? The examples directory wasn't in the PR earlier?

@bghira
Copy link
Contributor Author

bghira commented Apr 2, 2024

you said to run make quality

@yiyixuxu
Copy link
Collaborator

should we update the dependencies
i.e. pip install -e ".[quality]" again?

@bghira
Copy link
Contributor Author

bghira commented Apr 12, 2024

i don't think there's an issue with those deps per se it's just that the main branch doesn't have the formatting the way it wanted.

@DN6
Copy link
Collaborator

DN6 commented Apr 15, 2024

@bghira What version of ruff do you have installed?

@bghira
Copy link
Contributor Author

bghira commented Apr 15, 2024

0.3.4

@bghira bghira closed this Apr 15, 2024
@bghira bghira reopened this Apr 15, 2024
@DN6
Copy link
Collaborator

DN6 commented Apr 15, 2024

Ah, diffusers ruff is currently pinned

"ruff==0.1.5",

Could you downgrade and run make style && make quality that should take care of the tests.

@bghira
Copy link
Contributor Author

bghira commented Apr 15, 2024

nope... that doesn't fix it. it adds even more changes

@bghira
Copy link
Contributor Author

bghira commented Apr 15, 2024

thank god we tried to fix that one formatting issue, or else this PR wouldn't have 66 files with open changes :)

@DN6
Copy link
Collaborator

DN6 commented Apr 15, 2024

@bghira Just a couple of pipelines that also need to be updated with the int casting.

If you run make fix-copies those should be handled.

Traceback (most recent call last):
  File "utils/check_copies.py", line 222, in <module>
    check_copies(args.fix_and_overwrite)
  File "utils/check_copies.py", line [20](https://github.com/huggingface/diffusers/actions/runs/8690950165/job/23832556622?pr=7537#step:5:21)6, in check_copies
    raise Exception(
Exception: Found the following copy inconsistencies:
- src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py: copy does not match pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents at line 789
- src/diffusers/pipelines/audioldm/pipeline_audioldm.py: copy does not match pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents at line 329
Run `make fix-copies` or `python utils/check_copies.py --fix_and_overwrite` to fix them.

@DN6
Copy link
Collaborator

DN6 commented Apr 16, 2024

@bghira If it's cool with you can I open a separate PR to get this update in and tag you as the author? There are some merge conflicts with your branch because of some recent changes to main and I think the MusicLDM pipeline also needs to have copies fixed.

@bghira
Copy link
Contributor Author

bghira commented Apr 16, 2024

sure

@yiyixuxu
Copy link
Collaborator

completed in #7691

@yiyixuxu yiyixuxu closed this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants