Skip to content

Improve latent diff example #413

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

Merged
merged 4 commits into from
Sep 8, 2022
Merged

Improve latent diff example #413

merged 4 commits into from
Sep 8, 2022

Conversation

satpalsr
Copy link
Contributor

@satpalsr satpalsr commented Sep 8, 2022

Use GPU and improve code
Original Code:

# !pip install diffusers transformers
from diffusers import DiffusionPipeline

model_id = "CompVis/ldm-text2im-large-256"

# load model and scheduler
ldm = DiffusionPipeline.from_pretrained(model_id)

# run pipeline in inference (sample random noise and denoise)
prompt = "A painting of a squirrel eating a burger"
images = ldm([prompt], num_inference_steps=50, eta=0.3, guidance_scale=6).images

# save images
for idx, image in enumerate(images):
    image.save(f"squirrel-{idx}.png")

Generates an error (This PR fixes it):
AttributeError: 'dict' object has no attribute 'images'

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 8, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor

Hey @satpalsr,

The .images attribute will be added today! So the code should work then. Hope it's ok to close for now 😅

@patrickvonplaten
Copy link
Contributor

@satpalsr - actually there were a couple of nice improvements. Could change the image API back to before and leave the rest? Happy to merge then :-)

satpalsr and others added 2 commits September 8, 2022 16:44
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
@satpalsr
Copy link
Contributor Author

satpalsr commented Sep 8, 2022

Thanks for the info. Accepted the suggestions.

@patrickvonplaten patrickvonplaten merged commit f4a785c into huggingface:main Sep 8, 2022
@patrickvonplaten
Copy link
Contributor

Thanks!

@satpalsr satpalsr deleted the ex_latent_diff branch September 9, 2022 04:47
PhaneeshB pushed a commit to nod-ai/diffusers that referenced this pull request Mar 1, 2023
…ingface#413)

* Use IREE tf tools to save .mlir modules when generating shark_tank.

* Add option to pytest for enabling auto-updates to local shark tank.

* xfail mobilenet torch on cpu, cuda and fix CI macos setup

* Update test-models.yml to disable macos vulkan CI.
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.

3 participants