Skip to content

resolve an error when floats are provided for resolution values - #7537

Closed
bghira wants to merge 15 commits into
huggingface:mainfrom
bghira:bugfix/float-resolution-params
Closed

bghira wants to merge 15 commits into
huggingface:mainfrom
bghira:bugfix/float-resolution-params

Conversation

@bghira

@bghira bghira commented Mar 31, 2024

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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

DN6 commented Apr 1, 2024

Copy link
Copy Markdown
Collaborator

@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

bghira commented Apr 1, 2024

Copy link
Copy Markdown
Contributor Author

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

@DN6 DN6 left a comment •

Copy link
Copy Markdown
Collaborator

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

bghira commented Apr 1, 2024

Copy link
Copy Markdown
Contributor Author

done

@DN6

DN6 commented Apr 2, 2024

Copy link
Copy Markdown
Collaborator

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

@bghira

bghira commented Apr 2, 2024

Copy link
Copy Markdown
Contributor Author

you said to run make quality

@yiyixuxu

Copy link
Copy Markdown
Collaborator

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

@bghira

bghira commented Apr 12, 2024

Copy link
Copy Markdown
Contributor Author

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

DN6 commented Apr 15, 2024

Copy link
Copy Markdown
Collaborator

@bghira What version of ruff do you have installed?

@bghira

bghira commented Apr 15, 2024

Copy link
Copy Markdown
Contributor Author

0.3.4

@bghira bghira closed this Apr 15, 2024
@bghira bghira reopened this Apr 15, 2024
@DN6

DN6 commented Apr 15, 2024

Copy link
Copy Markdown
Collaborator

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

bghira commented Apr 15, 2024

Copy link
Copy Markdown
Contributor Author

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

@bghira

bghira commented Apr 15, 2024

Copy link
Copy Markdown
Contributor Author

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

@DN6

DN6 commented Apr 15, 2024

Copy link
Copy Markdown
Collaborator

@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

DN6 commented Apr 16, 2024 •

Copy link
Copy Markdown
Collaborator

@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

bghira commented Apr 16, 2024

Copy link
Copy Markdown
Contributor Author

sure

@yiyixuxu

Copy link
Copy Markdown
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