Downloads · 30 days
14
14% of all-time downloads
srishticrai/unet-flickr8k
unet-flickr8k is a text-to-image model from srishticrai. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as mit.
This model contains a fine-tuned U-Net from the CompVis/stable-diffusion-v1-4 Stable Diffusion pipeline, trained using natural English captions from the Flickr8k dataset. It enhances generation quality for everyday, h…
Downloads · 30 days
14
14% of all-time downloads
All-time downloads
100
Public
Parameters
860M
1.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.7 GB · 100%
From the Hugging Face model README
This model contains a fine-tuned U-Net from the CompVis/stable-diffusion-v1-4 Stable Diffusion pipeline, trained using natural English captions from the Flickr8k dataset. It enhances generation quality for everyday, human-centered scenarios like actions, objects, and environmental scenes.
✅ Only the U-Net was fine-tuned. The VAE, tokenizer, and text encoder remain from the original base model.
CompVis/stable-diffusion-v1-4unet onlyThis U-Net can be loaded into a standard Stable Diffusion pipeline to enhance image generation on descriptive prompts:
from diffusers import StableDiffusionPipeline, UNet2DConditionModel, AutoencoderKL, DDPMScheduler
from transformers import CLIPTextModel
import torch
import matplotlib.pyplot as plt
# Load base components
print("Loading VAE and text encoder from base SD...")
vae = AutoencoderKL.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="vae", torch_dtype=torch.float16).to(device)
text_encoder = CLIPTextModel.from_pretrained("openai/clip-vit-large-patch14", torch_dtype=torch.float16).to(device)
# Load fine-tuned UNet from Hugging Face
print("Loading fine-tuned UNet from Hugging Face (srishticrai/unet-flickr8k)...")
fine_tuned_unet = UNet2DConditionModel.from_pretrained(
"srishticrai/unet-flickr8k",
torch_dtype=torch.float16
).to(device)
# Rebuild the pipeline
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
unet=fine_tuned_unet,
vae=vae,
text_encoder=text_encoder,
torch_dtype=torch.float16
).to(device)
pipe.set_progress_bar_config(disable=False)
pipe.enable_attention_slicing()
# Ask for prompt
prompt = input("Enter a prompt to generate an image: ")
# Generate image
image = pipe(
prompt,
guidance_scale=10.0,
num_inference_steps=50
)
image.show()