Skip to content
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

Image resolution lower than 512x512 results in glitchy or black images #2107

Closed
singh-robbie opened this issue Jan 25, 2023 · 2 comments
Closed
Labels
bug Something isn't working stale Issues that haven't received updates

Comments

@singh-robbie
Copy link

Describe the bug

For even the most common prompt "a photo of an astronaut riding a horse on mars", any image resolution lower than 512x512 either outputs a glitchy image or a complete black (stating it's NSFW). Tried "iphone from 2050" which again generates similar result.
potentialBug_diffuser_imageResolution.zip

Reproduction

from diffusers import StableDiffusionPipeline
import torch

model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt, height=128, width=128).images[0]
#run a few times and it should classify most of the images as NSFW

### Logs

_No response_

### System Info

- `transformers` version: 4.26.0
- Platform: Linux-5.10.147+-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.12.0
- PyTorch version (GPU?): 1.13.1+cu116 (True)
- Tensorflow version (GPU?): 2.9.2 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>
@singh-robbie singh-robbie added the bug Something isn't working label Jan 25, 2023
@singh-robbie singh-robbie changed the title Image resolution lower than 512x512 results in buggy or black images Image resolution lower than 512x512 results in glitchy or black images Jan 25, 2023
@patrickvonplaten
Copy link
Contributor

Hey @singh-robbie,

In this case, we cannot do much and can only recommend to turn of the safety checker with:

from diffusers import StableDiffusionPipeline
import torch

model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, safety_checker=None)
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt, height=128, width=128).images[0]
#run a few times and it should classify most of the images as NSFW

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Issues that haven't received updates
Projects
None yet
Development

No branches or pull requests

2 participants