Downloads · 30 days
0
twodgirl/ssd-latent-preview
ssd-latent-preview is a text-to-image model from twodgirl. Use it when you need an image from a text prompt. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Oct 19, 2024
Repo size
13.5 MB
Likes
1
Public
Click a slice to open those files.
.safetensors6.8 MB · 88%
From the Hugging Face model README
The decoder provides a preview image.
Max supported resolution is between 768 and 1024px.

The model processes a latent representation that has been reshaped from 4 channels to 64 channels, which differs from the original implementation.

from diffusers import AutoencoderKL, StableDiffusionXLPipeline
from safetensors.torch import load_model
from tea_64_model import TeaDecoder
import torch
from torchvision import transforms
def preview_image(latents, pipe):
latents = latents / pipe.vae.config.scaling_factor
tea = TeaDecoder(ch_in=4)
load_model(tea, './vae_decoder.safetensors')
tea.to(device='cuda')
output = tea(latents.float()) / 2.0 + 0.5
preview = transforms.ToPILImage()(output[0].clamp(0, 1))
return preview
if __name__ == '__main__':
pipe = StableDiffusionXLPipeline.from_pretrained('segmind/SSD-1B',
torch_dtype=torch.float16,
use_safetensors=True,
variant='fp16')
latents = pipe('cat playing piano',
'bad quality, low quality',
num_inference_steps=20,
output_type='latent').images
preview = preview_image(latents, pipe)
preview.save('cat.png')