File size: 1,737 Bytes
fd0e0df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
language:
- en
base_model:
- Laxhar/sdxl_noob
pipeline_tag: text-to-image
library_name: diffusers
---

# NoobAI XL (V预测分支)

该模型页面为 NoobAI XL 的 V 预测分支,无法在 AUTOMATIC1111 WebUI 中使用。
请通过 diffusers 或 [reForge](https://github.com/Panchovix/stable-diffusion-webui-reForge/) 使用。

## 用法:reForge

1. 安装并启动 reForge;
2. 在页面下方找到 “Advanced Model Sampling for Forge”;
3. 启用 “Enable Advanced Model Sampling”;
4. 在 “Discrete Sampling Type” 中选择 “v_prediction”。

## 用法:Diffusers

```python
import torch
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler

ckpt_path = "/path/to/model.safetensors"
pipe = StableDiffusionXLPipeline.from_single_file(
    ckpt_path,
    use_safetensors=True,
    torch_dtype=torch.float16,
)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.scheduler.register_to_config(
    prediction_type="v_prediction",
    rescale_betas_zero_snr=True,
)
pipe.enable_xformers_memory_efficient_attention()
pipe = pipe.to("cuda")

prompt = "best quality, 1boy, solo"
negative_prompt = "bad hands, worst quality, low quality, bad quality, multiple views, 4koma, comic, jpeg artifacts, monochrome, sepia, greyscale, flat color, pale color, muted color, low contrast, bad anatomy, picture frame, english text, signature, watermark, logo, patreon username, web address, artist name"

image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=832,
    height=1216,
    num_inference_steps=28,
    guidance_scale=7.0,
    generator=torch.Generator().manual_seed(42),
).images[0]

image.save('image.png')
```