質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,45 +3,31 @@
|
|
3
3
|
解決方法が知りたいです。質問が分かりにくいかもしれませんがよろしくお願いします。
|
4
4
|
|
5
5
|
```python
|
6
|
+
import torch
|
7
|
+
from torch import autocast
|
6
|
-
|
8
|
+
from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
|
9
|
+
|
7
|
-
|
10
|
+
pipe = StableDiffusionPipeline.from_pretrained(
|
8
|
-
|
11
|
+
"hakurei/waifu-diffusion",
|
9
|
-
|
12
|
+
torch_dtype=torch.float16,
|
10
|
-
|
13
|
+
scheduler=LMSDiscreteScheduler(
|
11
|
-
|
14
|
+
beta_start=0.00085,
|
12
|
-
|
15
|
+
beta_end=0.012,
|
13
|
-
|
16
|
+
beta_schedule='scaled_linear',
|
14
|
-
|
17
|
+
num_train_timesteps=1000
|
15
|
-
|
18
|
+
),
|
16
|
-
|
19
|
+
).to('cuda')
|
17
|
-
|
18
|
-
|
20
|
+
|
19
|
-
>>> from torch import autocast
|
20
|
-
>>> from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
|
21
|
-
>>>
|
22
|
-
>>> pipe = StableDiffusionPipeline.from_pretrained(
|
23
|
-
... "hakurei/waifu-diffusion",
|
24
|
-
... torch_dtype=torch.float16, # GPUに余裕があるなら「torch.float32」
|
25
|
-
... scheduler=LMSDiscreteScheduler(
|
26
|
-
... beta_start=0.00085,
|
27
|
-
... beta_end=0.012,
|
28
|
-
... beta_schedule='scaled_linear',
|
29
|
-
... num_train_timesteps=1000
|
30
|
-
... ),
|
31
|
-
... ).to('cuda')
|
32
|
-
>>>
|
33
|
-
|
21
|
+
prompt = "1girl, black eyes, black hair, black sweater, blue background, bob cut, closed mouth, glasses, medium hair, red-framed eyewear, simple background, solo, sweater, upper body, wide-eyed"
|
34
|
-
|
22
|
+
|
35
|
-
>>> # ====ここから====
|
36
|
-
|
23
|
+
def null_safety(images, **kwargs):
|
37
|
-
|
24
|
+
return images, False
|
38
|
-
|
25
|
+
|
39
|
-
|
26
|
+
|
40
|
-
|
27
|
+
pipe.safety_checker = null_safety
|
41
|
-
|
28
|
+
|
42
|
-
>>>
|
43
|
-
|
29
|
+
with autocast("cuda"):
|
44
|
-
|
30
|
+
image = pipe(prompt, guidance_scale=6)["images"][0]
|
45
31
|
```
|
46
32
|
|
47
33
|
実行結果
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,23 +14,7 @@
|
|
14
14
|
... num_train_timesteps=1000
|
15
15
|
... ),
|
16
16
|
... ).to('cuda')
|
17
|
-
|
17
|
+
|
18
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 342/342 [00:00<00:00, 339kB/s]
|
19
|
-
Downloading: 100%|████████████████████████████████████████████████████████████████████████| 4.67k/4.67k [00:00<?, ?B/s]
|
20
|
-
Downloading: 100%|████████████████████████████████████████████████████████████████| 1.22G/1.22G [04:24<00:00, 4.59MB/s]
|
21
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 215/215 [00:00<00:00, 214kB/s]
|
22
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 612/612 [00:00<00:00, 612kB/s]
|
23
|
-
Downloading: 100%|██████████████████████████████████████████████████████████████████| 492M/492M [01:38<00:00, 5.02MB/s]
|
24
|
-
Downloading: 100%|███████████████████████████████████████████████████████████████████| 525k/525k [00:04<00:00, 120kB/s]
|
25
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 472/472 [00:00<00:00, 472kB/s]
|
26
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 806/806 [00:00<00:00, 806kB/s]
|
27
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████| 1.06M/1.06M [00:07<00:00, 137kB/s]
|
28
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 743/743 [00:00<00:00, 737kB/s]
|
29
|
-
Downloading: 100%|████████████████████████████████████████████████████████████████| 3.44G/3.44G [12:43<00:00, 4.50MB/s]
|
30
|
-
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 547/547 [00:00<00:00, 543kB/s]
|
31
|
-
Downloading: 100%|██████████████████████████████████████████████████████████████████| 335M/335M [00:50<00:00, 6.58MB/s]
|
32
|
-
Fetching 15 files: 100%|███████████████████████████████████████████████████████████████| 15/15 [20:12<00:00, 80.86s/it]
|
33
|
-
ftfy or spacy is not installed using BERT BasicTokenizer instead of ftfy.
|
34
18
|
>>> import torch
|
35
19
|
>>> from torch import autocast
|
36
20
|
>>> from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
|
@@ -45,8 +29,6 @@
|
|
45
29
|
... num_train_timesteps=1000
|
46
30
|
... ),
|
47
31
|
... ).to('cuda')
|
48
|
-
Fetching 15 files: 100%|█████████████████████████████████████████████████████████████| 15/15 [00:00<00:00, 7496.08it/s]
|
49
|
-
ftfy or spacy is not installed using BERT BasicTokenizer instead of ftfy.
|
50
32
|
>>>
|
51
33
|
>>> prompt = "1girl, black eyes, black hair, black sweater, blue background, bob cut, closed mouth, glasses, medium hair, red-framed eyewear, simple background, solo, sweater, upper body, wide-eyed"
|
52
34
|
>>>
|
@@ -56,14 +38,19 @@
|
|
56
38
|
...
|
57
39
|
...
|
58
40
|
... pipe.safety_checker = null_safety
|
59
|
-
File "<stdin>", line 5
|
60
|
-
pipe.safety_checker = null_safety
|
61
|
-
^^^^
|
62
|
-
SyntaxError: invalid syntax
|
63
41
|
>>> # ====ここまで====
|
64
42
|
>>>
|
65
43
|
>>> with autocast("cuda"):
|
66
44
|
... image = pipe(prompt, guidance_scale=6)["images"][0]
|
67
45
|
```
|
68
46
|
|
47
|
+
実行結果
|
48
|
+
```python
|
49
|
+
pipe.safety_checker = null_safety
|
50
|
+
File "<stdin>", line 5
|
51
|
+
pipe.safety_checker = null_safety
|
52
|
+
^^^^
|
53
|
+
SyntaxError: invalid syntax
|
54
|
+
```
|
69
55
|
|
56
|
+
|