File size: 1,107 Bytes
021a57b
 
 
 
 
 
 
 
 
eae9898
021a57b
 
 
4365789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
---
language: 
  - en
thumbnail: TBD
tags:
- stable-diffusion
- stable-diffusion-diffusers
- text-to-image
datasets:
- ChristophSchuhmann/improved_aesthetics_6plus
---


# Mini Stable Diffusion (miniSD)

MiniSD is a latent text-to-image diffusion model that has been conditionned on 256x256 images through finetuning.

## Examples

WIP

## Usage

```
!pip install diffusers==0.3.0
!pip install transformers scipy ftfy
```

```
import torch
from diffusers import StableDiffusionPipeline
from torch import autocast

# TODO: change model_id to "lambdalabs/miniSD"
pipe = StableDiffusionPipeline.from_pretrained("eolecvk/model-test", torch_dtype=torch.float16)  
pipe = pipe.to("cuda")

prompt = "Yoda"
scale = 10
n_samples = 4

# Sometimes the nsfw checker is confused, you can disable it at your own risk here
disable_safety = False

if disable_safety:
  def null_safety(images, **kwargs):
      return images, False
  pipe.safety_checker = null_safety

with autocast("cuda"):
  images = pipe(n_samples*[prompt], guidance_scale=scale).images

for idx, im in enumerate(images):
  im.save(f"{idx:06}.png")
```