File size: 1,314 Bytes
9356fa9
 
05d8082
9356fa9
 
 
 
 
05d8082
 
 
 
7fc7e34
 
9356fa9
 
 
 
 
 
05d8082
9356fa9
 
 
 
 
 
 
 
 
7fc7e34
 
 
 
 
 
 
 
02a21e2
7fc7e34
 
 
 
 
 
 
 
 
 
 
 
 
 
9356fa9
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
# ADM-G-512

Self-contained ADM-G checkpoint inside [`BiliSakura/ADM-diffusers`](https://huggingface.co/BiliSakura/ADM-diffusers). Runtime dependencies: this folder + PyPI `diffusers`/`torch` only.

## Hub path

`BiliSakura/ADM-diffusers/ADM-G-512`

## Demo

![ADM-G-512 demo](demo.png)

Settings used for this demo image: `ADM-G-512`, `DDIMScheduler`, `num_inference_steps=50`, `guidance_scale=4.0`, `seed=42`, class `"golden retriever"`.

## Layout

```text
ADM-G-512/
β”œβ”€β”€ pipeline.py
β”œβ”€β”€ model_index.json
β”œβ”€β”€ demo.png
β”œβ”€β”€ unet/
β”œβ”€β”€ classifier/
└── scheduler/
```

## Load

```python
from pathlib import Path
import torch
from diffusers import DDIMScheduler, DiffusionPipeline

model_dir = Path("./BiliSakura/ADM-diffusers/ADM-G-512")
pipe = DiffusionPipeline.from_pretrained(
    str(model_dir),
    local_files_only=True,
    custom_pipeline=str(model_dir / "pipeline.py"),
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
)
pipe = pipe.to("cuda")
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
class_id = pipe.get_label_ids("golden retriever")[0]
generator = torch.Generator(device="cuda").manual_seed(42)

out = pipe(
    class_labels=class_id,
    guidance_scale=4.0,
    num_inference_steps=50,
    generator=generator,
).images[0]
out
```