UX4567's picture
Update README.md
710e362 verified
|
Raw History Blame Contribute Delete
1.54 kB
---
license: mit
base_model: runwayml/stable-diffusion-v1-5
tags:
- stable-diffusion
- text-to-image
- diffusers
- pytorch
- fine-tuned-unet
inference: true
---
# Stable Diffusion v1-3.0 (Fine-Tuned UNet)
This repository contains fine-tuned **UNet** weights for Stable Diffusion v1.5, trained by [UX4567](https://huggingface.co/UX4567).
## Model Details
- **Base Model:** [runwayml/stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5)
- **Model Type:** Text-to-Image Diffusion (UNet component)
- **Training Environment:** Google Colab (T4 GPU)
- **Precision:** FP16 / 8-bit Adam optimization (`bitsandbytes`)
## How to Use
Because this repository stores the fine-tuned UNet weights, you can easily load it using the `diffusers` library by injecting it into the base Stable Diffusion pipeline:
```python
import torch
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
model_id = "UX4567/Stable-Diffusion-v1-3.0"
device = "cuda" if torch.cuda.is_available() else "cpu"
# 1. Load your fine-tuned UNet in float16
trained_unet = UNet2DConditionModel.from_pretrained(
model_id,
torch_dtype=torch.float16
)
# 2. Initialize pipeline with runwayml base and your custom UNet
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
unet=trained_unet,
torch_dtype=torch.float16
).to(device)
# 3. Generate an image
prompt = "a futuristic cyberpunk city at night"
image = pipe(prompt, num_inference_steps=30).images[0]
image.save("generated_image.png")