huggingface / huggingface/diffusers

Denoising SDXL iteration images for coherent image previews that a user could understand

Aperta
#7,001 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub
should-move-to-discussion stale
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

Hello,

I'm currently trying to create image previews with SDXL. This works! However, the image output are very noisy. A very long time ago I found a solution to this for sd1.5 but unfortunately it has been lost to time.

How would I go about denoising these images so they are a little more coherent to a human viewer? I know the first couple of iterations are always going to be very noisy, but eventually it should be possible to convert this noise into a blurry image that a human could understand.

```python
import time
from diffusers import StableDiffusionXLPipeline
import torch

pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
).to("cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"

def callback(pipe, step_index, timestep, callback_kwargs):
latents = callback_kwargs.get("latents")

start_time = time.time()
with torch.no_grad():
pipe.upcast_vae()
latents = latents.to(
next(iter(pipe.vae.post_quant_conv.parameters())).dtype)
images = pipe.vae.decode(
latents / pipe.vae.config.scaling_factor, return_dict=False)[0]
images = pipe.image_processor.postprocess(images, output_type='pil')

images[0].save(f"./imgs/{step_index}.png")

end_time = time.time()

print(f"Time taken to generate image: {end_time - start_time} seconds")

return callback_kwargs

pipe(prompt=prompt, callback_on_step_end=callback)
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the provided Python example and inspect the StableDiffusionXLPipeline callback_on_step_end path, including the VAE decode and image postprocessing steps. No repository file or test is named; done would mean producing SDXL iteration previews that become sufficiently coherent for a human viewer rather than remaining visibly noisy.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, pytorch
Ambito
machine-learning
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.