File size: 1,538 Bytes
710e362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
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")