ysb123 commited on
Commit
209132b
·
verified ·
1 Parent(s): 3f26b1e

notebooks of gcolab and sagemaker

Browse files
3best_adetailer.json ADDED
@@ -0,0 +1,910 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "28281fe7-b5f0-42ff-8319-60a4a8eb87a3",
3
+ "revision": 0,
4
+ "last_node_id": 47,
5
+ "last_link_id": 75,
6
+ "nodes": [
7
+ {
8
+ "id": 29,
9
+ "type": "PreviewImage",
10
+ "pos": [
11
+ 2977,
12
+ 188
13
+ ],
14
+ "size": [
15
+ 210,
16
+ 246
17
+ ],
18
+ "flags": {},
19
+ "order": 14,
20
+ "mode": 0,
21
+ "inputs": [
22
+ {
23
+ "name": "images",
24
+ "type": "IMAGE",
25
+ "link": 35
26
+ }
27
+ ],
28
+ "outputs": [],
29
+ "properties": {
30
+ "cnr_id": "comfy-core",
31
+ "ver": "0.3.44",
32
+ "Node name for S&R": "PreviewImage"
33
+ },
34
+ "widgets_values": []
35
+ },
36
+ {
37
+ "id": 28,
38
+ "type": "MaskToImage",
39
+ "pos": [
40
+ 2700,
41
+ 180
42
+ ],
43
+ "size": [
44
+ 210,
45
+ 26
46
+ ],
47
+ "flags": {},
48
+ "order": 13,
49
+ "mode": 0,
50
+ "inputs": [
51
+ {
52
+ "name": "mask",
53
+ "type": "MASK",
54
+ "link": 34
55
+ }
56
+ ],
57
+ "outputs": [
58
+ {
59
+ "name": "IMAGE",
60
+ "type": "IMAGE",
61
+ "slot_index": 0,
62
+ "links": [
63
+ 35
64
+ ]
65
+ }
66
+ ],
67
+ "properties": {
68
+ "cnr_id": "comfy-core",
69
+ "ver": "0.3.44",
70
+ "Node name for S&R": "MaskToImage"
71
+ },
72
+ "widgets_values": []
73
+ },
74
+ {
75
+ "id": 9,
76
+ "type": "PreviewImage",
77
+ "pos": [
78
+ 91.50862884521484,
79
+ 863.8438110351562
80
+ ],
81
+ "size": [
82
+ 1104.8983154296875,
83
+ 1135.2650146484375
84
+ ],
85
+ "flags": {
86
+ "pinned": true
87
+ },
88
+ "order": 12,
89
+ "mode": 0,
90
+ "inputs": [
91
+ {
92
+ "name": "images",
93
+ "type": "IMAGE",
94
+ "link": 18
95
+ }
96
+ ],
97
+ "outputs": [],
98
+ "properties": {
99
+ "cnr_id": "comfy-core",
100
+ "ver": "0.3.44",
101
+ "Node name for S&R": "PreviewImage"
102
+ },
103
+ "widgets_values": []
104
+ },
105
+ {
106
+ "id": 6,
107
+ "type": "PreviewImage",
108
+ "pos": [
109
+ 1258.663330078125,
110
+ 490.87127685546875
111
+ ],
112
+ "size": [
113
+ 828.719482421875,
114
+ 960.4996948242188
115
+ ],
116
+ "flags": {
117
+ "pinned": true
118
+ },
119
+ "order": 11,
120
+ "mode": 0,
121
+ "inputs": [
122
+ {
123
+ "name": "images",
124
+ "type": "IMAGE",
125
+ "link": 72
126
+ }
127
+ ],
128
+ "outputs": [],
129
+ "properties": {
130
+ "cnr_id": "comfy-core",
131
+ "ver": "0.3.44",
132
+ "Node name for S&R": "PreviewImage"
133
+ },
134
+ "widgets_values": []
135
+ },
136
+ {
137
+ "id": 43,
138
+ "type": "LatentUpscale",
139
+ "pos": [
140
+ 1023.8054809570312,
141
+ 22.159088134765625
142
+ ],
143
+ "size": [
144
+ 270,
145
+ 130
146
+ ],
147
+ "flags": {},
148
+ "order": 8,
149
+ "mode": 0,
150
+ "inputs": [
151
+ {
152
+ "name": "samples",
153
+ "type": "LATENT",
154
+ "link": 69
155
+ }
156
+ ],
157
+ "outputs": [
158
+ {
159
+ "name": "LATENT",
160
+ "type": "LATENT",
161
+ "links": [
162
+ 70
163
+ ]
164
+ }
165
+ ],
166
+ "properties": {
167
+ "cnr_id": "comfy-core",
168
+ "ver": "0.3.44",
169
+ "Node name for S&R": "LatentUpscale"
170
+ },
171
+ "widgets_values": [
172
+ "bicubic",
173
+ 1024,
174
+ 1024,
175
+ "disabled"
176
+ ]
177
+ },
178
+ {
179
+ "id": 5,
180
+ "type": "VAEDecode",
181
+ "pos": [
182
+ 1211.322265625,
183
+ 333.0151672363281
184
+ ],
185
+ "size": [
186
+ 210,
187
+ 46
188
+ ],
189
+ "flags": {},
190
+ "order": 9,
191
+ "mode": 0,
192
+ "inputs": [
193
+ {
194
+ "name": "samples",
195
+ "type": "LATENT",
196
+ "link": 70
197
+ },
198
+ {
199
+ "name": "vae",
200
+ "type": "VAE",
201
+ "link": 71
202
+ }
203
+ ],
204
+ "outputs": [
205
+ {
206
+ "name": "IMAGE",
207
+ "type": "IMAGE",
208
+ "slot_index": 0,
209
+ "links": [
210
+ 11,
211
+ 72
212
+ ]
213
+ }
214
+ ],
215
+ "properties": {
216
+ "cnr_id": "comfy-core",
217
+ "ver": "0.3.44",
218
+ "Node name for S&R": "VAEDecode"
219
+ },
220
+ "widgets_values": []
221
+ },
222
+ {
223
+ "id": 44,
224
+ "type": "VAELoader",
225
+ "pos": [
226
+ 641.041748046875,
227
+ 56.77278137207031
228
+ ],
229
+ "size": [
230
+ 270,
231
+ 58
232
+ ],
233
+ "flags": {},
234
+ "order": 0,
235
+ "mode": 0,
236
+ "inputs": [],
237
+ "outputs": [
238
+ {
239
+ "name": "VAE",
240
+ "type": "VAE",
241
+ "links": [
242
+ 71
243
+ ]
244
+ }
245
+ ],
246
+ "properties": {
247
+ "cnr_id": "comfy-core",
248
+ "ver": "0.3.44",
249
+ "Node name for S&R": "VAELoader"
250
+ },
251
+ "widgets_values": [
252
+ "SDXL/sdxl_vae.safetensors"
253
+ ]
254
+ },
255
+ {
256
+ "id": 8,
257
+ "type": "FaceDetailer",
258
+ "pos": [
259
+ 2097.292236328125,
260
+ 297.2921447753906
261
+ ],
262
+ "size": [
263
+ 506.4000244140625,
264
+ 960
265
+ ],
266
+ "flags": {},
267
+ "order": 10,
268
+ "mode": 0,
269
+ "inputs": [
270
+ {
271
+ "name": "image",
272
+ "type": "IMAGE",
273
+ "link": 11
274
+ },
275
+ {
276
+ "name": "model",
277
+ "type": "MODEL",
278
+ "link": 13
279
+ },
280
+ {
281
+ "name": "clip",
282
+ "type": "CLIP",
283
+ "link": 14
284
+ },
285
+ {
286
+ "name": "vae",
287
+ "type": "VAE",
288
+ "link": 16
289
+ },
290
+ {
291
+ "name": "positive",
292
+ "type": "CONDITIONING",
293
+ "link": 36
294
+ },
295
+ {
296
+ "name": "negative",
297
+ "type": "CONDITIONING",
298
+ "link": 17
299
+ },
300
+ {
301
+ "name": "bbox_detector",
302
+ "type": "BBOX_DETECTOR",
303
+ "link": 28
304
+ },
305
+ {
306
+ "name": "sam_model_opt",
307
+ "shape": 7,
308
+ "type": "SAM_MODEL",
309
+ "link": 51
310
+ },
311
+ {
312
+ "name": "segm_detector_opt",
313
+ "shape": 7,
314
+ "type": "SEGM_DETECTOR",
315
+ "link": 52
316
+ },
317
+ {
318
+ "name": "detailer_hook",
319
+ "shape": 7,
320
+ "type": "DETAILER_HOOK",
321
+ "link": null
322
+ },
323
+ {
324
+ "name": "scheduler_func_opt",
325
+ "shape": 7,
326
+ "type": "SCHEDULER_FUNC",
327
+ "link": null
328
+ }
329
+ ],
330
+ "outputs": [
331
+ {
332
+ "name": "image",
333
+ "type": "IMAGE",
334
+ "slot_index": 0,
335
+ "links": [
336
+ 18
337
+ ]
338
+ },
339
+ {
340
+ "name": "cropped_refined",
341
+ "shape": 6,
342
+ "type": "IMAGE",
343
+ "slot_index": 1,
344
+ "links": []
345
+ },
346
+ {
347
+ "name": "cropped_enhanced_alpha",
348
+ "shape": 6,
349
+ "type": "IMAGE",
350
+ "links": null
351
+ },
352
+ {
353
+ "name": "mask",
354
+ "type": "MASK",
355
+ "slot_index": 3,
356
+ "links": [
357
+ 34
358
+ ]
359
+ },
360
+ {
361
+ "name": "detailer_pipe",
362
+ "type": "DETAILER_PIPE",
363
+ "links": []
364
+ },
365
+ {
366
+ "name": "cnet_images",
367
+ "shape": 6,
368
+ "type": "IMAGE",
369
+ "links": null
370
+ }
371
+ ],
372
+ "properties": {
373
+ "aux_id": "ltdrdata/comfyui-impact-pack",
374
+ "ver": "8.21.0",
375
+ "Node name for S&R": "FaceDetailer",
376
+ "cnr_id": "comfyui-impact-pack"
377
+ },
378
+ "widgets_values": [
379
+ 384,
380
+ true,
381
+ 1024,
382
+ 790057677695328,
383
+ "randomize",
384
+ 25,
385
+ 4,
386
+ "deis",
387
+ "karras",
388
+ 0.5000000000000001,
389
+ 5,
390
+ true,
391
+ true,
392
+ 0.5,
393
+ 10,
394
+ 3,
395
+ "center-1",
396
+ 0,
397
+ 0.93,
398
+ 0,
399
+ 0.7,
400
+ "False",
401
+ 10,
402
+ "",
403
+ 1,
404
+ false,
405
+ 0,
406
+ false,
407
+ false
408
+ ]
409
+ },
410
+ {
411
+ "id": 22,
412
+ "type": "UltralyticsDetectorProvider",
413
+ "pos": [
414
+ 1438.6175537109375,
415
+ 298.04852294921875
416
+ ],
417
+ "size": [
418
+ 315,
419
+ 78
420
+ ],
421
+ "flags": {},
422
+ "order": 1,
423
+ "mode": 0,
424
+ "inputs": [],
425
+ "outputs": [
426
+ {
427
+ "name": "BBOX_DETECTOR",
428
+ "type": "BBOX_DETECTOR",
429
+ "slot_index": 0,
430
+ "links": [
431
+ 28
432
+ ]
433
+ },
434
+ {
435
+ "name": "SEGM_DETECTOR",
436
+ "type": "SEGM_DETECTOR",
437
+ "links": [
438
+ 52
439
+ ]
440
+ }
441
+ ],
442
+ "properties": {
443
+ "aux_id": "ltdrdata/comfyui-impact-subpack",
444
+ "ver": "1.3.4",
445
+ "Node name for S&R": "UltralyticsDetectorProvider",
446
+ "cnr_id": "comfyui-impact-subpack"
447
+ },
448
+ "widgets_values": [
449
+ "bbox/face_yolov8m.pt"
450
+ ]
451
+ },
452
+ {
453
+ "id": 1,
454
+ "type": "CheckpointLoaderSimple",
455
+ "pos": [
456
+ -32.2958869934082,
457
+ 531.56640625
458
+ ],
459
+ "size": [
460
+ 315,
461
+ 98
462
+ ],
463
+ "flags": {},
464
+ "order": 2,
465
+ "mode": 0,
466
+ "inputs": [],
467
+ "outputs": [
468
+ {
469
+ "name": "MODEL",
470
+ "type": "MODEL",
471
+ "slot_index": 0,
472
+ "links": [
473
+ 1,
474
+ 13
475
+ ]
476
+ },
477
+ {
478
+ "name": "CLIP",
479
+ "type": "CLIP",
480
+ "slot_index": 1,
481
+ "links": [
482
+ 2,
483
+ 3,
484
+ 14
485
+ ]
486
+ },
487
+ {
488
+ "name": "VAE",
489
+ "type": "VAE",
490
+ "slot_index": 2,
491
+ "links": [
492
+ 16
493
+ ]
494
+ }
495
+ ],
496
+ "properties": {
497
+ "cnr_id": "comfy-core",
498
+ "ver": "0.3.44",
499
+ "Node name for S&R": "CheckpointLoaderSimple"
500
+ },
501
+ "widgets_values": [
502
+ "unholy_desire_mix.safetensors"
503
+ ]
504
+ },
505
+ {
506
+ "id": 39,
507
+ "type": "SAMLoader",
508
+ "pos": [
509
+ 1778.16943359375,
510
+ 298.81622314453125
511
+ ],
512
+ "size": [
513
+ 270,
514
+ 82
515
+ ],
516
+ "flags": {},
517
+ "order": 3,
518
+ "mode": 0,
519
+ "inputs": [],
520
+ "outputs": [
521
+ {
522
+ "name": "SAM_MODEL",
523
+ "type": "SAM_MODEL",
524
+ "links": [
525
+ 51
526
+ ]
527
+ }
528
+ ],
529
+ "properties": {
530
+ "aux_id": "ltdrdata/comfyui-impact-pack",
531
+ "ver": "e1e95c14d3cf01d233daad81f1eda7584763237b",
532
+ "Node name for S&R": "SAMLoader",
533
+ "cnr_id": "comfyui-impact-pack"
534
+ },
535
+ "widgets_values": [
536
+ "sam_vit_b_01ec64.pth",
537
+ "AUTO"
538
+ ]
539
+ },
540
+ {
541
+ "id": 7,
542
+ "type": "EmptyLatentImage",
543
+ "pos": [
544
+ 868.62451171875,
545
+ 636.10693359375
546
+ ],
547
+ "size": [
548
+ 308.0859069824219,
549
+ 116.86498260498047
550
+ ],
551
+ "flags": {},
552
+ "order": 4,
553
+ "mode": 0,
554
+ "inputs": [],
555
+ "outputs": [
556
+ {
557
+ "name": "LATENT",
558
+ "type": "LATENT",
559
+ "links": [
560
+ 10
561
+ ]
562
+ }
563
+ ],
564
+ "properties": {
565
+ "cnr_id": "comfy-core",
566
+ "ver": "0.3.44",
567
+ "Node name for S&R": "EmptyLatentImage"
568
+ },
569
+ "widgets_values": [
570
+ 1024,
571
+ 1024,
572
+ 1
573
+ ]
574
+ },
575
+ {
576
+ "id": 2,
577
+ "type": "KSampler",
578
+ "pos": [
579
+ 868.04833984375,
580
+ 321.1951599121094
581
+ ],
582
+ "size": [
583
+ 315,
584
+ 262
585
+ ],
586
+ "flags": {},
587
+ "order": 7,
588
+ "mode": 0,
589
+ "inputs": [
590
+ {
591
+ "name": "model",
592
+ "type": "MODEL",
593
+ "link": 1
594
+ },
595
+ {
596
+ "name": "positive",
597
+ "type": "CONDITIONING",
598
+ "link": 8
599
+ },
600
+ {
601
+ "name": "negative",
602
+ "type": "CONDITIONING",
603
+ "link": 7
604
+ },
605
+ {
606
+ "name": "latent_image",
607
+ "type": "LATENT",
608
+ "link": 10
609
+ }
610
+ ],
611
+ "outputs": [
612
+ {
613
+ "name": "LATENT",
614
+ "type": "LATENT",
615
+ "slot_index": 0,
616
+ "links": [
617
+ 69
618
+ ]
619
+ }
620
+ ],
621
+ "properties": {
622
+ "cnr_id": "comfy-core",
623
+ "ver": "0.3.44",
624
+ "Node name for S&R": "KSampler"
625
+ },
626
+ "widgets_values": [
627
+ 31820394033232,
628
+ "randomize",
629
+ 21,
630
+ 6,
631
+ "euler",
632
+ "karras",
633
+ 1
634
+ ]
635
+ },
636
+ {
637
+ "id": 4,
638
+ "type": "CLIPTextEncode",
639
+ "pos": [
640
+ 375.6903076171875,
641
+ 611.4951171875
642
+ ],
643
+ "size": [
644
+ 437.833740234375,
645
+ 137.75743103027344
646
+ ],
647
+ "flags": {},
648
+ "order": 6,
649
+ "mode": 0,
650
+ "inputs": [
651
+ {
652
+ "name": "clip",
653
+ "type": "CLIP",
654
+ "link": 3
655
+ }
656
+ ],
657
+ "outputs": [
658
+ {
659
+ "name": "CONDITIONING",
660
+ "type": "CONDITIONING",
661
+ "slot_index": 0,
662
+ "links": [
663
+ 7,
664
+ 17
665
+ ]
666
+ }
667
+ ],
668
+ "properties": {
669
+ "cnr_id": "comfy-core",
670
+ "ver": "0.3.44",
671
+ "Node name for S&R": "CLIPTextEncode"
672
+ },
673
+ "widgets_values": [
674
+ "score_6, score_5, score_4, score_3, deformed iris, deformed pupils, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, bad anatomy, bad proportions, disfigured, fused fingers, too many fingers, bad hands, text, missing fingers, signature, watermark, username, low contrast, noisy, blurry, 3D, photo, realistic, anime, monochromatic, colorless. text, extra fingers, bad hands, clone girls, deformed limbs, copy, couple"
675
+ ]
676
+ },
677
+ {
678
+ "id": 3,
679
+ "type": "CLIPTextEncode",
680
+ "pos": [
681
+ 372.6273193359375,
682
+ 426.2689208984375
683
+ ],
684
+ "size": [
685
+ 466.8005676269531,
686
+ 139.07435607910156
687
+ ],
688
+ "flags": {},
689
+ "order": 5,
690
+ "mode": 0,
691
+ "inputs": [
692
+ {
693
+ "name": "clip",
694
+ "type": "CLIP",
695
+ "link": 2
696
+ }
697
+ ],
698
+ "outputs": [
699
+ {
700
+ "name": "CONDITIONING",
701
+ "type": "CONDITIONING",
702
+ "slot_index": 0,
703
+ "links": [
704
+ 8,
705
+ 36
706
+ ]
707
+ }
708
+ ],
709
+ "properties": {
710
+ "cnr_id": "comfy-core",
711
+ "ver": "0.3.44",
712
+ "Node name for S&R": "CLIPTextEncode"
713
+ },
714
+ "widgets_values": [
715
+ "masterpiece, best_quality, car"
716
+ ]
717
+ }
718
+ ],
719
+ "links": [
720
+ [
721
+ 1,
722
+ 1,
723
+ 0,
724
+ 2,
725
+ 0,
726
+ "MODEL"
727
+ ],
728
+ [
729
+ 2,
730
+ 1,
731
+ 1,
732
+ 3,
733
+ 0,
734
+ "CLIP"
735
+ ],
736
+ [
737
+ 3,
738
+ 1,
739
+ 1,
740
+ 4,
741
+ 0,
742
+ "CLIP"
743
+ ],
744
+ [
745
+ 7,
746
+ 4,
747
+ 0,
748
+ 2,
749
+ 2,
750
+ "CONDITIONING"
751
+ ],
752
+ [
753
+ 8,
754
+ 3,
755
+ 0,
756
+ 2,
757
+ 1,
758
+ "CONDITIONING"
759
+ ],
760
+ [
761
+ 10,
762
+ 7,
763
+ 0,
764
+ 2,
765
+ 3,
766
+ "LATENT"
767
+ ],
768
+ [
769
+ 11,
770
+ 5,
771
+ 0,
772
+ 8,
773
+ 0,
774
+ "IMAGE"
775
+ ],
776
+ [
777
+ 13,
778
+ 1,
779
+ 0,
780
+ 8,
781
+ 1,
782
+ "MODEL"
783
+ ],
784
+ [
785
+ 14,
786
+ 1,
787
+ 1,
788
+ 8,
789
+ 2,
790
+ "CLIP"
791
+ ],
792
+ [
793
+ 16,
794
+ 1,
795
+ 2,
796
+ 8,
797
+ 3,
798
+ "VAE"
799
+ ],
800
+ [
801
+ 17,
802
+ 4,
803
+ 0,
804
+ 8,
805
+ 5,
806
+ "CONDITIONING"
807
+ ],
808
+ [
809
+ 18,
810
+ 8,
811
+ 0,
812
+ 9,
813
+ 0,
814
+ "IMAGE"
815
+ ],
816
+ [
817
+ 28,
818
+ 22,
819
+ 0,
820
+ 8,
821
+ 6,
822
+ "BBOX_DETECTOR"
823
+ ],
824
+ [
825
+ 34,
826
+ 8,
827
+ 3,
828
+ 28,
829
+ 0,
830
+ "MASK"
831
+ ],
832
+ [
833
+ 35,
834
+ 28,
835
+ 0,
836
+ 29,
837
+ 0,
838
+ "IMAGE"
839
+ ],
840
+ [
841
+ 36,
842
+ 3,
843
+ 0,
844
+ 8,
845
+ 4,
846
+ "CONDITIONING"
847
+ ],
848
+ [
849
+ 51,
850
+ 39,
851
+ 0,
852
+ 8,
853
+ 7,
854
+ "SAM_MODEL"
855
+ ],
856
+ [
857
+ 52,
858
+ 22,
859
+ 1,
860
+ 8,
861
+ 8,
862
+ "SEGM_DETECTOR"
863
+ ],
864
+ [
865
+ 69,
866
+ 2,
867
+ 0,
868
+ 43,
869
+ 0,
870
+ "LATENT"
871
+ ],
872
+ [
873
+ 70,
874
+ 43,
875
+ 0,
876
+ 5,
877
+ 0,
878
+ "LATENT"
879
+ ],
880
+ [
881
+ 71,
882
+ 44,
883
+ 0,
884
+ 5,
885
+ 1,
886
+ "VAE"
887
+ ],
888
+ [
889
+ 72,
890
+ 5,
891
+ 0,
892
+ 6,
893
+ 0,
894
+ "IMAGE"
895
+ ]
896
+ ],
897
+ "groups": [],
898
+ "config": {},
899
+ "extra": {
900
+ "ds": {
901
+ "scale": 1.0152559799477074,
902
+ "offset": [
903
+ -523.6927097308235,
904
+ -358.27012987854386
905
+ ]
906
+ },
907
+ "frontendVersion": "1.23.4"
908
+ },
909
+ "version": 0.4
910
+ }
ComfyUI+ADetailer.ipynb ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "gpuType": "T4"
8
+ },
9
+ "kernelspec": {
10
+ "name": "python3",
11
+ "display_name": "Python 3"
12
+ },
13
+ "language_info": {
14
+ "name": "python"
15
+ },
16
+ "accelerator": "GPU",
17
+ "widgets": {
18
+ "application/vnd.jupyter.widget-state+json": {}
19
+ }
20
+ },
21
+ "cells": [
22
+ {
23
+ "cell_type": "code",
24
+ "source": [
25
+ "#@title 1. Install ComfyUI. { display-mode: \"form\" }\n",
26
+ "\n",
27
+ "# STEP 0: Install Python dependencies (termcolor, tqdm) silently\n",
28
+ "import sys\n",
29
+ "import subprocess\n",
30
+ "import os\n",
31
+ "import requests\n",
32
+ "\n",
33
+ "subprocess.run(\n",
34
+ " [sys.executable, \"-m\", \"pip\", \"install\", \"termcolor\", \"tqdm\", \"--quiet\"],\n",
35
+ " stdout=subprocess.DEVNULL,\n",
36
+ " stderr=subprocess.DEVNULL\n",
37
+ ")\n",
38
+ "\n",
39
+ "# STEP 1: Imports\n",
40
+ "import os\n",
41
+ "import time\n",
42
+ "from IPython.display import clear_output\n",
43
+ "from tqdm.notebook import tqdm\n",
44
+ "from termcolor import cprint\n",
45
+ "\n",
46
+ "# === User-configurable Git Versions ===\n",
47
+ "# e.g., \"dev\", \"v1.3\", or commit hash\n",
48
+ "comfyui_version = \"\" #@param [\"255f1398\"] {allow-input: true}\n",
49
+ "custom_node_versions = {\n",
50
+ " \"ComfyUI-Manager\": \"\",\n",
51
+ " \"comfyui-impact-pack\": \"\",\n",
52
+ " \"comfyui-impact-subpack\": \"\"\n",
53
+ "}\n",
54
+ "\n",
55
+ "# === Logging Functions ===\n",
56
+ "def run_command_clean(cmd, cwd=None, show=True):\n",
57
+ " result = subprocess.run(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)\n",
58
+ " if show and result.stdout:\n",
59
+ " last_line = result.stdout.strip().split(\"\\n\")[-1]\n",
60
+ " cprint(\" ↪️ \" + last_line, \"cyan\")\n",
61
+ " return result\n",
62
+ "\n",
63
+ "def print_step(msg): cprint(f\"\\n➤ {msg}\", \"yellow\")\n",
64
+ "def print_success(msg): cprint(f\"✅ {msg}\", \"green\")\n",
65
+ "def print_info(msg): cprint(f\" ⓘ {msg}\", \"blue\")\n",
66
+ "def print_error(msg): cprint(f\"❌ {msg}\", \"red\")\n",
67
+ "\n",
68
+ "def checkout_version(path, version):\n",
69
+ " if version:\n",
70
+ " subprocess.run([\"git\", \"fetch\"], cwd=path, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
71
+ " subprocess.run([\"git\", \"checkout\", version], cwd=path, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
72
+ "\n",
73
+ "def get_git_commit_hash(path):\n",
74
+ " try:\n",
75
+ " return subprocess.check_output([\"git\", \"rev-parse\", \"--short\", \"HEAD\"], cwd=path).decode().strip()\n",
76
+ " except:\n",
77
+ " return \"unknown\"\n",
78
+ "\n",
79
+ "# === Setup Progress ===\n",
80
+ "tasks = [\n",
81
+ " \"Clone ComfyUI\",\n",
82
+ " \"Install ComfyUI Requirements\",\n",
83
+ " \"Clone/Pull Custom Nodes\",\n",
84
+ " \"Install Custom Node Requirements\",\n",
85
+ " \"Install Imp Models\"\n",
86
+ "]\n",
87
+ "\n",
88
+ "overall_start = time.time()\n",
89
+ "progress_bar = tqdm(total=len(tasks), desc=\"🔧 Setting Up ComfyUI\", bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]')\n",
90
+ "\n",
91
+ "# STEP 2: Clone ComfyUI\n",
92
+ "comfyui_path = \"/content/ComfyUI\"\n",
93
+ "if not os.path.exists(comfyui_path):\n",
94
+ " print_step(\"Cloning ComfyUI...\")\n",
95
+ " t0 = time.time()\n",
96
+ " run_command_clean([\"git\", \"clone\", \"https://github.com/comfyanonymous/ComfyUI\", comfyui_path], show=False)\n",
97
+ " if comfyui_version:\n",
98
+ " print_info(f\"Switching to version: {comfyui_version}\")\n",
99
+ " checkout_version(comfyui_path, comfyui_version)\n",
100
+ " hash = get_git_commit_hash(comfyui_path)\n",
101
+ " print_success(f\"ComfyUI cloned (version: {hash}) in {time.time() - t0:.2f}s\")\n",
102
+ "else:\n",
103
+ " print_step(\"ComfyUI already exists. Skipping clone.\")\n",
104
+ " if comfyui_version:\n",
105
+ " print_info(f\"Switching to version: {comfyui_version}\")\n",
106
+ " checkout_version(comfyui_path, comfyui_version)\n",
107
+ " hash = get_git_commit_hash(comfyui_path)\n",
108
+ " print_success(f\"Using ComfyUI (version: {hash})\")\n",
109
+ "progress_bar.update(1)\n",
110
+ "\n",
111
+ "# STEP 3: Install ComfyUI requirements\n",
112
+ "print_step(\"Installing ComfyUI requirements...\")\n",
113
+ "t0 = time.time()\n",
114
+ "run_command_clean([\n",
115
+ " \"pip\", \"install\", \"-r\", f\"{comfyui_path}/requirements.txt\",\n",
116
+ " \"--no-cache-dir\", \"--no-warn-script-location\", \"--quiet\"\n",
117
+ "], show=False)\n",
118
+ "print_success(f\"ComfyUI requirements installed in {time.time() - t0:.2f}s\")\n",
119
+ "progress_bar.update(1)\n",
120
+ "\n",
121
+ "# STEP 4: Clone or Pull Custom Nodes\n",
122
+ "custom_nodes = {\n",
123
+ " \"ComfyUI-Manager\": \"https://github.com/ltdrdata/ComfyUI-Manager.git\",\n",
124
+ " \"comfyui-impact-pack\": \"https://github.com/ltdrdata/comfyui-impact-pack.git\",\n",
125
+ " \"comfyui-impact-subpack\": \"https://github.com/ltdrdata/comfyui-impact-subpack.git\"\n",
126
+ "}\n",
127
+ "base_path = f\"{comfyui_path}/custom_nodes\"\n",
128
+ "os.makedirs(base_path, exist_ok=True)\n",
129
+ "\n",
130
+ "for name, url in custom_nodes.items():\n",
131
+ " repo_path = os.path.join(base_path, name)\n",
132
+ " if not os.path.exists(repo_path):\n",
133
+ " print_step(f\"Cloning {name}...\")\n",
134
+ " t0 = time.time()\n",
135
+ " run_command_clean([\"git\", \"clone\", url, repo_path], show=False)\n",
136
+ " if custom_node_versions.get(name):\n",
137
+ " print_info(f\"Switching {name} to {custom_node_versions[name]}\")\n",
138
+ " checkout_version(repo_path, custom_node_versions[name])\n",
139
+ " hash = get_git_commit_hash(repo_path)\n",
140
+ " print_success(f\"{name} cloned (version: {hash}) in {time.time() - t0:.2f}s\")\n",
141
+ " else:\n",
142
+ " print_step(f\"Pulling latest for {name}...\")\n",
143
+ " t0 = time.time()\n",
144
+ " run_command_clean([\"git\", \"pull\"], cwd=repo_path, show=False)\n",
145
+ " if custom_node_versions.get(name):\n",
146
+ " print_info(f\"Switching {name} to {custom_node_versions[name]}\")\n",
147
+ " checkout_version(repo_path, custom_node_versions[name])\n",
148
+ " hash = get_git_commit_hash(repo_path)\n",
149
+ " print_success(f\"{name} updated (version: {hash}) in {time.time() - t0:.2f}s\")\n",
150
+ "progress_bar.update(1)\n",
151
+ "\n",
152
+ "# STEP 5: Install requirements.txt in each custom node\n",
153
+ "for name in custom_nodes:\n",
154
+ " req_path = f\"{base_path}/{name}/requirements.txt\"\n",
155
+ " if os.path.exists(req_path):\n",
156
+ " print_step(f\"Installing requirements for {name}...\")\n",
157
+ " t0 = time.time()\n",
158
+ " run_command_clean([\n",
159
+ " \"pip\", \"install\", \"-r\", req_path,\n",
160
+ " \"--no-cache-dir\", \"--no-warn-script-location\", \"--quiet\"\n",
161
+ " ], show=False)\n",
162
+ " print_success(f\"{name} requirements installed in {time.time() - t0:.2f}s\")\n",
163
+ "progress_bar.update(1)\n",
164
+ "\n",
165
+ "#STEP 6: Download Imp Models\n",
166
+ "# Model URLs and target folders\n",
167
+ "print_step(\"Install Imp Models\")\n",
168
+ "models = {\n",
169
+ " \"sam_vit_b_01ec64.pth\": {\n",
170
+ " \"url\": \"https://huggingface.co/datasets/Gourieff/ReActor/resolve/main/models/sams/sam_vit_b_01ec64.pth\",\n",
171
+ " \"folder\": f\"{comfyui_path}/models/sams\"\n",
172
+ " },\n",
173
+ " \"face_yolov8m.pt\": {\n",
174
+ " \"url\": \"https://huggingface.co/outfly/face_yolov8m/resolve/main/face_yolov8m.pt\",\n",
175
+ " \"folder\": f\"{comfyui_path}/models/ultralytics\"\n",
176
+ " },\n",
177
+ " \"sdxl.vae.safetensors\": {\n",
178
+ " \"url\": \"https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl.vae.safetensors\",\n",
179
+ " \"folder\": f\"{comfyui_path}/models/vae\"\n",
180
+ " }\n",
181
+ "}\n",
182
+ "\n",
183
+ "def download_model(name, url, folder):\n",
184
+ " os.makedirs(folder, exist_ok=True)\n",
185
+ " file_path = os.path.join(folder, name)\n",
186
+ "\n",
187
+ " if os.path.exists(file_path):\n",
188
+ " print(f\"✅ {name} already exists at {file_path}. Skipping download.\")\n",
189
+ " return\n",
190
+ "\n",
191
+ " print(f\"⬇️ Downloading {name} to {file_path}...\")\n",
192
+ " try:\n",
193
+ " with requests.get(url, stream=True) as r:\n",
194
+ " r.raise_for_status()\n",
195
+ " with open(file_path, 'wb') as f:\n",
196
+ " for chunk in r.iter_content(chunk_size=8192):\n",
197
+ " if chunk:\n",
198
+ " f.write(chunk)\n",
199
+ " print_success(f\"{name} requirements installed in {time.time() - t0:.2f}s\")\n",
200
+ " except Exception as e:\n",
201
+ " print(f\"❌ Failed to download {name}: {e}\")\n",
202
+ "\n",
203
+ "# Loop through and download each model\n",
204
+ "for model_name, info in models.items():\n",
205
+ " download_model(model_name, info[\"url\"], info[\"folder\"])\n",
206
+ "\n",
207
+ "progress_bar.update(1)\n",
208
+ "\n",
209
+ "# Final Output\n",
210
+ "progress_bar.close()\n",
211
+ "clear_output()\n",
212
+ "cprint(\"🎉 All components installed successfully!\", \"green\", attrs=[\"bold\"])\n",
213
+ "cprint(f\"⏱️ Total setup time: {time.time() - overall_start:.2f} seconds.\", \"blue\", attrs=[\"bold\"])\n"
214
+ ],
215
+ "metadata": {
216
+ "id": "wYii9YaCYKIy",
217
+ "colab": {
218
+ "base_uri": "https://localhost:8080/",
219
+ "height": 590,
220
+ "referenced_widgets": [
221
+ "cbe6131ccff14a10b0bd704d85665f9f"
222
+ ]
223
+ },
224
+ "outputId": "ed887f13-afdf-4c8e-a58a-b76d7549b17b"
225
+ },
226
+ "execution_count": 1,
227
+ "outputs": [
228
+ {
229
+ "output_type": "stream",
230
+ "name": "stdout",
231
+ "text": [
232
+ "🎉 All components installed successfully!\n",
233
+ "⏱️ Total setup time: 312.03 seconds.\n"
234
+ ]
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "cell_type": "code",
240
+ "source": [
241
+ "#@title 2. Download model. { display-mode: \"form\" }\n",
242
+ "import os\n",
243
+ "import requests\n",
244
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
245
+ " \"\"\"\n",
246
+ " Downloads a model from Civitai using a bearer token.\n",
247
+ "\n",
248
+ " Args:\n",
249
+ " bearer_token: Your Civitai bearer token.\n",
250
+ " download_url: The URL of the model to download.\n",
251
+ " save_path: The full path to save the downloaded file.\n",
252
+ " \"\"\"\n",
253
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
254
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
255
+ "\n",
256
+ " if response.status_code == 200:\n",
257
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
258
+ " with open(save_path, \"wb\") as f:\n",
259
+ " for chunk in response.iter_content(chunk_size=1024):\n",
260
+ " if chunk:\n",
261
+ " f.write(chunk)\n",
262
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
263
+ " else:\n",
264
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
265
+ "\n",
266
+ "# Example usage:\n",
267
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
268
+ "download_url = \"https://civitai.com/api/download/models/1974239?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {type: \"string\"}\n",
269
+ "model_name = \"unholy_desire_mix\" # @param {type: \"string\"}\n",
270
+ "save_path = f\"/content/ComfyUI/models/checkpoints/{model_name}.safetensors\"\n",
271
+ "\n",
272
+ "download_civitai_model(bearer_token, download_url, save_path)"
273
+ ],
274
+ "metadata": {
275
+ "id": "C3aD3qzOWeJ7"
276
+ },
277
+ "execution_count": null,
278
+ "outputs": []
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "source": [
283
+ "#@title 4. Start Localtunnel. { display-mode: \"form\" }\n",
284
+ "# %cd into ComfyUI folder\n",
285
+ "%cd /content/ComfyUI\n",
286
+ "\n",
287
+ "# Silent install of termcolor and localtunnel\n",
288
+ "!pip install termcolor > /dev/null 2>&1\n",
289
+ "!npm install -g localtunnel > /dev/null 2>&1\n",
290
+ "\n",
291
+ "# Python setup\n",
292
+ "import subprocess\n",
293
+ "import threading\n",
294
+ "import time\n",
295
+ "import socket\n",
296
+ "import urllib.request\n",
297
+ "from termcolor import cprint\n",
298
+ "from IPython.display import display, HTML\n",
299
+ "\n",
300
+ "def wait_for_server(port):\n",
301
+ " while True:\n",
302
+ " time.sleep(0.5)\n",
303
+ " with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n",
304
+ " result = sock.connect_ex(('127.0.0.1', port))\n",
305
+ " if result == 0:\n",
306
+ " break\n",
307
+ "\n",
308
+ " cprint(\"\\n🚀 ComfyUI has started successfully!\", \"green\", attrs=[\"bold\"])\n",
309
+ " cprint(\"🌐 Setting up LocalTunnel for public access...\\n\", \"cyan\")\n",
310
+ "\n",
311
+ " try:\n",
312
+ " ip = urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\")\n",
313
+ "\n",
314
+ " # Display IP with click-to-copy box\n",
315
+ " html = f\"\"\"\n",
316
+ " <div style=\"font-family: monospace; font-size: 18px;\">\n",
317
+ " <strong>🔑 Public IP:</strong>\n",
318
+ " <div onclick=\"navigator.clipboard.writeText('{ip}'); this.innerHTML='📋 {ip} (Copied!)'; this.style.color='green';\"\n",
319
+ " style=\"cursor: pointer; border: 1px solid #ccc; padding: 10px; width: fit-content; border-radius: 6px; margin-top: 6px;\">\n",
320
+ " 📋 {ip} (Click to copy)\n",
321
+ " </div>\n",
322
+ " </div>\n",
323
+ " \"\"\"\n",
324
+ " display(HTML(html))\n",
325
+ " except:\n",
326
+ " cprint(\"⚠️ Failed to retrieve public IP\", \"red\")\n",
327
+ "\n",
328
+ " cprint(\"🔌 Connecting LocalTunnel (please wait)...\", \"yellow\")\n",
329
+ " process = subprocess.Popen([\"lt\", \"--port\", f\"{port}\"], stdout=subprocess.PIPE)\n",
330
+ " for line in process.stdout:\n",
331
+ " print(\"🌐\", line.decode(), end='')\n",
332
+ "\n",
333
+ "# Start server watcher thread\n",
334
+ "threading.Thread(target=wait_for_server, daemon=True, args=(8188,)).start()\n",
335
+ "\n",
336
+ "# Launch ComfyUI silently in CPU mode then add --cpu\n",
337
+ "!python main.py --dont-print-server > /dev/null 2>&1"
338
+ ],
339
+ "metadata": {
340
+ "id": "TUfeaupMKOLx"
341
+ },
342
+ "execution_count": null,
343
+ "outputs": []
344
+ }
345
+ ]
346
+ }
Foocus (3).ipynb ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "id": "5djKfVY4wlui"
8
+ },
9
+ "outputs": [],
10
+ "source": [
11
+ "from google.colab import drive\n",
12
+ "drive.mount('/content/drive')"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {
19
+ "id": "VjYy0F2gZIPR"
20
+ },
21
+ "outputs": [],
22
+ "source": [
23
+ "%cd /content\n",
24
+ "!git clone https://github.com/lllyasviel/Fooocus Fooocus-MRE\n",
25
+ "%cd /content/Fooocus-MRE\n",
26
+ "!wget --content-disposition https://raw.githubusercontent.com/Ysb321/supper/main/Data/config.txt\n",
27
+ "!cp settings-no-refiner.json settings.json\n",
28
+ "!pip install pygit2==1.12.2"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "markdown",
33
+ "metadata": {
34
+ "id": "Q7ACTQtyGTdv"
35
+ },
36
+ "source": [
37
+ "***IMPORTAR DESDE DRIVE***"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {
43
+ "id": "cXWssFHhGvs3"
44
+ },
45
+ "source": [
46
+ "***IMPORTAR DESDE CIVIT AI***"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": null,
52
+ "metadata": {
53
+ "cellView": "form",
54
+ "id": "EEJpE2bfjHcD"
55
+ },
56
+ "outputs": [],
57
+ "source": [
58
+ "!apt-get install aria2\n",
59
+ "civitai_model_urls = \"https://civitai.com/api/download/models/190908?type=Model&format=SafeTensor&size=full&fp=fp16\" # @param {'type': 'string'}\n",
60
+ "url_list = civitai_model_urls.split(\", \")\n",
61
+ "for url in url_list:\n",
62
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/checkpoints {url}"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {
69
+ "id": "tbbLTqyp1a7D"
70
+ },
71
+ "outputs": [],
72
+ "source": [
73
+ "#Modelos\n",
74
+ "!curl -Lo /content/Fooocus-MRE/models/checkpoints/darksun.safetensors https://civitai.com/api/download/models/171099?type=Model&format=SafeTensor&size=full&fp=fp16\n",
75
+ "#Loras\n",
76
+ "#!curl -Lo /content/Fooocus-MRE/models/loras/tu lora.safetensors link civitai.safetensors"
77
+ ]
78
+ },
79
+ {
80
+ "cell_type": "code",
81
+ "execution_count": null,
82
+ "metadata": {
83
+ "id": "SToIjOAeL2Ff"
84
+ },
85
+ "outputs": [],
86
+ "source": [
87
+ "!apt-get install aria2\n",
88
+ "import zipfile\n",
89
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/LOR.zip'\n",
90
+ "url_list = lora_zip_url.split(\", \")\n",
91
+ "for url in url_list:\n",
92
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}\n",
93
+ "directory = '/content/Fooocus-MRE/models/loras'\n",
94
+ "for filename in os.listdir(directory):\n",
95
+ " if '.' not in filename:\n",
96
+ " old_filepath = os.path.join(directory, filename)\n",
97
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
98
+ " os.rename(old_filepath, new_filepath)\n",
99
+ "current_dir = '/content/Fooocus-MRE/models/loras'\n",
100
+ "for entry in os.scandir(current_dir):\n",
101
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
102
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
103
+ " zip_ref.extractall(current_dir)\n",
104
+ "!rm /content/Fooocus-MRE/models/loras*.zip"
105
+ ]
106
+ },
107
+ {
108
+ "cell_type": "code",
109
+ "source": [
110
+ "# @title Embeddings\n",
111
+ "import os\n",
112
+ "import zipfile\n",
113
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other'\n",
114
+ "url_list = embeddings_zip_url.split(\", \")\n",
115
+ "for url in url_list:\n",
116
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /content/Fooocus-MRE/models/embeddings {url}\n",
117
+ "current_dir = '/content/Fooocus-MRE/models/embeddings'\n",
118
+ "for entry in os.scandir(current_dir):\n",
119
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
120
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
121
+ " zip_ref.extractall(current_dir)\n",
122
+ "!rm /content/Fooocus-MRE/models/embeddings/*.zip"
123
+ ],
124
+ "metadata": {
125
+ "id": "GftPvFz-RLbA"
126
+ },
127
+ "execution_count": null,
128
+ "outputs": []
129
+ },
130
+ {
131
+ "cell_type": "code",
132
+ "execution_count": null,
133
+ "metadata": {
134
+ "cellView": "form",
135
+ "id": "sWSjM7rYLf8f"
136
+ },
137
+ "outputs": [],
138
+ "source": [
139
+ "lora_url = 'https://civitai.com/api/download/models/173623?type=Model&format=SafeTensor, https://civitai.com/api/download/models/135867?type=Model&format=SafeTensor, https://civitai.com/api/download/models/157000?type=Model&format=SafeTensor, https://civitai.com/api/download/models/160240?type=Model&format=SafeTensor, https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor, https://civitai.com/api/download/models/179486?type=Model&format=SafeTensor, https://civitai.com/api/download/models/155308?type=Model&format=SafeTensor' # @param {'type': 'string'}\n",
140
+ "url_list = lora_url.split(\", \")\n",
141
+ "for url in url_list:\n",
142
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}"
143
+ ]
144
+ },
145
+ {
146
+ "cell_type": "code",
147
+ "execution_count": null,
148
+ "metadata": {
149
+ "id": "SeTjGIQZXHeo"
150
+ },
151
+ "outputs": [],
152
+ "source": [
153
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/vae https://civitai.com/api/download/models/121323?type=Model&format=SafeTensor"
154
+ ]
155
+ },
156
+ {
157
+ "cell_type": "code",
158
+ "source": [
159
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/153632?type=Model&format=SafeTensor"
160
+ ],
161
+ "metadata": {
162
+ "id": "q3E9paSPC4Jl"
163
+ },
164
+ "execution_count": null,
165
+ "outputs": []
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "source": [
170
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor"
171
+ ],
172
+ "metadata": {
173
+ "id": "hF7nFoJID3GF"
174
+ },
175
+ "execution_count": null,
176
+ "outputs": []
177
+ },
178
+ {
179
+ "cell_type": "code",
180
+ "execution_count": null,
181
+ "metadata": {
182
+ "id": "3WpiK93GLH7e"
183
+ },
184
+ "outputs": [],
185
+ "source": [
186
+ "%cd /content/Fooocus-MRE\n",
187
+ "!python entry_with_update.py --share"
188
+ ]
189
+ },
190
+ {
191
+ "cell_type": "code",
192
+ "execution_count": null,
193
+ "metadata": {
194
+ "id": "zL2kjwFktvr1"
195
+ },
196
+ "outputs": [],
197
+ "source": [
198
+ "!pip install -U insightface\n",
199
+ "!wget --content-disposition -P"
200
+ ]
201
+ }
202
+ ],
203
+ "metadata": {
204
+ "accelerator": "GPU",
205
+ "colab": {
206
+ "provenance": []
207
+ },
208
+ "kernelspec": {
209
+ "display_name": "Python 3",
210
+ "name": "python3"
211
+ },
212
+ "language_info": {
213
+ "name": "python"
214
+ }
215
+ },
216
+ "nbformat": 4,
217
+ "nbformat_minor": 0
218
+ }
Foocus latest fix.ipynb ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "id": "5djKfVY4wlui"
8
+ },
9
+ "outputs": [],
10
+ "source": [
11
+ "from google.colab import drive\n",
12
+ "drive.mount('/content/drive')"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {
19
+ "id": "VjYy0F2gZIPR"
20
+ },
21
+ "outputs": [],
22
+ "source": [
23
+ "%cd /content\n",
24
+ "!git clone https://github.com/lllyasviel/Fooocus Fooocus-MRE\n",
25
+ "%cd /content/Fooocus-MRE\n",
26
+ "!wget --content-disposition https://raw.githubusercontent.com/Ysb321/supper/main/Data/config.txt\n",
27
+ "!cp settings-no-refiner.json settings.json\n",
28
+ "!pip install pygit2==1.12.2\n",
29
+ "!pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "markdown",
34
+ "metadata": {
35
+ "id": "Q7ACTQtyGTdv"
36
+ },
37
+ "source": [
38
+ "***IMPORTAR DESDE DRIVE***"
39
+ ]
40
+ },
41
+ {
42
+ "cell_type": "markdown",
43
+ "metadata": {
44
+ "id": "cXWssFHhGvs3"
45
+ },
46
+ "source": [
47
+ "***IMPORTAR DESDE CIVIT AI***"
48
+ ]
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": null,
53
+ "metadata": {
54
+ "id": "EEJpE2bfjHcD",
55
+ "cellView": "form"
56
+ },
57
+ "outputs": [],
58
+ "source": [
59
+ "!apt-get install aria2\n",
60
+ "civitai_model_urls = \"https://civitai.com/api/download/models/370979?type=Model&format=SafeTensor&size=full&fp=fp16\" # @param {'type': 'string'}\n",
61
+ "url_list = civitai_model_urls.split(\", \")\n",
62
+ "for url in url_list:\n",
63
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/checkpoints {url}"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "source": [
69
+ "!curl -L -H \"Content-Type: application/json\" -H \"Authorization: Bearer 6748e0f8e6085cd9349551385ce8943a\" -o /content/Fooocus-MRE/models/checkpoints/sad.safetensors https://civitai.com/api/download/models/370979?type=Model&format=SafeTensor&token=6748e0f8e6085cd9349551385ce8943a&size=full&fp=fp16"
70
+ ],
71
+ "metadata": {
72
+ "id": "lWgF_98j4IMS"
73
+ },
74
+ "execution_count": null,
75
+ "outputs": []
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "metadata": {
81
+ "id": "tbbLTqyp1a7D"
82
+ },
83
+ "outputs": [],
84
+ "source": [
85
+ "#Modelos\n",
86
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/checkpoints https://civitai.com/api/download/models/237459?type=Model&format=SafeTensor&size=pruned&fp=fp16\n",
87
+ "#Loras\n",
88
+ "#!curl -Lo /content/Fooocus-MRE/models/loras/tu lora.safetensors link civitai.safetensors"
89
+ ]
90
+ },
91
+ {
92
+ "cell_type": "code",
93
+ "execution_count": null,
94
+ "metadata": {
95
+ "id": "SToIjOAeL2Ff"
96
+ },
97
+ "outputs": [],
98
+ "source": [
99
+ "!apt-get install aria2\n",
100
+ "import zipfile\n",
101
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/LOR.zip'\n",
102
+ "url_list = lora_zip_url.split(\", \")\n",
103
+ "for url in url_list:\n",
104
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}\n",
105
+ "directory = '/content/Fooocus-MRE/models/loras'\n",
106
+ "for filename in os.listdir(directory):\n",
107
+ " if '.' not in filename:\n",
108
+ " old_filepath = os.path.join(directory, filename)\n",
109
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
110
+ " os.rename(old_filepath, new_filepath)\n",
111
+ "current_dir = '/content/Fooocus-MRE/models/loras'\n",
112
+ "for entry in os.scandir(current_dir):\n",
113
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
114
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
115
+ " zip_ref.extractall(current_dir)\n",
116
+ "!rm /content/Fooocus-MRE/models/loras*.zip"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "source": [
122
+ "# @title Embeddings\n",
123
+ "import os\n",
124
+ "import zipfile\n",
125
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other'\n",
126
+ "url_list = embeddings_zip_url.split(\", \")\n",
127
+ "for url in url_list:\n",
128
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /content/Fooocus-MRE/models/embeddings {url}\n",
129
+ "current_dir = '/content/Fooocus-MRE/models/embeddings'\n",
130
+ "for entry in os.scandir(current_dir):\n",
131
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
132
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
133
+ " zip_ref.extractall(current_dir)\n",
134
+ "!rm /content/Fooocus-MRE/models/embeddings/*.zip"
135
+ ],
136
+ "metadata": {
137
+ "id": "GftPvFz-RLbA",
138
+ "cellView": "form"
139
+ },
140
+ "execution_count": null,
141
+ "outputs": []
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "execution_count": null,
146
+ "metadata": {
147
+ "cellView": "form",
148
+ "id": "sWSjM7rYLf8f"
149
+ },
150
+ "outputs": [],
151
+ "source": [
152
+ "lora_url = 'https://civitai.com/api/download/models/244808?type=Model&format=SafeTensor, https://civitai.com/api/download/models/173623?type=Model&format=SafeTensor, https://civitai.com/api/download/models/135867?type=Model&format=SafeTensor, https://civitai.com/api/download/models/157000?type=Model&format=SafeTensor, https://civitai.com/api/download/models/160240?type=Model&format=SafeTensor, https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor, https://civitai.com/api/download/models/179486?type=Model&format=SafeTensor, https://civitai.com/api/download/models/155308?type=Model&format=SafeTensor' # @param {'type': 'string'}\n",
153
+ "url_list = lora_url.split(\", \")\n",
154
+ "for url in url_list:\n",
155
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "code",
160
+ "execution_count": null,
161
+ "metadata": {
162
+ "id": "SeTjGIQZXHeo"
163
+ },
164
+ "outputs": [],
165
+ "source": [
166
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/vae https://civitai.com/api/download/models/121323?type=Model&format=SafeTensor"
167
+ ]
168
+ },
169
+ {
170
+ "cell_type": "code",
171
+ "source": [
172
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/244808?type=Model&format=SafeTensor"
173
+ ],
174
+ "metadata": {
175
+ "id": "q3E9paSPC4Jl"
176
+ },
177
+ "execution_count": null,
178
+ "outputs": []
179
+ },
180
+ {
181
+ "cell_type": "code",
182
+ "source": [
183
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor"
184
+ ],
185
+ "metadata": {
186
+ "id": "hF7nFoJID3GF"
187
+ },
188
+ "execution_count": null,
189
+ "outputs": []
190
+ },
191
+ {
192
+ "cell_type": "code",
193
+ "source": [
194
+ "def install_jemalloc():\n",
195
+ " !apt -y update -qq\n",
196
+ " !apt -y install libjemalloc-dev\n",
197
+ "install_jemalloc()"
198
+ ],
199
+ "metadata": {
200
+ "id": "PQOmZXyXfTh-"
201
+ },
202
+ "execution_count": null,
203
+ "outputs": []
204
+ },
205
+ {
206
+ "cell_type": "code",
207
+ "execution_count": null,
208
+ "metadata": {
209
+ "id": "3WpiK93GLH7e"
210
+ },
211
+ "outputs": [],
212
+ "source": [
213
+ "%cd /content/Fooocus-MRE\n",
214
+ "%env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
215
+ "!python entry_with_update.py --share"
216
+ ]
217
+ },
218
+ {
219
+ "cell_type": "code",
220
+ "execution_count": null,
221
+ "metadata": {
222
+ "id": "zL2kjwFktvr1"
223
+ },
224
+ "outputs": [],
225
+ "source": [
226
+ "!pip install -U insightface\n",
227
+ "!wget --content-disposition -P"
228
+ ]
229
+ }
230
+ ],
231
+ "metadata": {
232
+ "accelerator": "GPU",
233
+ "colab": {
234
+ "provenance": []
235
+ },
236
+ "kernelspec": {
237
+ "display_name": "Python 3",
238
+ "name": "python3"
239
+ },
240
+ "language_info": {
241
+ "name": "python"
242
+ }
243
+ },
244
+ "nbformat": 4,
245
+ "nbformat_minor": 0
246
+ }
ImgGen.ipynb ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "source": [
6
+ "from IPython.display import clear_output\n",
7
+ "!git clone https://github.com/Ysb321/ImgGen\n",
8
+ "!pip install -r /content/ImgGen/requirements.txt\n",
9
+ "clear_output()\n"
10
+ ],
11
+ "metadata": {
12
+ "id": "p6WhlbJGlcKP"
13
+ },
14
+ "execution_count": 1,
15
+ "outputs": []
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "source": [
20
+ "# @title Default Model (Important to run)\n",
21
+ "import os\n",
22
+ "import requests\n",
23
+ "\n",
24
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
25
+ " \"\"\"\n",
26
+ " Downloads a model from Civitai using a bearer token.\n",
27
+ "\n",
28
+ " Args:\n",
29
+ " bearer_token: Your Civitai bearer token.\n",
30
+ " download_url: The URL of the model to download.\n",
31
+ " save_path: The full path to save the downloaded file.\n",
32
+ " \"\"\"\n",
33
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
34
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
35
+ "\n",
36
+ " if response.status_code == 200:\n",
37
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
38
+ " with open(save_path, \"wb\") as f:\n",
39
+ " for chunk in response.iter_content(chunk_size=1024):\n",
40
+ " if chunk:\n",
41
+ " f.write(chunk)\n",
42
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
43
+ " else:\n",
44
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
45
+ "\n",
46
+ "# Example usage:\n",
47
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
48
+ "download_url = \"https://civitai.com/api/download/models/909781?type=Model&format=SafeTensor&size=full&fp=fp16\"\n",
49
+ "save_path = \"/content/models/default.safetensors\"\n",
50
+ "\n",
51
+ "download_civitai_model(bearer_token, download_url, save_path)"
52
+ ],
53
+ "metadata": {
54
+ "id": "NXQ7VYCFjux3",
55
+ "cellView": "form"
56
+ },
57
+ "execution_count": null,
58
+ "outputs": []
59
+ },
60
+ {
61
+ "cell_type": "code",
62
+ "source": [
63
+ "# @title Model Download\n",
64
+ "import os\n",
65
+ "import requests\n",
66
+ "\n",
67
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
68
+ " \"\"\"\n",
69
+ " Downloads a model from Civitai using a bearer token.\n",
70
+ "\n",
71
+ " Args:\n",
72
+ " bearer_token: Your Civitai bearer token.\n",
73
+ " download_url: The URL of the model to download.\n",
74
+ " save_path: The full path to save the downloaded file.\n",
75
+ " \"\"\"\n",
76
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
77
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
78
+ "\n",
79
+ " if response.status_code == 200:\n",
80
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
81
+ " with open(save_path, \"wb\") as f:\n",
82
+ " for chunk in response.iter_content(chunk_size=1024):\n",
83
+ " if chunk:\n",
84
+ " f.write(chunk)\n",
85
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
86
+ " else:\n",
87
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
88
+ "\n",
89
+ "# Example usage:\n",
90
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
91
+ "download_url = \"https://civitai.com/api/download/models/555687?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {type: \"string\"}\n",
92
+ "model_name = \"paintjob\" # @param {type: \"string\"}\n",
93
+ "save_path = f\"/content/models/{model_name}.safetensors\"\n",
94
+ "\n",
95
+ "download_civitai_model(bearer_token, download_url, save_path)"
96
+ ],
97
+ "metadata": {
98
+ "cellView": "form",
99
+ "id": "1jP2wKeeksGo"
100
+ },
101
+ "execution_count": null,
102
+ "outputs": []
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "source": [
107
+ "# @title Lora Download\n",
108
+ "\n",
109
+ "import os\n",
110
+ "import requests\n",
111
+ "\n",
112
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
113
+ " \"\"\"\n",
114
+ " Downloads a model from Civitai using a bearer token.\n",
115
+ "\n",
116
+ " Args:\n",
117
+ " bearer_token: Your Civitai bearer token.\n",
118
+ " download_url: The URL of the model to download.\n",
119
+ " save_path: The full path to save the downloaded file.\n",
120
+ " \"\"\"\n",
121
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
122
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
123
+ "\n",
124
+ " if response.status_code == 200:\n",
125
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
126
+ " with open(save_path, \"wb\") as f:\n",
127
+ " for chunk in response.iter_content(chunk_size=1024):\n",
128
+ " if chunk:\n",
129
+ " f.write(chunk)\n",
130
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
131
+ " else:\n",
132
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
133
+ "\n",
134
+ "# Example usage:\n",
135
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
136
+ "download_url = \"https://civitai.com/api/download/models/378950?type=Model&format=SafeTensor\" # @param {type: \"string\"}\n",
137
+ "model_name = \"styles\" # @param {type: \"string\"}\n",
138
+ "save_path = f\"/content/lora/{model_name}.safetensors\"\n",
139
+ "\n",
140
+ "download_civitai_model(bearer_token, download_url, save_path)"
141
+ ],
142
+ "metadata": {
143
+ "cellView": "form",
144
+ "id": "7vHNtfWSpbKN"
145
+ },
146
+ "execution_count": null,
147
+ "outputs": []
148
+ },
149
+ {
150
+ "cell_type": "code",
151
+ "source": [
152
+ "#@title Run\n",
153
+ "!python /content/ImgGen/main.py"
154
+ ],
155
+ "metadata": {
156
+ "id": "_E4CYZfAmqrw",
157
+ "cellView": "form"
158
+ },
159
+ "execution_count": null,
160
+ "outputs": []
161
+ },
162
+ {
163
+ "cell_type": "code",
164
+ "source": [
165
+ "# @title Zip file Creater\n",
166
+ "import os\n",
167
+ "import zipfile\n",
168
+ "from google.colab import files\n",
169
+ "\n",
170
+ "def zip_folder(folder_path, output_zip_path):\n",
171
+ " \"\"\"Zips the contents of a folder into a zip file.\n",
172
+ "\n",
173
+ " Args:\n",
174
+ " folder_path: The path to the folder to be zipped.\n",
175
+ " output_zip_path: The path to the output zip file.\n",
176
+ " \"\"\"\n",
177
+ " # Use zipfile for creating zip files\n",
178
+ " with zipfile.ZipFile(output_zip_path, 'w') as zip_file:\n",
179
+ " for root, _, files in os.walk(folder_path):\n",
180
+ " for file in files:\n",
181
+ " file_path = os.path.join(root, file)\n",
182
+ " zip_file.write(file_path, os.path.relpath(file_path, folder_path))\n",
183
+ "\n",
184
+ "# Replace with the actual path to your folder\n",
185
+ "folder_to_zip = \"/content/images\"\n",
186
+ "output_zip_file = \"/content/images.zip\"\n",
187
+ "\n",
188
+ "zip_folder(folder_to_zip, output_zip_file)"
189
+ ],
190
+ "metadata": {
191
+ "id": "Sjx_A0TNyeAS",
192
+ "cellView": "form"
193
+ },
194
+ "execution_count": null,
195
+ "outputs": []
196
+ },
197
+ {
198
+ "cell_type": "code",
199
+ "source": [
200
+ "!curl -L -H \"Content-Type: application/json\" -H \"Authorization: Bearer 6748e0f8e6085cd9349551385ce8943a\" -o /content/ImgGen/model_link.safetensors https://civitai.com/api/download/models/909781?type=Model&format=SafeTensor&size=full&fp=fp16"
201
+ ],
202
+ "metadata": {
203
+ "id": "aIa50T3Wz-kj"
204
+ },
205
+ "execution_count": null,
206
+ "outputs": []
207
+ }
208
+ ],
209
+ "metadata": {
210
+ "accelerator": "GPU",
211
+ "colab": {
212
+ "gpuType": "T4",
213
+ "provenance": []
214
+ },
215
+ "kernelspec": {
216
+ "display_name": "Python 3",
217
+ "name": "python3"
218
+ },
219
+ "language_info": {
220
+ "name": "python"
221
+ }
222
+ },
223
+ "nbformat": 4,
224
+ "nbformat_minor": 0
225
+ }
InvokeaiFix.ipynb ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "D4TNDJdRpPN9"
7
+ },
8
+ "source": [
9
+ "#Invoke AI Notebook\n",
10
+ "\n",
11
+ "Works on the free tier: Generating images with the SDXL base model and refiner. Adding SDXL models in diffusers format from HuggingFace.\n",
12
+ "\n",
13
+ "Works, but only with Colab Pro: Adding custom checkpoints and LoRAs."
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "markdown",
18
+ "metadata": {
19
+ "id": "Ow5L4LUnr_Cs"
20
+ },
21
+ "source": [
22
+ "Step 1"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {
29
+ "cellView": "form",
30
+ "id": "MIhVvU8jkdm6"
31
+ },
32
+ "outputs": [],
33
+ "source": [
34
+ "#@markdown # Installing InvokeAI\n",
35
+ "\n",
36
+ "#@markdown Use Google Drive to store models (uses about 7 GB). Uncheck this if you don't have enough space in your Drive.\n",
37
+ "useGoogleDrive = False #@param {type:\"boolean\"}\n",
38
+ "\n",
39
+ "googleDriveModelsFolder = '/stablemodels' #@param {type:\"string\"}\n",
40
+ "\n",
41
+ "#@markdown This step usually takes about 5 minutes.\n",
42
+ "\n",
43
+ "#@markdown You can ignore the message about restarting the runtime.\n",
44
+ "import os\n",
45
+ "import subprocess\n",
46
+ "from google.colab import drive\n",
47
+ "if useGoogleDrive:\n",
48
+ " drive.mount('/content/drive')\n",
49
+ " if not googleDriveModelsFolder.startswith('/'):\n",
50
+ " googleDriveModelsFolder = '/' + googleDriveModelsFolder\n",
51
+ " modelsPath = \"/content/drive/MyDrive\"+googleDriveModelsFolder\n",
52
+ " if not modelsPath.endswith(\"/\"):\n",
53
+ " modelsPath = modelsPath + \"/\"\n",
54
+ "\n",
55
+ "env = os.environ.copy()\n",
56
+ "\n",
57
+ "!pip install 'InvokeAI[xformers]' --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu117\n",
58
+ "\n",
59
+ "exit()\n"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "markdown",
64
+ "metadata": {
65
+ "id": "ERca0J67r8Ss"
66
+ },
67
+ "source": [
68
+ "Step 2"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": null,
74
+ "metadata": {
75
+ "cellView": "form",
76
+ "id": "YTkFxvuH0BsX"
77
+ },
78
+ "outputs": [],
79
+ "source": [
80
+ "#@markdown # Configuration and downloading default models\n",
81
+ "\n",
82
+ "!mkdir /content/invokeai\n",
83
+ "!mkdir /content/invokeai/configs\n",
84
+ "\n",
85
+ "#@markdown Download only the default model in initial configuration.\n",
86
+ "#@markdown Checking this prevents running out of space in Colab.\n",
87
+ "\n",
88
+ "defaultOnly = True #@param {type:\"boolean\"}\n",
89
+ "skipWeights = True #@param {type:\"boolean\"}\n",
90
+ "noFullPrecision = True #@param {type:\"boolean\"}\n",
91
+ "#@markdown This step usually takes about 2 minutes with only the default model and no weights.\n",
92
+ "\n",
93
+ "#@markdown You can ignore \"File exists\" warnings in the output.\n",
94
+ "\n",
95
+ "cmd = 'invokeai-configure --root_dir /content/invokeai --yes'\n",
96
+ "\n",
97
+ "if defaultOnly:\n",
98
+ " cmd += ' --default_only'\n",
99
+ "\n",
100
+ "if skipWeights:\n",
101
+ " cmd += ' --skip-sd-weights'\n",
102
+ "\n",
103
+ "if noFullPrecision:\n",
104
+ " cmd += ' --no-full-precision'\n",
105
+ "\n",
106
+ "get_ipython().system(cmd)\n",
107
+ "\n",
108
+ "import fileinput\n",
109
+ "import os\n",
110
+ "def find(name, path):\n",
111
+ " for root, dirs, files in os.walk(path):\n",
112
+ " if name in files:\n",
113
+ " return os.path.join(root, name)\n",
114
+ "\n",
115
+ "if noFullPrecision:\n",
116
+ " model_install_file = find('model_install_backend.py', '/usr/local/lib')\n",
117
+ " print('modifying file ' + model_install_file)\n",
118
+ " for line in fileinput.input(model_install_file, inplace=True):\n",
119
+ " if ('precision = torch_dtype(choose_torch_device())' in line):\n",
120
+ " line = line.replace('torch_dtype(choose_torch_device())', 'torch.float16')\n",
121
+ " print(line, end='')\n"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "metadata": {
128
+ "cellView": "form",
129
+ "colab": {
130
+ "base_uri": "https://localhost:8080/"
131
+ },
132
+ "id": "3owdtpnWsRoU",
133
+ "outputId": "a6873dfe-a211-427d-f158-b0865c5bf95e"
134
+ },
135
+ "outputs": [
136
+ {
137
+ "output_type": "stream",
138
+ "name": "stdout",
139
+ "text": [
140
+ "Mounted at /content/drive\n"
141
+ ]
142
+ }
143
+ ],
144
+ "source": [
145
+ "# Linking output images to Google Drive\n",
146
+ "outputDrivePath = '/content/drive/MyDrive/images/invoke-outputs' #@param {type:\"string\"}\n",
147
+ "# Full path to the output folder on Google Drive\n",
148
+ "\n",
149
+ "saveDatabase = True #@param {type:\"boolean\"}\n",
150
+ "from os import path\n",
151
+ "\n",
152
+ "from google.colab import drive\n",
153
+ "import os\n",
154
+ "from os import path\n",
155
+ "drive.mount('/content/drive')\n",
156
+ "\n",
157
+ "if not outputDrivePath.endswith('/'):\n",
158
+ " outputDrivePath = outputDrivePath + '/'\n",
159
+ "imagesDrivePath = outputDrivePath + 'images'\n",
160
+ "databaseDrivePath = outputDrivePath + 'databases'\n",
161
+ "if not path.exists(imagesDrivePath):\n",
162
+ " os.makedirs(imagesDrivePath, exist_ok=True)\n",
163
+ "\n",
164
+ "\n",
165
+ "outputsLocalPath = '/content/invokeai/outputs'\n",
166
+ "imagesLocalPath = '/content/invokeai/outputs/images'\n",
167
+ "\n",
168
+ "if not path.exists(outputsLocalPath):\n",
169
+ " os.makedirs(outputsLocalPath, exist_ok=True)\n",
170
+ "\n",
171
+ "import datetime\n",
172
+ "\n",
173
+ "if path.exists(imagesLocalPath):\n",
174
+ " cmd = f'mv {imagesLocalPath} {imagesLocalPath}-backup{datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\")}'\n",
175
+ " get_ipython().system(cmd)\n",
176
+ "\n",
177
+ "cmd = f'ln -s {imagesDrivePath} {outputsLocalPath}'\n",
178
+ "get_ipython().system(cmd)\n",
179
+ "\n",
180
+ "# Linking the database\n",
181
+ "if saveDatabase:\n",
182
+ " if not path.exists(databaseDrivePath):\n",
183
+ " os.makedirs(databaseDrivePath, exist_ok=True)\n",
184
+ "\n",
185
+ " databaseLocalPath = '/content/invokeai/databases'\n",
186
+ "\n",
187
+ " cmd = f'mv {databaseLocalPath} {databaseLocalPath}-backup{datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\")}'\n",
188
+ " get_ipython().system(cmd)\n",
189
+ "\n",
190
+ " cmd = f'ln -s {databaseDrivePath} /content/invokeai'\n",
191
+ " get_ipython().system(cmd)\n"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "markdown",
196
+ "metadata": {
197
+ "id": "jS0EJ4LosUFY"
198
+ },
199
+ "source": [
200
+ "Step 6: Load any SDXL models in diffusers format from Drive - Optional"
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "execution_count": null,
206
+ "metadata": {
207
+ "cellView": "form",
208
+ "id": "sdaNxzYPsaXX"
209
+ },
210
+ "outputs": [],
211
+ "source": [
212
+ "# Adding custom SDXL models in diffusers format from Goole Drive\n",
213
+ "googleDriveModelFolder = '/content/drive/MyDrive/path-to-the-model' #@param {type:\"string\"}\n",
214
+ "#@markdown - Full path to the model folder on Google Drive\n",
215
+ "\n",
216
+ "#@markdown This can also be done from the Model Manager in the Web UI.\n",
217
+ "\n",
218
+ "updateModelsYaml = True\n",
219
+ "with open('/content/invokeai/configs/models.yaml') as f:\n",
220
+ " if googleDriveModelFolder in f.read():\n",
221
+ " updateModelsYaml = False\n",
222
+ "if updateModelsYaml:\n",
223
+ " with open('/content/invokeai/configs/models.yaml', 'a') as file:\n",
224
+ " folders = googleDriveModelFolder.split('/');\n",
225
+ " modelname = folders[len(folders)-1]\n",
226
+ " print(modelname)\n",
227
+ " lines = [\n",
228
+ " 'sdxl/main/' + modelname + ':\\n',\n",
229
+ " ' path: ' + googleDriveModelFolder + '\\n',\n",
230
+ " ' description: Stable Diffusion XL base model (12 GB)\\n',\n",
231
+ " ' variant: normal\\n',\n",
232
+ " ' format: diffusers\\n'\n",
233
+ " ]\n",
234
+ " file.writelines(lines)"
235
+ ]
236
+ },
237
+ {
238
+ "cell_type": "markdown",
239
+ "metadata": {
240
+ "id": "T4xrUy3Gsomd"
241
+ },
242
+ "source": [
243
+ "Step 7: Starting the app"
244
+ ]
245
+ },
246
+ {
247
+ "cell_type": "code",
248
+ "execution_count": null,
249
+ "metadata": {
250
+ "id": "nCiDkdSlqZhd"
251
+ },
252
+ "outputs": [],
253
+ "source": [
254
+ "def install_jemalloc():\n",
255
+ " !apt -y update -qq\n",
256
+ " !apt -y install libjemalloc-dev\n",
257
+ "install_jemalloc()"
258
+ ]
259
+ },
260
+ {
261
+ "cell_type": "code",
262
+ "execution_count": null,
263
+ "metadata": {
264
+ "cellView": "form",
265
+ "id": "e-IErS_AaNNz"
266
+ },
267
+ "outputs": [],
268
+ "source": [
269
+ "!apt-get install aria2\n",
270
+ "civitai_model_urls = \"https://civitai.com/api/download/models/157223?type=Model&format=SafeTensor&size=pruned&fp=fp16, https://civitai.com/api/download/models/138176?type=Model&format=SafeTensor&size=pruned&fp=fp32\" # @param {'type': 'string'}\n",
271
+ "url_list = civitai_model_urls.split(\", \")\n",
272
+ "for url in url_list:\n",
273
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main {url}"
274
+ ]
275
+ },
276
+ {
277
+ "cell_type": "code",
278
+ "execution_count": null,
279
+ "metadata": {
280
+ "cellView": "form",
281
+ "id": "QC6jE2afaVHy"
282
+ },
283
+ "outputs": [],
284
+ "source": [
285
+ "# @title Embeddings\n",
286
+ "import zipfile\n",
287
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other'\n",
288
+ "url_list = embeddings_zip_url.split(\", \")\n",
289
+ "for url in url_list:\n",
290
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /content/invokeai/models/sd-1/embedding {url}\n",
291
+ "current_dir = '/content/invokeai/models/sd-1/embedding'\n",
292
+ "for entry in os.scandir(current_dir):\n",
293
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
294
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
295
+ " zip_ref.extractall(current_dir)\n",
296
+ "!rm /content/invokeai/models/sd-1/embedding/*.zip"
297
+ ]
298
+ },
299
+ {
300
+ "cell_type": "code",
301
+ "execution_count": null,
302
+ "metadata": {
303
+ "cellView": "form",
304
+ "id": "zPR0gqrAc97R"
305
+ },
306
+ "outputs": [],
307
+ "source": [
308
+ "# @title lorazip\n",
309
+ "import zipfile\n",
310
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip'\n",
311
+ "url_list = lora_zip_url.split(\", \")\n",
312
+ "for url in url_list:\n",
313
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/lora {url}\n",
314
+ "directory = '/content/invokeai/models/sd-1/lora'\n",
315
+ "for filename in os.listdir(directory):\n",
316
+ " if '.' not in filename:\n",
317
+ " old_filepath = os.path.join(directory, filename)\n",
318
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
319
+ " os.rename(old_filepath, new_filepath)\n",
320
+ "current_dir = '/content/invokeai/models/sd-1/lora'\n",
321
+ "for entry in os.scandir(current_dir):\n",
322
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
323
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
324
+ " zip_ref.extractall(current_dir)\n",
325
+ "!rm /content/invokeai/models/sd-1/lora/*.zip"
326
+ ]
327
+ },
328
+ {
329
+ "cell_type": "code",
330
+ "source": [
331
+ "lora_url = 'https://civitai.com/api/download/models/139136' # @param {'type': 'string'}\n",
332
+ "url_list = lora_url.split(\", \")\n",
333
+ "for url in url_list:\n",
334
+ " !wget --content-disposition -P /content/invokeai/models/sd-1/lora {url}"
335
+ ],
336
+ "metadata": {
337
+ "cellView": "form",
338
+ "id": "iOf2elAdGwqc"
339
+ },
340
+ "execution_count": null,
341
+ "outputs": []
342
+ },
343
+ {
344
+ "cell_type": "code",
345
+ "execution_count": null,
346
+ "metadata": {
347
+ "cellView": "form",
348
+ "id": "8P-UgO8Ysrlz"
349
+ },
350
+ "outputs": [],
351
+ "source": [
352
+ "#@markdown # Option 2: Starting the Web UI with ngrok\n",
353
+ "!pip install pyngrok\n",
354
+ "\n",
355
+ "from pyngrok import ngrok, conf\n",
356
+ "import fileinput\n",
357
+ "import sys\n",
358
+ "%env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
359
+ "Ngrok_token = \"\" #@param {type:\"string\"}\n",
360
+ "#@markdown - Add ngrok token (obtainable from https://ngrok.com)\n",
361
+ "\n",
362
+ "#@markdown Only works with InvokeAI 3.0.2 and later\n",
363
+ "\n",
364
+ "share=''\n",
365
+ "if Ngrok_token!=\"\":\n",
366
+ " ngrok.kill()\n",
367
+ " srv=ngrok.connect(9090 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),\n",
368
+ " bind_tls=True).public_url\n",
369
+ " print(srv)\n",
370
+ " get_ipython().system(\"invokeai-web --root /content/invokeai/\")\n",
371
+ "else:\n",
372
+ " print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token field.')"
373
+ ]
374
+ },
375
+ {
376
+ "cell_type": "code",
377
+ "execution_count": null,
378
+ "metadata": {
379
+ "cellView": "form",
380
+ "id": "qN-IExD5XwOs"
381
+ },
382
+ "outputs": [],
383
+ "source": [
384
+ "#@markdown # Option 1: Starting the Web UI with Localtunnel\n",
385
+ "\n",
386
+ "%cd /content/invokeai/\n",
387
+ "!npm install -g localtunnel\n",
388
+ "\n",
389
+ "#@markdown Copy the IP address shown in the output above the line\n",
390
+ "#@markdown \"your url is: https://some-random-words.loca.lt\"\n",
391
+ "!wget -q -O - ipv4.icanhazip.com\n",
392
+ "\n",
393
+ "#@markdown Wait for the line that says \"Uvicorn running on http://127.0.0.1:9090 (Press CTRL+C to quit)\"\n",
394
+ "\n",
395
+ "#@markdown Click the localtunnel url and paste the IP you copied earlier to the \"Endpoint IP\" text field\n",
396
+ "!lt --port 9090 --local_https False & invokeai-web --root /content/invokeai/\n",
397
+ "\n",
398
+ "#@markdown If the UI shows a red dot that says 'disconnected' when hovered in the upper\n",
399
+ "#@markdown right corner and the Invoke button is disabled, change 'https' to 'http'\n",
400
+ "#@markdown in the browser's address bar and press enter.\n",
401
+ "#@markdown When the page reloads, the UI should work properly.\n"
402
+ ]
403
+ }
404
+ ],
405
+ "metadata": {
406
+ "accelerator": "GPU",
407
+ "colab": {
408
+ "provenance": []
409
+ },
410
+ "kernelspec": {
411
+ "display_name": "Python 3",
412
+ "name": "python3"
413
+ },
414
+ "language_info": {
415
+ "name": "python"
416
+ }
417
+ },
418
+ "nbformat": 4,
419
+ "nbformat_minor": 0
420
+ }
Invokeai_in_google_colab+nova_furry+zrok (1).ipynb ADDED
@@ -0,0 +1,774 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "jy86JeXPHQmW"
7
+ },
8
+ "source": [
9
+ "# InvokeAI in Google Colab\n",
10
+ "\n",
11
+ "## Moved over to Direct Python from UV.\n",
12
+ "\n",
13
+ "###Introduction\n",
14
+ "\n",
15
+ "This is a tool to use Google Colab to run the AI image generation tool: Invokeai (https://invoke-ai.github.io/InvokeAI/). <br />\n",
16
+ "This can save the generated iamges in Google Drive or work purely in the runtime. <br />\n",
17
+ "You can optionally save your models in Google Drive too, This takes up far more space but makes resuming generation very simple. <br />\n",
18
+ "\n",
19
+ "A GPU should be enabled by default, but if not the setting can be found in the menu under: Edit > Notebook Settings > Hardware accelerator > T4 GPU\n",
20
+ "\n",
21
+ "To start, Click \"Runtime\" > \"Run All\". Alternaivly you can click the \"play\" button on each step below one after the other, No need to wait for the previous steps to finish as they will join a queue.\n",
22
+ "\n",
23
+ "This uses the \"Low VMRAM mode\" included with InvokeAI 5.5.0+"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "source": [
29
+ "# @title Vae Download\n",
30
+ "import os\n",
31
+ "import requests\n",
32
+ "\n",
33
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
34
+ " \"\"\"\n",
35
+ " Downloads a model from Civitai using a bearer token.\n",
36
+ "\n",
37
+ " Args:\n",
38
+ " bearer_token: Your Civitai bearer token.\n",
39
+ " download_url: The URL of the model to download.\n",
40
+ " save_path: The full path to save the downloaded file.\n",
41
+ " \"\"\"\n",
42
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
43
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
44
+ "\n",
45
+ " if response.status_code == 200:\n",
46
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
47
+ " with open(save_path, \"wb\") as f:\n",
48
+ " for chunk in response.iter_content(chunk_size=1024):\n",
49
+ " if chunk:\n",
50
+ " f.write(chunk)\n",
51
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
52
+ " else:\n",
53
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
54
+ "\n",
55
+ "# Example usage:\n",
56
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
57
+ "download_url = \"https://civitai.com/api/download/models/1865346?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {type: \"string\"}\n",
58
+ "model_name = \"nova_furry_il\" # @param {type: \"string\"}\n",
59
+ "save_path = f\"/content/invokeai/models/sd-1/main/{model_name}.safetensors\"\n",
60
+ "\n",
61
+ "download_civitai_model(bearer_token, download_url, save_path)"
62
+ ],
63
+ "metadata": {
64
+ "cellView": "form",
65
+ "id": "TZQKla507O_5"
66
+ },
67
+ "execution_count": null,
68
+ "outputs": []
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": null,
73
+ "metadata": {
74
+ "collapsed": true,
75
+ "id": "cEAEBY2sFdGR"
76
+ },
77
+ "outputs": [],
78
+ "source": [
79
+ "#@title 1. Configuration { display-mode: \"form\" }\n",
80
+ "#@markdown #Instance Type\n",
81
+ "#@markdown **Google_Drive** = Stores Models, Images and the database in your Google drive, the space it takes up is hevily based on the type and number of models that you are using. <br>\n",
82
+ "#@markdown **Temporary** = Everything is stored in the runtime and is removed when the runtime ends or crashes, make sure to download your images! <br>\n",
83
+ "Type = \"Temporary\" #@param ['Google_Drive','Temporary'] {type:\"string\"}\n",
84
+ "#@markdown If using \"Google Drive\" mode, where do you want the models saved to? <br>\n",
85
+ "#@markdown I recomend also using Google_Drive, however if you have limited space and want to only save images to Drive, you can change that here!\n",
86
+ "Models = \"Temporary\" #@param ['Google_Drive','Temporary'] {type:\"string\"}\n",
87
+ "#@markdown Note: if you don't save models to drive and you re-load the same instance the models will think they are still there, you have to remove + re-download them.\n",
88
+ "\n",
89
+ "#@markdown ---\n",
90
+ "\n",
91
+ "#@markdown #Connection Type.\n",
92
+ "#@markdown **NGROK**: (Recomended) Highly stable but needs a little setting up, An NGROK token is required, sign up for free and get one here: https://dashboard.ngrok.com/get-started/your-authtoken - Once you have the token, please put it in below.<br>\n",
93
+ "#@markdown **NGROK_APT**: An aternate version of NGROK that runs as a Linux service rather than a python service.<br>\n",
94
+ "#@markdown **Localtunnel**: Slower than NGROK and more often has issues, but will just work, no token or config needed.<br>\n",
95
+ "connection_type = \"ZROCK\" #@param [\"Localtunnel\",\"NGROK\",\"NGROK_APT\", \"ZROCK\"]\n",
96
+ "ngrok_token = \"naxmZIGiX6WD\" #@param ['None'] {allow-input: true}\n",
97
+ "\n",
98
+ "#@markdown ---\n",
99
+ "#@markdown #Instance Selector.\n",
100
+ "#@markdown If you would like to have more than one instance of InvokeAI so you can keep things seperate you can do this here: <br>\n",
101
+ "#@markdown \"Default\" Keeps the files either in /content/invokeai or /content/drive/MyDrive/InvokeAI <br>\n",
102
+ "#@markdown Changing this to anything else puts the files in a sub-folder of that location called \"CustomInstances\" and then the Instance name.\n",
103
+ "Instance = \"Default\" #@param [\"Default\",\"Anime\",\"Photorealism\"] {allow-input: true}\n",
104
+ "\n",
105
+ "\n",
106
+ "#@markdown ---\n",
107
+ "#@markdown #InvokeAi Version.\n",
108
+ "#@markdown The default version is \"the latest stable release of InvokeAI\" If you want to specify a specific version, please input that here: <br>\n",
109
+ "#@markdown Any version 5.7.2+ should work with all features, anything before 5.0.0 will probably not work at all.\n",
110
+ "version = \"Default\" #@param [\"Default\",\"5.7.2\",\"5.6.1\"] {allow-input: true}\n",
111
+ "\n",
112
+ "#@markdown ---\n",
113
+ "#@markdown #Model Management.\n",
114
+ "#@markdown All model mangement is all done in-app, the \"Model Manager\" is found on the left hand side once you are in the app. <br />\n",
115
+ "#@markdown If you are using Temprory Mode, and want to attach Google Drive purely to import models from, tick this box.\n",
116
+ "GDrive_Import = False #@param {type: \"boolean\"}\n",
117
+ "#@markdown The path to the root of your Google drive will be added as: /content/drive/MyDrive/ You will use that in the \"Model manager\" to import models.\n",
118
+ "\n",
119
+ "\n",
120
+ "#@markdown ---\n",
121
+ "#@markdown #Memory Management.\n",
122
+ "#@markdown InvokeAI offers two memory allocator methods to load and manage models in VRAM. Typically, the CUDA allocator outperforms the pytorch allocator, reducing peak VRAM usage. in most cases, CUDA should improve generation speeds. <br>\n",
123
+ "#@markdown Note: InvokeAI Version 5.7.2+ only (Please use 'pytorch' for older versions) <br />\n",
124
+ "#@markdown Note2: If you for whatever reason want to use CPU mode... Please choose \"pytorch\" as CUDA will not work.\n",
125
+ "MemoryManagementMethod = \"CUDA\" #@param [\"CUDA\",\"pytorch\"]\n",
126
+ "\n",
127
+ "\n",
128
+ "\n",
129
+ "from IPython.display import clear_output\n",
130
+ "\n",
131
+ "#Setting File Path\n",
132
+ "file_path = '/content/invokeai'\n",
133
+ "\n",
134
+ "#Set up temporary storage if running in \"Temporary\" mode.\n",
135
+ "if Type == \"Temporary\":\n",
136
+ " import os\n",
137
+ " if not os.path.exists(file_path):\n",
138
+ " os.makedirs(file_path)\n",
139
+ "\n",
140
+ " #Mount google drive for model imports if requested.\n",
141
+ " if GDrive_Import == True:\n",
142
+ " import os\n",
143
+ " from google.colab import drive\n",
144
+ " if not os.path.exists('/content/drive/'):\n",
145
+ " print(\"Connecting to Google Drive, please log in, using the pop-up window.\")\n",
146
+ " drive.mount('/content/drive')\n",
147
+ " print(\"Connected!\")\n",
148
+ "\n",
149
+ "# Mount and set up Google drive if running in \"Google_Drive\" mode.\n",
150
+ "if Type == \"Google_Drive\":\n",
151
+ " import os\n",
152
+ " from google.colab import drive\n",
153
+ " if not os.path.exists(file_path):\n",
154
+ " print(\"Connecting to Google Drive, please log in, using the pop-up window.\")\n",
155
+ " drive.mount('/content/drive')\n",
156
+ " if not os.path.exists(file_path):\n",
157
+ " os.makedirs(file_path)\n",
158
+ " print(\"Connected!\")\n",
159
+ "\n",
160
+ "#set working DIR\n",
161
+ "%cd {file_path}\n",
162
+ "\n",
163
+ "#Clear Output\n",
164
+ "clear_output()\n",
165
+ "\n",
166
+ "print(\"=======================\")\n",
167
+ "print(\"|Install Dependencies.|\");\n",
168
+ "print(\"=======================\")\n",
169
+ "\n",
170
+ "#Update pip\n",
171
+ "!curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py\n",
172
+ "!python -m pip install --upgrade pip\n",
173
+ "\n",
174
+ "#Create InvokeAI root\n",
175
+ "import os\n",
176
+ "os.environ['INVOKEAI_ROOT'] = file_path\n",
177
+ "if not os.path.exists(file_path):\n",
178
+ " os.makedirs(invokeai_root)\n",
179
+ "\n",
180
+ "#Confirm that This is working in the correct place.\n",
181
+ "%cd {file_path}\n",
182
+ "\n",
183
+ "#Clear Output\n",
184
+ "clear_output()\n",
185
+ "\n",
186
+ "\n",
187
+ "print(\" \")\n",
188
+ "print(\"======================\")\n",
189
+ "print(\"|1. Install InvokeAI.|\")\n",
190
+ "print(\"======================\")\n",
191
+ "\n",
192
+ "#Version selector\n",
193
+ "if version == \"Default\":\n",
194
+ " print(\" \")\n",
195
+ " print(\"Installing the Latest stable release of InvokeAI. (4-5 mins)\")\n",
196
+ " !pip install invokeai[xformers] &> /dev/null\n",
197
+ "if version != \"Default\":\n",
198
+ " print(\" \")\n",
199
+ " print(\"Installing the requested release of InvokeAI. (4-5 mins)\")\n",
200
+ " print(version)\n",
201
+ " !pip install invokeai[xformers]=={version} &> /dev/null\n",
202
+ "\n",
203
+ "print(\" \");\n",
204
+ "print(\"App Installed!\");\n",
205
+ "\n",
206
+ "#This 'Deactivate' is needed incase you run this twice in one session where an update is released between runs, it will error 99% of the time.\n",
207
+ "if os.path.exists(\"/content/RunSuccess\"):\n",
208
+ " print(\" \")\n",
209
+ " print(\"This Deactivate only is needed on subsiquent runs. Ignore that it has errored. It will most of the time, and is a cleanup.\")\n",
210
+ " !deactivate\n",
211
+ " print(\"Deactivate command has been executed.\")\n",
212
+ "if not os.path.exists(\"/content/RunSuccess\"):\n",
213
+ " !touch \"/content/RunSuccess\"\n",
214
+ "\n",
215
+ "print(\" \")\n",
216
+ "print(\"Expected Error saying path does not exist:\")\n",
217
+ "!source .venv/bin/activate\n",
218
+ "\n",
219
+ "\n",
220
+ "print(\" \")\n",
221
+ "print(\"========================\")\n",
222
+ "print(\"|2. Configure InvokeAI.|\")\n",
223
+ "print(\"========================\")\n",
224
+ "\n",
225
+ "#Settings for ALL instances.\n",
226
+ "!echo \"# Internal metadata - do not edit:\" > /content/invokeai/invokeai.yaml\n",
227
+ "!echo \"schema_version: 4.0.2\" >> /content/invokeai/invokeai.yaml\n",
228
+ "!echo \" \" >> /content/invokeai/invokeai.yaml\n",
229
+ "!echo \"# Put user settings here - see https://invoke-ai.github.io/InvokeAI/configuration/:\" >> /content/invokeai/invokeai.yaml\n",
230
+ "\n",
231
+ "\n",
232
+ "#Default Instance location.\n",
233
+ "if Instance == \"Default\":\n",
234
+ " if Type == \"Google_Drive\":\n",
235
+ " print(\" \")\n",
236
+ " print(\"Configuring the runtime for 'Google Drive' storage.\")\n",
237
+ "\n",
238
+ " if Models == \"Google_Drive\":\n",
239
+ " !echo \"models_dir: /content/drive/MyDrive/InvokeAI/Models\" >> /content/invokeai/invokeai.yaml\n",
240
+ " !echo \"outputs_dir: /content/drive/MyDrive/InvokeAI\" >> /content/invokeai/invokeai.yaml\n",
241
+ " !echo \"db_dir: /content/drive/MyDrive/InvokeAI/DB\" >> /content/invokeai/invokeai.yaml\n",
242
+ " !echo \"enable_partial_loading: true\" >> /content/invokeai/invokeai.yaml\n",
243
+ " if MemoryManagementMethod == \"CUDA\":\n",
244
+ " !echo \"pytorch_cuda_alloc_conf: \\\"backend:cudaMallocAsync\\\"\" >> /content/invokeai/invokeai.yaml\n",
245
+ " print(\" \")\n",
246
+ " print(\"Locations set for Google Drive!\");\n",
247
+ "\n",
248
+ " if Type == \"Temporary\":\n",
249
+ " print(\" \")\n",
250
+ " print(\"Configuring the runtime for 'Temporary' storage.\")\n",
251
+ "\n",
252
+ " !echo \"enable_partial_loading: true\" >> /content/invokeai/invokeai.yaml\n",
253
+ " if MemoryManagementMethod == \"CUDA\":\n",
254
+ " !echo \"pytorch_cuda_alloc_conf: \\\"backend:cudaMallocAsync\\\"\" >> /content/invokeai/invokeai.yaml\n",
255
+ " print(\" \")\n",
256
+ " print(\"Locations set for Temporary Storage!\");\n",
257
+ "\n",
258
+ "#Non-Default Instance location.\n",
259
+ "if Instance != \"Default\":\n",
260
+ " if Type == \"Google_Drive\":\n",
261
+ " print(\" \")\n",
262
+ " print(\"Configuring the runtime for 'Google Drive' storage, with custom instance.\")\n",
263
+ " print(\" \")\n",
264
+ " print(\"Instance name:\")\n",
265
+ " print(Instance)\n",
266
+ "\n",
267
+ " if Models == \"Google_Drive\":\n",
268
+ " !echo \"models_dir: /content/drive/MyDrive/InvokeAI/CustomInstances/{Instance}/Models\" >> /content/invokeai/invokeai.yaml\n",
269
+ " !echo \"outputs_dir: /content/drive/MyDrive/InvokeAI/CustomInstances/{Instance}\" >> /content/invokeai/invokeai.yaml\n",
270
+ " !echo \"db_dir: /content/drive/MyDrive/InvokeAI/CustomInstances/{Instance}/DB\" >> /content/invokeai/invokeai.yaml\n",
271
+ " !echo \"enable_partial_loading: true\" >> /content/invokeai/invokeai.yaml\n",
272
+ " if MemoryManagementMethod == \"CUDA\":\n",
273
+ " !echo \"pytorch_cuda_alloc_conf: \\\"backend:cudaMallocAsync\\\"\" >> /content/invokeai/invokeai.yaml\n",
274
+ " print(\" \")\n",
275
+ " print(\"Locations set for Google Drive!\");\n",
276
+ "\n",
277
+ "\n",
278
+ " if Type == \"Temporary\":\n",
279
+ " print(\" \")\n",
280
+ " print(\"Configuring the runtime for 'Temporary' storage, with custom instance.\")\n",
281
+ " print(\" \")\n",
282
+ " print(\"Instance name:\")\n",
283
+ " print(Instance)\n",
284
+ "\n",
285
+ " !echo \"models_dir: /content/invokeai/CustomInstances/{Instance}/Models\" >> /content/invokeai/invokeai.yaml\n",
286
+ " !echo \"outputs_dir: /content/invokeai/CustomInstances/{Instance}\" >> /content/invokeai/invokeai.yaml\n",
287
+ " !echo \"db_dir: /content/invokeai/CustomInstances/{Instance}/DB\" >> /content/invokeai/invokeai.yaml\n",
288
+ " !echo \"enable_partial_loading: true\" >> /content/invokeai/invokeai.yaml\n",
289
+ " if MemoryManagementMethod == \"CUDA\":\n",
290
+ " !echo \"pytorch_cuda_alloc_conf: \\\"backend:cudaMallocAsync\\\"\" >> /content/invokeai/invokeai.yaml\n",
291
+ " print(\" \")\n",
292
+ " print(\"Locations set for Temporary Storage!\");\n",
293
+ "\n",
294
+ "#Misc Fixes\n",
295
+ "print(\" \")\n",
296
+ "print(\"================\")\n",
297
+ "print(\"|3. Misc Fixes.|\")\n",
298
+ "print(\"================\")\n",
299
+ "\n",
300
+ "#Re-Install some features.\n",
301
+ "print(\" \")\n",
302
+ "print(\"Reinstalling some PIP modules to make sure they function correctly.\")\n",
303
+ "\n",
304
+ "#These ones were previously needed but break things now, leaving as comment for now.\n",
305
+ "#!pip uninstall -y opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp pydantic &> /dev/null\n",
306
+ "#!pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp pydantic &> /dev/null\n",
307
+ "\n",
308
+ "!pip uninstall -y fastapi-events fastapi &> /dev/null\n",
309
+ "!pip install fastapi-events fastapi &> /dev/null\n",
310
+ "!pip install --upgrade jax_cuda12_plugin &> /dev/null\n",
311
+ "\n",
312
+ "\n",
313
+ "#Success message\n",
314
+ "print(\" \")\n",
315
+ "print(\"================================\")\n",
316
+ "print(\"|5. Done! Launch the app below!|\")\n",
317
+ "print(\"================================\")\n",
318
+ "print(\" \")\n",
319
+ "print(\"Note: For some reason when you start the app it will throw the below error... and then work anyway! Please ignore that error!\")\n",
320
+ "print(\"/bin/bash: line 1: /content/invokeai/.venv/bin/activate: No such file or directory\")\n",
321
+ "\n",
322
+ "#@markdown #Download Model\n",
323
+ "\n",
324
+ "# Navigate to the directory, remove existing YAML files, and download new ones\n",
325
+ "!cd /content/invokeai && \\\n",
326
+ "rm -f invokeai.yaml invokeai.example.yaml && \\\n",
327
+ "wget -O invokeai.yaml https://github.com/Ysb321/sd.net/releases/download/invokeAI/invokeai.yaml && \\\n",
328
+ "wget -O invokeai.example.yaml https://github.com/Ysb321/sd.net/releases/download/invokeAI/invokeai.example.yaml\n",
329
+ "# @title Vae Download\n",
330
+ "import os\n",
331
+ "import requests\n",
332
+ "\n",
333
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
334
+ " \"\"\"\n",
335
+ " Downloads a model from Civitai using a bearer token.\n",
336
+ "\n",
337
+ " Args:\n",
338
+ " bearer_token: Your Civitai bearer token.\n",
339
+ " download_url: The URL of the model to download.\n",
340
+ " save_path: The full path to save the downloaded file.\n",
341
+ " \"\"\"\n",
342
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
343
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
344
+ "\n",
345
+ " if response.status_code == 200:\n",
346
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
347
+ " with open(save_path, \"wb\") as f:\n",
348
+ " for chunk in response.iter_content(chunk_size=1024):\n",
349
+ " if chunk:\n",
350
+ " f.write(chunk)\n",
351
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
352
+ " else:\n",
353
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
354
+ "\n",
355
+ "# Example usage:\n",
356
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
357
+ "download_url = \"https://civitai.com/api/download/models/1865346?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {type: \"string\"}\n",
358
+ "model_name = \"nova_furry_il\" # @param {type: \"string\"}\n",
359
+ "save_path = f\"/content/invokeai/models/sd-1/main/{model_name}.safetensors\"\n",
360
+ "\n",
361
+ "download_civitai_model(bearer_token, download_url, save_path)\n",
362
+ "\n",
363
+ "clear_output();\n",
364
+ "print(\"Done!!\");\n",
365
+ "\n",
366
+ "\n",
367
+ "\n",
368
+ "\n"
369
+ ]
370
+ },
371
+ {
372
+ "cell_type": "code",
373
+ "execution_count": null,
374
+ "metadata": {
375
+ "id": "LnO01U-W6Yjp"
376
+ },
377
+ "outputs": [],
378
+ "source": [
379
+ "#@title 3. Start InvokeAI. { display-mode: \"form\" }\n",
380
+ "#@markdown ## Starting the App\n",
381
+ "#@markdown This step takes about 15 seconds to generate your URL but 30 seconds after it is launched before it will work fully!\n",
382
+ "#@markdown ## Notes about connection types.\n",
383
+ "#@markdown **NGROK** (Recommended) = Very stable but requires a token.<br>\n",
384
+ "#@markdown **NGROK_APT** = An alternate version of NGROK that runs using the system packages.<br>\n",
385
+ "#@markdown **Localtunnel** = Often has \"502\" Errors; retry or try another method.<br>\n",
386
+ "#@markdown **ZROCK** = Uses Zrok tunnel; requires the binary to be downloaded and configured.\n",
387
+ "\n",
388
+ "import os\n",
389
+ "import subprocess\n",
390
+ "import time\n",
391
+ "import tarfile\n",
392
+ "import requests\n",
393
+ "from IPython.display import clear_output\n",
394
+ "\n",
395
+ "# --- Config ---\n",
396
+ "file_path = \"/content/invokeai\"\n",
397
+ "venv_path = os.path.join(file_path, '.venv')\n",
398
+ "invokeai_cmd = f'{venv_path}/bin/invokeai-web'\n",
399
+ "port = 9090\n",
400
+ "zrok_url = \"https://github.com/openziti/zrok/releases/download/v1.0.4/zrok_1.0.4_linux_amd64.tar.gz\"\n",
401
+ "zrok_tar = \"zrok.tar.gz\"\n",
402
+ "zrok_install_path = \"/usr/local/bin/zrok\"\n",
403
+ "\n",
404
+ "# === Clear Output ===\n",
405
+ "%cd {file_path}\n",
406
+ "clear_output()\n",
407
+ "\n",
408
+ "# --- Localtunnel ---\n",
409
+ "if connection_type == \"Localtunnel\":\n",
410
+ " print(\"How to connect to localtunnel:\");\n",
411
+ " print(\"A localtunnel Interface connection is generated here, To use this, please do the following \")\n",
412
+ " print(\"1. Copy this IP address\")\n",
413
+ " !curl ipv4.icanhazip.com\n",
414
+ " print(\"2. Click the random 'https://XXX-YYY-ZZZ.loca.lt' link that is generated below.\")\n",
415
+ " print(\"3. Paste the IP into the provided box and submit. \")\n",
416
+ " print(\" \")\n",
417
+ " print(\"Note: An error of '502 Bad Gateway' typically is an error at Localtunnels end. A '504 Gateway Time-out' Error means invokeai has not started yet.\")\n",
418
+ " print(\" \")\n",
419
+ " !npm install -g localtunnel\n",
420
+ " !lt --port 9090 & ! . {file_path}/.venv/bin/activate; invokeai-web\n",
421
+ "\n",
422
+ "\n",
423
+ "# --- NGROK via Python ---\n",
424
+ "elif connection_type == \"NGROK\":\n",
425
+ " if ngrok_token == \"None\":\n",
426
+ " print(\"You have Selected NGROK but did not supply an NGROK token.\")\n",
427
+ " print(\"Falling back to a 'Localtunnel' connection type.\")\n",
428
+ " print(\"Please either add an NGROK token to step 1, re-run step 1, then re-run this step, or just re-run this step to use 'Servio'.\")\n",
429
+ " connection_type = \"Localtunnel\"\n",
430
+ " if ngrok_token != \"None\":\n",
431
+ " !pip install pyngrok --quiet\n",
432
+ " from pyngrok import ngrok\n",
433
+ " ngrok.kill()\n",
434
+ " ngrok.set_auth_token(ngrok_token)\n",
435
+ " public_url = ngrok.connect(9090).public_url\n",
436
+ " print(f'InvokeAI Public URL: {public_url}')\n",
437
+ " ! . {file_path}/.venv/bin/activate; invokeai-web\n",
438
+ "\n",
439
+ "# --- NGROK via APT ---\n",
440
+ "elif connection_type == \"NGROK_APT\":\n",
441
+ " if ngrok_token == \"None\":\n",
442
+ " print(\"You have Selected NGROK but did not supply an NGROK token.\")\n",
443
+ " print(\"Falling back to a 'Localtunnel' connection type.\")\n",
444
+ " print(\"Please either add an NGROK token to step 1, re-run step 1, then re-run this step, or just re-run this step to use 'Servio'.\")\n",
445
+ " connection_type = \"Localtunnel\"\n",
446
+ " if ngrok_token != \"None\":\n",
447
+ " !curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null\n",
448
+ " !echo \"deb https://ngrok-agent.s3.amazonaws.com buster main\" | sudo tee /etc/apt/sources.list.d/ngrok.list\n",
449
+ " !sudo apt update\n",
450
+ " !sudo apt install ngrok\n",
451
+ " !ngrok config add-authtoken {ngrok_token}\n",
452
+ " clear_output()\n",
453
+ " !echo \"You can find the connection URL here in the NGROK portal:\"\n",
454
+ " !echo \"https://dashboard.ngrok.com/endpoints\"\n",
455
+ " !nohup ngrok http http://localhost:9090 &\n",
456
+ " ! . {file_path}/.venv/bin/activate; invokeai-web\n",
457
+ "\n",
458
+ "# --- ZROCK via zrok ---\n",
459
+ "elif connection_type == \"ZROCK\":\n",
460
+ " print(\"Starting zrok tunnel...\")\n",
461
+ " try:\n",
462
+ " print(f\"Downloading zrok from {zrok_url} ...\")\n",
463
+ " response = requests.get(zrok_url, stream=True)\n",
464
+ " response.raise_for_status()\n",
465
+ " with open(zrok_tar, 'wb') as f:\n",
466
+ " for chunk in response.iter_content(chunk_size=8192):\n",
467
+ " f.write(chunk)\n",
468
+ " with tarfile.open(zrok_tar, \"r:gz\") as tar:\n",
469
+ " tar.extractall()\n",
470
+ " os.rename(\"zrok\", zrok_install_path)\n",
471
+ " os.chmod(zrok_install_path, 0o755)\n",
472
+ " print(f\"zrok installed at {zrok_install_path}\")\n",
473
+ " except Exception as e:\n",
474
+ " print(f\"Failed to install zrok: {e}\")\n",
475
+ " connection_type = \"Localtunnel\"\n",
476
+ "\n",
477
+ " # Start zrok tunnel\n",
478
+ " try:\n",
479
+ " !zrok enable {ngrok_token}\n",
480
+ " print(\"Waiting for zrok to generate share URL...\")\n",
481
+ " proc = subprocess.Popen(\n",
482
+ " [zrok_install_path, \"share\", \"public\", \"--headless\", f\"http://localhost:{port}\"],\n",
483
+ " stdout=subprocess.PIPE,\n",
484
+ " stderr=subprocess.STDOUT,\n",
485
+ " text=True,\n",
486
+ " )\n",
487
+ " share_url = None\n",
488
+ " start_time = time.time()\n",
489
+ " while time.time() - start_time < 20:\n",
490
+ " line = proc.stdout.readline()\n",
491
+ " if not line:\n",
492
+ " continue\n",
493
+ " print(line.strip())\n",
494
+ " if \"https://\" in line:\n",
495
+ " share_url = line.strip()\n",
496
+ " break\n",
497
+ " if share_url:\n",
498
+ " print(f\"InvokeAI Public URL (via zrok): {share_url}\")\n",
499
+ " else:\n",
500
+ " print(\"Could not detect zrok share link.\")\n",
501
+ " except Exception as e:\n",
502
+ " print(f\"Error starting zrok: {e}\")\n",
503
+ " !. {file_path}/.venv/bin/activate; invokeai-web\n",
504
+ "\n",
505
+ "else:\n",
506
+ " print(f\"Unknown connection type '{connection_type}'. Use NGROK, NGROK_APT, Localtunnel, or ZROCK.\")\n"
507
+ ]
508
+ },
509
+ {
510
+ "cell_type": "code",
511
+ "source": [
512
+ "# @title Model Download\n",
513
+ "import os\n",
514
+ "import requests\n",
515
+ "\n",
516
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
517
+ " \"\"\"\n",
518
+ " Downloads a model from Civitai using a bearer token.\n",
519
+ "\n",
520
+ " Args:\n",
521
+ " bearer_token: Your Civitai bearer token.\n",
522
+ " download_url: The URL of the model to download.\n",
523
+ " save_path: The full path to save the downloaded file.\n",
524
+ " \"\"\"\n",
525
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
526
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
527
+ "\n",
528
+ " if response.status_code == 200:\n",
529
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
530
+ " with open(save_path, \"wb\") as f:\n",
531
+ " for chunk in response.iter_content(chunk_size=1024):\n",
532
+ " if chunk:\n",
533
+ " f.write(chunk)\n",
534
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
535
+ " else:\n",
536
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
537
+ "\n",
538
+ "# Example usage:\n",
539
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
540
+ "download_url = \"https://civitai.com/api/download/models/1665796?type=Model&format=SafeTensor&size=full&fp=fp16\" # @param {type: \"string\"}\n",
541
+ "model_name = \"paint_scav\" # @param {type: \"string\"}\n",
542
+ "save_path = f\"/content/invokeai/models/sd-1/main/{model_name}.safetensors\"\n",
543
+ "\n",
544
+ "download_civitai_model(bearer_token, download_url, save_path)"
545
+ ],
546
+ "metadata": {
547
+ "id": "sdZr-vEf84fZ",
548
+ "cellView": "form"
549
+ },
550
+ "execution_count": null,
551
+ "outputs": []
552
+ },
553
+ {
554
+ "cell_type": "code",
555
+ "source": [
556
+ "# @title Vae Download\n",
557
+ "import os\n",
558
+ "import requests\n",
559
+ "\n",
560
+ "def download_civitai_model(bearer_token, download_url, save_path):\n",
561
+ " \"\"\"\n",
562
+ " Downloads a model from Civitai using a bearer token.\n",
563
+ "\n",
564
+ " Args:\n",
565
+ " bearer_token: Your Civitai bearer token.\n",
566
+ " download_url: The URL of the model to download.\n",
567
+ " save_path: The full path to save the downloaded file.\n",
568
+ " \"\"\"\n",
569
+ " headers = {\"Authorization\": f\"Bearer {bearer_token}\"}\n",
570
+ " response = requests.get(download_url, headers=headers, stream=True)\n",
571
+ "\n",
572
+ " if response.status_code == 200:\n",
573
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True) # Create directories if they don't exist\n",
574
+ " with open(save_path, \"wb\") as f:\n",
575
+ " for chunk in response.iter_content(chunk_size=1024):\n",
576
+ " if chunk:\n",
577
+ " f.write(chunk)\n",
578
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
579
+ " else:\n",
580
+ " print(f\"Download failed with status code: {response.status_code}\")\n",
581
+ "\n",
582
+ "# Example usage:\n",
583
+ "bearer_token = \"6748e0f8e6085cd9349551385ce8943a\"\n",
584
+ "download_url = \"https://civitai.com/api/download/models/1166878?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {type: \"string\"}\n",
585
+ "model_name = \"ntr_mix_il\" # @param {type: \"string\"}\n",
586
+ "save_path = f\"/content/invokeai/models/sd-1/main/{model_name}.safetensors\"\n",
587
+ "\n",
588
+ "download_civitai_model(bearer_token, download_url, save_path)"
589
+ ],
590
+ "metadata": {
591
+ "cellView": "form",
592
+ "id": "oqvT2XRtmga1"
593
+ },
594
+ "execution_count": null,
595
+ "outputs": []
596
+ },
597
+ {
598
+ "cell_type": "code",
599
+ "source": [
600
+ "# prompt: fast download file to /content/models/ and file url is https://huggingface.co/mfcg/paintjob_v2/blob/main/MFCG%20Paintjob%20v2.fp16.safetensors\n",
601
+ "\n",
602
+ "import os\n",
603
+ "import requests\n",
604
+ "\n",
605
+ "def download_file(url, save_path):\n",
606
+ " try:\n",
607
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True)\n",
608
+ " response = requests.get(url, stream=True)\n",
609
+ " response.raise_for_status() # Raise an exception for bad status codes\n",
610
+ "\n",
611
+ " with open(save_path, 'wb') as file:\n",
612
+ " for chunk in response.iter_content(chunk_size=8192):\n",
613
+ " file.write(chunk)\n",
614
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
615
+ " except requests.exceptions.RequestException as e:\n",
616
+ " print(f\"Error downloading file: {e}\")\n",
617
+ " except Exception as e:\n",
618
+ " print(f\"An unexpected error occurred: {e}\")\n",
619
+ "\n",
620
+ "# Example usage\n",
621
+ "url = \"https://huggingface.co/mfcg/paintjob_v2/resolve/main/MFCG%20Paintjob%20v2.fp16.safetensors\"\n",
622
+ "save_path = \"/content/invokeai/models/sd-1/main/MFCG%20Paintjob%20v2.fp16.safetensors\"\n",
623
+ "download_file(url, save_path)\n"
624
+ ],
625
+ "metadata": {
626
+ "id": "JaXmHDXbHx7y"
627
+ },
628
+ "execution_count": null,
629
+ "outputs": []
630
+ },
631
+ {
632
+ "cell_type": "code",
633
+ "source": [
634
+ "# prompt: download from multiple urls and save with .safetensors\n",
635
+ "\n",
636
+ "# @title Download multiple URLs and save with .safetensors extension\n",
637
+ "\n",
638
+ "import os\n",
639
+ "import requests\n",
640
+ "\n",
641
+ "def download_file(url, base_dir):\n",
642
+ " \"\"\"\n",
643
+ " Downloads a file from a URL and saves it with a .safetensors extension\n",
644
+ " in a specified base directory.\n",
645
+ "\n",
646
+ " Args:\n",
647
+ " url: The URL of the file to download.\n",
648
+ " base_dir: The base directory to save the downloaded file.\n",
649
+ " \"\"\"\n",
650
+ " try:\n",
651
+ " # Extract filename from URL and ensure .safetensors extension\n",
652
+ " filename = url.split('/')[-1]\n",
653
+ " if not filename.lower().endswith('.safetensors'):\n",
654
+ " filename += '.safetensors'\n",
655
+ "\n",
656
+ " save_path = os.path.join(base_dir, filename)\n",
657
+ "\n",
658
+ " os.makedirs(os.path.dirname(save_path), exist_ok=True)\n",
659
+ " response = requests.get(url, stream=True)\n",
660
+ " response.raise_for_status() # Raise an exception for bad status codes\n",
661
+ "\n",
662
+ " with open(save_path, 'wb') as file:\n",
663
+ " for chunk in response.iter_content(chunk_size=8192):\n",
664
+ " file.write(chunk)\n",
665
+ " print(f\"File downloaded successfully to: {save_path}\")\n",
666
+ " except requests.exceptions.RequestException as e:\n",
667
+ " print(f\"Error downloading file from {url}: {e}\")\n",
668
+ " except Exception as e:\n",
669
+ " print(f\"An unexpected error occurred while downloading {url}: {e}\")\n",
670
+ "\n",
671
+ "# List of URLs to download\n",
672
+ "urls_to_download = [\n",
673
+ " \"https://huggingface.co/mfcg/paintjob_v2/resolve/main/MFCG%20Paintjob%20v2.fp16.safetensors\",\n",
674
+ " \"https://civitai.com/api/download/models/694787?type=Model&format=SafeTensor\",\n",
675
+ " \"https://civitai.com/api/download/models/563607?type=Model&format=SafeTensor\",\n",
676
+ " \"https://civitai.com/api/download/models/382152?type=Model&format=SafeTensor\"\n",
677
+ " # Add more URLs here as needed\n",
678
+ "]\n",
679
+ "\n",
680
+ "# Base directory to save the downloaded files\n",
681
+ "base_save_directory = \"/content/invokeai/models/sd-1/main/\" # Adjust this path as needed\n",
682
+ "\n",
683
+ "# Download each URL\n",
684
+ "for url in urls_to_download:\n",
685
+ " download_file(url, base_save_directory)\n"
686
+ ],
687
+ "metadata": {
688
+ "id": "U7lbgjC3U5Up"
689
+ },
690
+ "execution_count": null,
691
+ "outputs": []
692
+ },
693
+ {
694
+ "cell_type": "markdown",
695
+ "source": [
696
+ "#Model training.<br />\n",
697
+ "hollowstrawberry\" has an amazing Google colab LoRA maker, it is 100X Better than I could do! It can be found here:<br />\n",
698
+ "Dataset Maker - https://colab.research.google.com/github/hollowstrawberry/kohya-colab/blob/main/Dataset_Maker.ipynb <br />\n",
699
+ "LoRA Trainer - https://colab.research.google.com/github/hollowstrawberry/kohya-colab/blob/main/Lora_Trainer.ipynb"
700
+ ],
701
+ "metadata": {
702
+ "id": "hVrwuBg_gp-e"
703
+ }
704
+ },
705
+ {
706
+ "cell_type": "markdown",
707
+ "source": [
708
+ "# FAQ:\n",
709
+ "\n",
710
+ "## Images are taking a LONG time to generate. (~30 mins for a 512x512 image.)\n",
711
+ "You may have used up your computer allowance and are running in CPU mode. While this is running click the \"RAM / Disk\" button in the top right to see if it lists \"GPU RAM\" If not, you are not connected to a GPU instance.\n",
712
+ "or maybe, you have the GPU turned off, check \"Edit > Notebook settings\" to make sure a GPU is selected. (\"T4 GPU\" is the current default)\n",
713
+ "\n",
714
+ "## It is taking a while to even start loading.\n",
715
+ "If you have started a new instance / are changing a model. the model needs to be loaded into Invoke. If you are using \"Google Drive\" It has to download the model to the runtime, this can take a while especially for XL (5-10 mins) or FLUX models (20+ mins)\n",
716
+ "\n",
717
+ "##No link is given to me?\n",
718
+ "You can check the systus of the service at one of these two pages. <br>\n",
719
+ "Locatunnel: https://downforeveryoneorjustme.com/localtunnel.me <br>\n",
720
+ "NGROK: https://status.ngrok.com\n",
721
+ "\n",
722
+ "\n",
723
+ "## I get an error \"You have recently exceeded an allowance, most recently at (Time)\"\n",
724
+ "This is typically when you have exceeded some Google restriction(s). This is most common when you stop / start instances frequently and often does not affect anything. <br>\n",
725
+ "If it is blocking things, you typically have to wait 1 hour for soft allowances to reset. \n",
726
+ "\n",
727
+ "##How much longer can my instance run for today?\n",
728
+ "If you click the \"RAM / DISK\" button in the top right it will tell you something like \"At your current usage level, this runtime may last up to 1 hour 20 minutes\"\n",
729
+ "\n",
730
+ "## My instance disconnects while I'm using it.\n",
731
+ "Technically using Web interface to run programs in a way like this project does, is against Google Collab's Terms of Service. If you don't look at this tab for 15+ mins it may hibernate. Simply flick back to this tab on a semi-regular basis to keep it active!\n",
732
+ "\n",
733
+ "## Are there any known issues?\n",
734
+ "If there are, I will typically update the header at the top of this page above the \"Introduction\".\n",
735
+ "\n",
736
+ "## I want to make my own changes to this file, and save them.\n",
737
+ "Feel free to! \"File > Save a copy in drive\" is the safest way to do this.\n",
738
+ "\n",
739
+ "## Is this maintained frequently?\n",
740
+ "I am a solo dev that maintains it the best that I can, I do use this project frequently so hopefully I will notice any major issues. <br>\n",
741
+ "If you have any issues you can raise them on Github I will deal with them when I can! <br>\n",
742
+ "https://github.com/MikeEmmett/InvokeAI/issues\n",
743
+ "\n",
744
+ "## I am using Google Drive and I want to reset everything.\n",
745
+ "If you log onto https://drive.google.com/drive/my-drive with your Google account you will find a folder called \"InvokeAI\" <br>\n",
746
+ "If you just want to reset it without keeping anything, simply delete the whole folder. <br>\n",
747
+ "If you want to reset it but keep the models / Images in an archive, rename the folder.\n",
748
+ "\n",
749
+ "## I don't understand the options above...\n",
750
+ "Experiment! This will work fully if you just do \"Runtime > Run all\" It will connect to your Google Drive and spin up a \"Localtunnel\" connection and just simply copy the IP address / paste into the link as instructed in the last step! Also feel free to play around, you can't break things permanently!"
751
+ ],
752
+ "metadata": {
753
+ "id": "2dccS8zX9wHK"
754
+ }
755
+ }
756
+ ],
757
+ "metadata": {
758
+ "colab": {
759
+ "private_outputs": true,
760
+ "provenance": [],
761
+ "gpuType": "T4"
762
+ },
763
+ "kernelspec": {
764
+ "display_name": "Python 3",
765
+ "name": "python3"
766
+ },
767
+ "language_info": {
768
+ "name": "python"
769
+ },
770
+ "accelerator": "GPU"
771
+ },
772
+ "nbformat": 4,
773
+ "nbformat_minor": 0
774
+ }
MoonRide303_Foocus.ipynb ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "id": "5djKfVY4wlui"
8
+ },
9
+ "outputs": [],
10
+ "source": [
11
+ "from google.colab import drive\n",
12
+ "drive.mount('/content/drive')"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {
19
+ "id": "VjYy0F2gZIPR"
20
+ },
21
+ "outputs": [],
22
+ "source": [
23
+ "%cd /content\n",
24
+ "!git clone https://github.com/MoonRide303/Fooocus-MRE Fooocus-MRE\n",
25
+ "%cd /content/Fooocus-MRE\n",
26
+ "!wget --content-disposition https://raw.githubusercontent.com/Ysb321/supper/main/Data/user_path_config.txt\n",
27
+ "!cp settings-no-refiner.json settings.json\n",
28
+ "!pip install pygit2==1.12.2"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "markdown",
33
+ "metadata": {
34
+ "id": "Q7ACTQtyGTdv"
35
+ },
36
+ "source": [
37
+ "***IMPORTAR DESDE DRIVE***"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {
43
+ "id": "cXWssFHhGvs3"
44
+ },
45
+ "source": [
46
+ "***IMPORTAR DESDE CIVIT AI***"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": null,
52
+ "metadata": {
53
+ "cellView": "form",
54
+ "id": "EEJpE2bfjHcD"
55
+ },
56
+ "outputs": [],
57
+ "source": [
58
+ "!apt-get install aria2\n",
59
+ "civitai_model_urls = \"https://civitai.com/api/download/models/190908?type=Model&format=SafeTensor&size=full&fp=fp16\" # @param {'type': 'string'}\n",
60
+ "url_list = civitai_model_urls.split(\", \")\n",
61
+ "for url in url_list:\n",
62
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/checkpoints {url}"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {
69
+ "id": "tbbLTqyp1a7D"
70
+ },
71
+ "outputs": [],
72
+ "source": [
73
+ "#Modelos\n",
74
+ "!curl -Lo /content/Fooocus-MRE/models/checkpoints/darksun.safetensors https://civitai.com/api/download/models/171099?type=Model&format=SafeTensor&size=full&fp=fp16\n",
75
+ "#Loras\n",
76
+ "#!curl -Lo /content/Fooocus-MRE/models/loras/tu lora.safetensors link civitai.safetensors"
77
+ ]
78
+ },
79
+ {
80
+ "cell_type": "code",
81
+ "execution_count": null,
82
+ "metadata": {
83
+ "id": "SToIjOAeL2Ff"
84
+ },
85
+ "outputs": [],
86
+ "source": [
87
+ "!apt-get install aria2\n",
88
+ "import zipfile\n",
89
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/LOR.zip'\n",
90
+ "url_list = lora_zip_url.split(\", \")\n",
91
+ "for url in url_list:\n",
92
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}\n",
93
+ "directory = '/content/Fooocus-MRE/models/loras'\n",
94
+ "for filename in os.listdir(directory):\n",
95
+ " if '.' not in filename:\n",
96
+ " old_filepath = os.path.join(directory, filename)\n",
97
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
98
+ " os.rename(old_filepath, new_filepath)\n",
99
+ "current_dir = '/content/Fooocus-MRE/models/loras'\n",
100
+ "for entry in os.scandir(current_dir):\n",
101
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
102
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
103
+ " zip_ref.extractall(current_dir)\n",
104
+ "!rm /content/Fooocus-MRE/models/loras*.zip"
105
+ ]
106
+ },
107
+ {
108
+ "cell_type": "code",
109
+ "source": [
110
+ "# @title Embeddings\n",
111
+ "import os\n",
112
+ "import zipfile\n",
113
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other'\n",
114
+ "url_list = embeddings_zip_url.split(\", \")\n",
115
+ "for url in url_list:\n",
116
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /content/Fooocus-MRE/models/embeddings {url}\n",
117
+ "current_dir = '/content/Fooocus-MRE/models/embeddings'\n",
118
+ "for entry in os.scandir(current_dir):\n",
119
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
120
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
121
+ " zip_ref.extractall(current_dir)\n",
122
+ "!rm /content/Fooocus-MRE/models/embeddings/*.zip"
123
+ ],
124
+ "metadata": {
125
+ "id": "GftPvFz-RLbA"
126
+ },
127
+ "execution_count": null,
128
+ "outputs": []
129
+ },
130
+ {
131
+ "cell_type": "code",
132
+ "execution_count": null,
133
+ "metadata": {
134
+ "cellView": "form",
135
+ "id": "sWSjM7rYLf8f"
136
+ },
137
+ "outputs": [],
138
+ "source": [
139
+ "lora_url = 'https://civitai.com/api/download/models/173623?type=Model&format=SafeTensor, https://civitai.com/api/download/models/135867?type=Model&format=SafeTensor, https://civitai.com/api/download/models/157000?type=Model&format=SafeTensor, https://civitai.com/api/download/models/160240?type=Model&format=SafeTensor, https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor, https://civitai.com/api/download/models/179486?type=Model&format=SafeTensor, https://civitai.com/api/download/models/155308?type=Model&format=SafeTensor' # @param {'type': 'string'}\n",
140
+ "url_list = lora_url.split(\", \")\n",
141
+ "for url in url_list:\n",
142
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras {url}"
143
+ ]
144
+ },
145
+ {
146
+ "cell_type": "code",
147
+ "execution_count": null,
148
+ "metadata": {
149
+ "id": "SeTjGIQZXHeo"
150
+ },
151
+ "outputs": [],
152
+ "source": [
153
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/vae https://civitai.com/api/download/models/121323?type=Model&format=SafeTensor"
154
+ ]
155
+ },
156
+ {
157
+ "cell_type": "code",
158
+ "source": [
159
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/153632?type=Model&format=SafeTensor"
160
+ ],
161
+ "metadata": {
162
+ "id": "q3E9paSPC4Jl"
163
+ },
164
+ "execution_count": null,
165
+ "outputs": []
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "source": [
170
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/Fooocus-MRE/models/loras https://civitai.com/api/download/models/184034?type=Model&format=SafeTensor"
171
+ ],
172
+ "metadata": {
173
+ "id": "hF7nFoJID3GF"
174
+ },
175
+ "execution_count": null,
176
+ "outputs": []
177
+ },
178
+ {
179
+ "cell_type": "code",
180
+ "execution_count": null,
181
+ "metadata": {
182
+ "id": "3WpiK93GLH7e"
183
+ },
184
+ "outputs": [],
185
+ "source": [
186
+ "%cd /content/Fooocus-MRE\n",
187
+ "!pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118\n",
188
+ "!python entry_with_update.py --share"
189
+ ]
190
+ },
191
+ {
192
+ "cell_type": "code",
193
+ "execution_count": null,
194
+ "metadata": {
195
+ "id": "zL2kjwFktvr1"
196
+ },
197
+ "outputs": [],
198
+ "source": [
199
+ "!pip install -U insightface\n",
200
+ "!wget --content-disposition -P"
201
+ ]
202
+ }
203
+ ],
204
+ "metadata": {
205
+ "accelerator": "GPU",
206
+ "colab": {
207
+ "provenance": []
208
+ },
209
+ "kernelspec": {
210
+ "display_name": "Python 3",
211
+ "name": "python3"
212
+ },
213
+ "language_info": {
214
+ "name": "python"
215
+ }
216
+ },
217
+ "nbformat": 4,
218
+ "nbformat_minor": 0
219
+ }
Notebooks-master.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c2e89bcc570ef05432e48fba3ba1b99c7f29089f363d7c83622613a92baf277
3
+ size 91555
README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Notebooks
2
+
3
+ Go here you can use this notebooks 👇
4
+
5
+ https://colab.research.google.com
6
+
7
+ for Sagemaker file go here 👇
8
+
9
+ https://studiolab.sagemaker.aws/
10
+
11
+
SDXLBase_Notebook_1.9_zrok_pinggy.ipynb ADDED
@@ -0,0 +1,1098 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "23bf0d68-cd40-4803-bf04-7ede3e53b524",
6
+ "metadata": {},
7
+ "source": [
8
+ "<center><span style=\"font-size: 24px;font-weight: bold\">SDXL Models - Dreamscape Notebook 1.9</span></center>\n",
9
+ "<center>Follow tutorial on my <a href=\"www.youtube.com/@dreamscapeyoutube\">Youtube Channel</a>. Join our <a href=\"https://discord.gg/VCqcfZH2jV\">Discord Community</a> for support.</center>"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "markdown",
14
+ "id": "e4dd09f1-eb19-4fd1-ae06-fc8c604366fb",
15
+ "metadata": {
16
+ "tags": []
17
+ },
18
+ "source": [
19
+ "<h4><b>🧼 Step 1. Fresh Clean Environments </b>(launch if it's your first start)</h4>\n",
20
+ "If you have a healthy and working install, SKIP to STEP 3. This can be launched in CPU mode."
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": null,
26
+ "id": "ea5bcd71-2b71-4d27-90c1-053444ef33f0",
27
+ "metadata": {
28
+ "tags": []
29
+ },
30
+ "outputs": [],
31
+ "source": [
32
+ "!rm -r /home/studio-lab-user/.cache\n",
33
+ "!rm -r /home/studio-lab-user/.conda\n",
34
+ "!conda remove -n \"env_name\" --all\n",
35
+ "!rm -rf /home/studio-lab-user/*"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "markdown",
40
+ "id": "f05fa0e9-8141-471e-a9a5-b12cc04a9c94",
41
+ "metadata": {},
42
+ "source": [
43
+ "☢️*Your Browser Panel (on the left) should be empty.*<br>\n",
44
+ "☢️You need to restart the Jupyter Lab now (before running next cell)."
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "id": "c55242c5-3887-4dd4-a384-0b480b0d11f1",
51
+ "metadata": {
52
+ "tags": []
53
+ },
54
+ "outputs": [],
55
+ "source": [
56
+ "import subprocess\n",
57
+ "\n",
58
+ "# Run the command and capture the output\n",
59
+ "result = subprocess.run(['du', '-h', '--max-depth=1', '/home/studio-lab-user'], capture_output=True, text=True)\n",
60
+ "\n",
61
+ "# Check if the desired line is present in the output\n",
62
+ "if '1.1G\\t/home/studio-lab-user/.conda' in result.stdout:\n",
63
+ " print(\"Ok, your conda is clean (1.1GB) please continue with Step 2\")"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "markdown",
68
+ "id": "af2f3f5b-f9ba-4221-92fa-126600e39d9b",
69
+ "metadata": {
70
+ "tags": []
71
+ },
72
+ "source": [
73
+ "<h4><b>🔥 Step 2. Install essentials </b>(launch if it's your first start)</h4>\n",
74
+ "This will install essentials. This can be launched in CPU mode. Be patient it might take a while."
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "id": "7ad40e45-9797-4188-be16-2e6c4d218ddc",
81
+ "metadata": {
82
+ "scrolled": true,
83
+ "tags": []
84
+ },
85
+ "outputs": [],
86
+ "source": [
87
+ "#Install all essentials for stable diffusion\n",
88
+ "!conda install -c conda-forge libglib -y & conda update -n base conda -y\n",
89
+ "%conda install -q -y aria2\n",
90
+ "%conda install -q -y libglib2.0-0\n",
91
+ "%conda install -q -y glib\n",
92
+ "%cd /home/studio-lab-user/\n",
93
+ "!git clone --depth 1 https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
94
+ "%cd /home/studio-lab-user/stable-diffusion-webui/embeddings\n",
95
+ "!git clone --depth 1 https://github.com/dreamscapeai/negativekit\n",
96
+ "%cd /home/studio-lab-user/stable-diffusion-webui/extensions\n",
97
+ "!git clone --depth 1 https://github.com/ahgsql/StyleSelectorXL\n",
98
+ "!git clone --depth 1 https://github.com/etherealxx/batchlinks-webui\n",
99
+ "!git clone --depth 1 https://github.com/zanllp/sd-webui-infinite-image-browsing\n",
100
+ "!git clone --depth 1 https://github.com/dreamscapeai/ultimatesdupscale\n",
101
+ "!git clone --depth 1 https://github.com/dreamscapeai/tagcomplete\n",
102
+ "!git clone --depth 1 https://github.com/IDEA-Research/DWPose\n",
103
+ "!git clone --depth 1 https://github.com/dreamscapeai/CN-v11400\n",
104
+ "!git clone --depth 1 https://github.com/dreamscapeai/adetailer\n",
105
+ "!git clone --depth 1 https://github.com/dreamscapeai/ultimatesdupscale\n",
106
+ "!git clone --depth 1 https://github.com/Ysb321/roooop\n",
107
+ "!git clone --depth 1 https://github.com/Ysb321/sd-artists-ui-tweak\n",
108
+ "!git clone --depth 1 https://github.com/Ysb321/sd-model-downloader"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "id": "3811c75f-0d9f-4b42-84e4-1d304530caf6",
115
+ "metadata": {
116
+ "tags": []
117
+ },
118
+ "outputs": [],
119
+ "source": [
120
+ "%cd /home/studio-lab-user/stable-diffusion-webui/extensions\n",
121
+ "!git clone --depth 1 https://github.com/Gourieff/sd-webui-reactor"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "markdown",
126
+ "id": "2f8db6a2-a6f2-49aa-8037-c591a378c4af",
127
+ "metadata": {
128
+ "tags": []
129
+ },
130
+ "source": [
131
+ "<h4><b>💾 Step 3. Downloads Models and Checkpoints </b></h4>\n",
132
+ "The model are downloaded in tmp folder, which will be emptied at every new runtime. This MUST be launched in GPU MODE."
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": null,
138
+ "id": "7264a7c8-4386-4996-8da7-babb387770d6",
139
+ "metadata": {
140
+ "tags": []
141
+ },
142
+ "outputs": [],
143
+ "source": [
144
+ "!rm -rf /home/studio-lab-user/tmp\n",
145
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
146
+ "!ln -vs /tmp ~/tmp\n",
147
+ "!ln -vs /tmp/models /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
148
+ "!mkdir -p /tmp/models\n",
149
+ "%cd ~/stable-diffusion-webui/models/Stable-diffusion/\n",
150
+ "!aria2c https://civitai.com/api/download/models/130121?type=Model&format=SafeTensor&size=pruned&fp=fp16\n",
151
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/127416?type=Model&format=SafeTensor&size=pruned&fp=fp16\n",
152
+ "%cd ~/stable-diffusion-webui/models/VAE\n",
153
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/Ysb321/supper/releases/download/vae/vae-ft-mse-840000-ema-pruned.vae.pt"
154
+ ]
155
+ },
156
+ {
157
+ "cell_type": "code",
158
+ "execution_count": null,
159
+ "id": "f737271e-bc08-4eb8-9cd3-beff93103067",
160
+ "metadata": {
161
+ "tags": []
162
+ },
163
+ "outputs": [],
164
+ "source": [
165
+ "# For Lora url\n",
166
+ "\n",
167
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Lora\n",
168
+ "import requests\n",
169
+ "\n",
170
+ "# Define a list of URLs to download\n",
171
+ "urls = [\n",
172
+ " 'https://civitai.com/api/download/models/61160?type=Model&format=SafeTensor',\n",
173
+ " 'https://civitai.com/api/download/models/146600?type=Model&format=SafeTensor',\n",
174
+ " 'https://civitai.com/api/download/models/182772?type=Model&format=SafeTensor',\n",
175
+ " 'https://civitai.com/api/download/models/186168?type=Model&format=SafeTensor',\n",
176
+ " 'https://civitai.com/api/download/models/182038?type=Model&format=SafeTensor',\n",
177
+ " 'https://civitai.com/api/download/models/32066?type=Model&format=SafeTensor&size=full&fp=fp16',\n",
178
+ " 'https://civitai.com/api/download/models/55644?type=Model&format=SafeTensor',\n",
179
+ " 'https://civitai.com/api/download/models/149622?type=Model&format=SafeTensor',\n",
180
+ " 'https://example.com/file3.pdf'\n",
181
+ "]\n",
182
+ "\n",
183
+ "# Loop through the URLs and download each file\n",
184
+ "for url in urls:\n",
185
+ " response = requests.get(url)\n",
186
+ " if 'content-disposition' in response.headers:\n",
187
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
188
+ " with open(filename, 'wb') as f:\n",
189
+ " f.write(response.content)\n",
190
+ " else:\n",
191
+ " print(f'Error: Content-Disposition header not found for {url}')"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "code",
196
+ "execution_count": null,
197
+ "id": "6701a25f-3fbd-46b5-b880-65a1789c4761",
198
+ "metadata": {
199
+ "tags": []
200
+ },
201
+ "outputs": [],
202
+ "source": [
203
+ "# For Lora url\n",
204
+ "\n",
205
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Lora\n",
206
+ "import requests\n",
207
+ "\n",
208
+ "# Define a list of URLs to download\n",
209
+ "urls = [\n",
210
+ " 'https://civitai.com/api/download/models/53452?type=Model&format=SafeTensor',\n",
211
+ " 'https://civitai.com/api/download/models/45030?type=Model&format=SafeTensor',\n",
212
+ " 'https://civitai.com/api/download/models/47342?type=Model&format=SafeTensor',\n",
213
+ " 'https://civitai.com/api/download/models/45019?type=Model&format=SafeTensor',\n",
214
+ " 'https://civitai.com/api/download/models/48351?type=Model&format=SafeTensor',\n",
215
+ " 'https://civitai.com/api/download/models/50931?type=Model&format=SafeTensor',\n",
216
+ " 'https://civitai.com/api/download/models/96186?type=Model&format=SafeTensor',\n",
217
+ " 'https://civitai.com/api/download/models/67464?type=Model&format=SafeTensor'\n",
218
+ "]\n",
219
+ "\n",
220
+ "# Loop through the URLs and download each file\n",
221
+ "for url in urls:\n",
222
+ " response = requests.get(url)\n",
223
+ " if 'content-disposition' in response.headers:\n",
224
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
225
+ " with open(filename, 'wb') as f:\n",
226
+ " f.write(response.content)\n",
227
+ " else:\n",
228
+ " print(f'Error: Content-Disposition header not found for {url}')"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "code",
233
+ "execution_count": null,
234
+ "id": "1e0609ad-d797-4222-8390-65902e00dbe7",
235
+ "metadata": {
236
+ "tags": []
237
+ },
238
+ "outputs": [],
239
+ "source": [
240
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/\n",
241
+ "!mkdir -p Stable-diffusion\n",
242
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion\n",
243
+ "import requests\n",
244
+ "\n",
245
+ "# Define a list of URLs to download\n",
246
+ "urls = [\n",
247
+ " 'https://civitai.com/api/download/models/178879?type=Model&format=SafeTensor&size=pruned&fp=fp16'\n",
248
+ "]\n",
249
+ "\n",
250
+ "# Loop through the URLs and download each file\n",
251
+ "for url in urls:\n",
252
+ " response = requests.get(url)\n",
253
+ " if 'content-disposition' in response.headers:\n",
254
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
255
+ " with open(filename, 'wb') as f:\n",
256
+ " f.write(response.content)\n",
257
+ " else:\n",
258
+ " print(f'Error: Content-Disposition header not found for {url}')"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": null,
264
+ "id": "d04c62cc-fda7-427c-80cd-5c158b9b22b8",
265
+ "metadata": {
266
+ "tags": []
267
+ },
268
+ "outputs": [],
269
+ "source": [
270
+ "%cd ~/stable-diffusion-webui/models/Stable-diffusion/\n",
271
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/178879?type=Model&format=SafeTensor&size=pruned&fp=fp16"
272
+ ]
273
+ },
274
+ {
275
+ "cell_type": "markdown",
276
+ "id": "6a87cf1c-7b77-4618-9576-c7e4181dde49",
277
+ "metadata": {
278
+ "tags": []
279
+ },
280
+ "source": [
281
+ "<h4><b>🌟 Step 4. BOOT LAUNCHER WEBUI (MUST BE in GPU Mode)</b></h4> \n",
282
+ "Don't forget to paste your NGROK token below. Create one token here https://dashboard.ngrok.com/get-started/your-authtoken"
283
+ ]
284
+ },
285
+ {
286
+ "cell_type": "code",
287
+ "execution_count": null,
288
+ "id": "42129da6-cb4d-48c6-af2f-1e803a511634",
289
+ "metadata": {},
290
+ "outputs": [],
291
+ "source": []
292
+ },
293
+ {
294
+ "cell_type": "code",
295
+ "execution_count": null,
296
+ "id": "2b6ce256-5678-4521-b473-4d5f2c121da5",
297
+ "metadata": {
298
+ "tags": []
299
+ },
300
+ "outputs": [],
301
+ "source": [
302
+ "%cd /tmp\n",
303
+ "!wget https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz\n",
304
+ "!mkdir /tmp/zrok\n",
305
+ "!tar -xf ./zrok*linux*.tar.gz -C /tmp/zrok\n",
306
+ "!mkdir -p /tmp/zrok/bin && install /tmp/zrok/zrok /tmp/zrok/bin\n",
307
+ "import os\n",
308
+ "os.environ['PATH'] = \"/tmp/zrok/bin:\" + os.environ['PATH']\n",
309
+ "!zrok version"
310
+ ]
311
+ },
312
+ {
313
+ "cell_type": "code",
314
+ "execution_count": null,
315
+ "id": "a8c824f7-4868-43b8-9980-a7dad6110bb2",
316
+ "metadata": {},
317
+ "outputs": [],
318
+ "source": [
319
+ "#Only launch this command in the terminal\n",
320
+ "export PATH=$PATH:/tmp/zrok/bin\n",
321
+ "zrok invite"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "code",
326
+ "execution_count": null,
327
+ "id": "1e99ecb3-ed61-4503-a1a0-5d9f1688cb66",
328
+ "metadata": {
329
+ "tags": []
330
+ },
331
+ "outputs": [],
332
+ "source": [
333
+ "!zrok enable 4wJsCtYsgeDT"
334
+ ]
335
+ },
336
+ {
337
+ "cell_type": "markdown",
338
+ "id": "97b1e0b7-ff3e-4d35-8a83-05a09c682048",
339
+ "metadata": {},
340
+ "source": [
341
+ "RUN BOTTOM Cell"
342
+ ]
343
+ },
344
+ {
345
+ "cell_type": "code",
346
+ "execution_count": null,
347
+ "id": "a21a9399-21a2-4529-be7a-f0440a867ce6",
348
+ "metadata": {
349
+ "tags": []
350
+ },
351
+ "outputs": [],
352
+ "source": [
353
+ "%cd ~/stable-diffusion-webui\n",
354
+ "from multiprocessing import Process\n",
355
+ "import time\n",
356
+ "\n",
357
+ "def run_command1():\n",
358
+ "# time.sleep(15)\n",
359
+ " !zrok share public http://localhost:7860 --headless\n",
360
+ "\n",
361
+ "def run_command2():\n",
362
+ " time.sleep(2)\n",
363
+ " !python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue\n",
364
+ "\n",
365
+ "if __name__ == '__main__':\n",
366
+ " p1 = Process(target=run_command1)\n",
367
+ " p2 = Process(target=run_command2)\n",
368
+ " p1.start()\n",
369
+ " p2.start()\n",
370
+ " p1.join()\n",
371
+ " p2.join()"
372
+ ]
373
+ },
374
+ {
375
+ "cell_type": "code",
376
+ "execution_count": null,
377
+ "id": "e257f61c-7aa2-44b6-8641-efb4285ac844",
378
+ "metadata": {
379
+ "tags": []
380
+ },
381
+ "outputs": [],
382
+ "source": [
383
+ "%cd ~/stable-diffusion-webui\n",
384
+ "from multiprocessing import Process\n",
385
+ "import time\n",
386
+ "\n",
387
+ "def run_command1():\n",
388
+ "# time.sleep(15)\n",
389
+ " !zrok share public http://localhost:7860 --headless\n",
390
+ "\n",
391
+ "def run_command2():\n",
392
+ " time.sleep(2)\n",
393
+ " !python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --skip-torch-cuda-test --no-half-vae\n",
394
+ "\n",
395
+ "if __name__ == '__main__':\n",
396
+ " p1 = Process(target=run_command1)\n",
397
+ " p2 = Process(target=run_command2)\n",
398
+ " p1.start()\n",
399
+ " p2.start()\n",
400
+ " p1.join()\n",
401
+ " p2.join()"
402
+ ]
403
+ },
404
+ {
405
+ "cell_type": "code",
406
+ "execution_count": null,
407
+ "id": "2c030899-906d-41a9-a776-51f63dce52e8",
408
+ "metadata": {},
409
+ "outputs": [],
410
+ "source": [
411
+ "START WITH PINGGY"
412
+ ]
413
+ },
414
+ {
415
+ "cell_type": "code",
416
+ "execution_count": null,
417
+ "id": "1fb655fa-b985-4089-b8ba-9b27ab64ae48",
418
+ "metadata": {
419
+ "tags": []
420
+ },
421
+ "outputs": [],
422
+ "source": [
423
+ "# Install SSH (only needs to run once)\n",
424
+ "!conda config --add channels conda-forge\n",
425
+ "!conda config --set channel_priority strict\n",
426
+ "!conda install -y openssh"
427
+ ]
428
+ },
429
+ {
430
+ "cell_type": "code",
431
+ "execution_count": null,
432
+ "id": "9d284a47-525e-49a1-a118-c4e163de776d",
433
+ "metadata": {},
434
+ "outputs": [],
435
+ "source": [
436
+ "# Start the WebUI with Pinggy\n",
437
+ "%cd ~/stable-diffusion-webui\n",
438
+ "command = 'python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue'\n",
439
+ "port = '7860'\n",
440
+ "# ------------------------\n",
441
+ "\n",
442
+ "from multiprocessing import Process\n",
443
+ "import sys\n",
444
+ "import time\n",
445
+ "\n",
446
+ "!touch log.txt\n",
447
+ "open('log.txt', 'w').close()\n",
448
+ "\n",
449
+ "def run_app():\n",
450
+ " get_ipython().system(f'{command} & ssh -o StrictHostKeyChecking=no -p 80 -R0:localhost:{port} a.pinggy.io > log.txt')\n",
451
+ " \n",
452
+ "def print_url():\n",
453
+ " print(\"waiting for output\")\n",
454
+ " time.sleep(2)\n",
455
+ " sys.stdout.flush()\n",
456
+ " \n",
457
+ " found = False\n",
458
+ " with open('log.txt', 'r') as file:\n",
459
+ " end_word = '.pinggy.link'\n",
460
+ " for line in file:\n",
461
+ " #print(line)\n",
462
+ " start_index = line.find('http:')\n",
463
+ " if start_index != -1:\n",
464
+ " end_index = line.find(end_word, start_index)\n",
465
+ " if end_index != -1:\n",
466
+ " print('😁 😁 😁')\n",
467
+ " print('URL: ' + line[start_index:end_index + len(end_word)])\n",
468
+ " print('😁 😁 😁')\n",
469
+ " found = True\n",
470
+ " if not found:\n",
471
+ " print_url()\n",
472
+ " else:\n",
473
+ " with open('log.txt', 'r') as file:\n",
474
+ " for line in file:\n",
475
+ " print(line)\n",
476
+ " \n",
477
+ "p_app = Process(target=run_app)\n",
478
+ "p_url = Process(target=print_url)\n",
479
+ "p_app.start()\n",
480
+ "p_url.start()\n",
481
+ "p_app.join()\n",
482
+ "p_url.join()"
483
+ ]
484
+ },
485
+ {
486
+ "cell_type": "code",
487
+ "execution_count": null,
488
+ "id": "faf88173-bc95-4dce-8967-983b77e82fb8",
489
+ "metadata": {
490
+ "tags": []
491
+ },
492
+ "outputs": [],
493
+ "source": [
494
+ "# Start the WebUI with Pinggy\n",
495
+ "%cd ~/stable-diffusion-webui\n",
496
+ "command = 'python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --skip-torch-cuda-test --no-half-vae'\n",
497
+ "port = '7860'\n",
498
+ "# ------------------------\n",
499
+ "\n",
500
+ "from multiprocessing import Process\n",
501
+ "import sys\n",
502
+ "import time\n",
503
+ "\n",
504
+ "!touch log.txt\n",
505
+ "open('log.txt', 'w').close()\n",
506
+ "\n",
507
+ "def run_app():\n",
508
+ " get_ipython().system(f'{command} & ssh -o StrictHostKeyChecking=no -p 80 -R0:localhost:{port} a.pinggy.io > log.txt')\n",
509
+ " \n",
510
+ "def print_url():\n",
511
+ " print(\"waiting for output\")\n",
512
+ " time.sleep(2)\n",
513
+ " sys.stdout.flush()\n",
514
+ " \n",
515
+ " found = False\n",
516
+ " with open('log.txt', 'r') as file:\n",
517
+ " end_word = '.pinggy.link'\n",
518
+ " for line in file:\n",
519
+ " #print(line)\n",
520
+ " start_index = line.find('http:')\n",
521
+ " if start_index != -1:\n",
522
+ " end_index = line.find(end_word, start_index)\n",
523
+ " if end_index != -1:\n",
524
+ " print('😁 😁 😁')\n",
525
+ " print('URL: ' + line[start_index:end_index + len(end_word)])\n",
526
+ " print('😁 😁 😁')\n",
527
+ " found = True\n",
528
+ " if not found:\n",
529
+ " print_url()\n",
530
+ " else:\n",
531
+ " with open('log.txt', 'r') as file:\n",
532
+ " for line in file:\n",
533
+ " print(line)\n",
534
+ " \n",
535
+ "p_app = Process(target=run_app)\n",
536
+ "p_url = Process(target=print_url)\n",
537
+ "p_app.start()\n",
538
+ "p_url.start()\n",
539
+ "p_app.join()\n",
540
+ "p_url.join()"
541
+ ]
542
+ },
543
+ {
544
+ "cell_type": "code",
545
+ "execution_count": null,
546
+ "id": "4bd8baa5-4150-46f4-8c80-5f841d14f160",
547
+ "metadata": {},
548
+ "outputs": [],
549
+ "source": [
550
+ "NOT TO RUN BOTTOM CELL"
551
+ ]
552
+ },
553
+ {
554
+ "cell_type": "code",
555
+ "execution_count": null,
556
+ "id": "9ea3ea45-056c-4863-a06a-3f7422bf7e20",
557
+ "metadata": {
558
+ "scrolled": true,
559
+ "tags": []
560
+ },
561
+ "outputs": [],
562
+ "source": [
563
+ "#Don't forget to paste your NGROK token here\n",
564
+ "argu = '--skip-torch-cuda-test --enable-insecure-extension-access --disable-console-progressbars --xformers --enable-insecure-extension-access --theme dark --lowram' \n",
565
+ "%cd ~/stable-diffusion-webui\n",
566
+ "\n",
567
+ "#!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/config.json\n",
568
+ "#!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/styles.csv\n",
569
+ "#!conda install -y -c conda-forge nodejs\n",
570
+ "#!npm install -g localtunnel\n",
571
+ "\n",
572
+ "\n",
573
+ "!git pull\n",
574
+ "#!conda install -y -c conda-forge openssh\n",
575
+ "!python3 -m pip install gradio\n",
576
+ "!wget -q -O - https://loca.lt/mytunnelpassword\n",
577
+ "!lt --port 7860 --subdomain example-subdomain --local_https False & python launch.py {argu} --share\n",
578
+ "#!python launch.py --skip-torch-cuda-test --remotemoe --enable-insecure-extension-access --disable-console-progressbars --xformers --enable-insecure-extension-access --theme dark --lowram"
579
+ ]
580
+ },
581
+ {
582
+ "cell_type": "code",
583
+ "execution_count": null,
584
+ "id": "08cc20d4-3cb7-45b9-8ca7-506abe0cf79c",
585
+ "metadata": {
586
+ "tags": []
587
+ },
588
+ "outputs": [],
589
+ "source": [
590
+ "#Check your available storage\n",
591
+ "!df -h | grep -E 'Avail|home'"
592
+ ]
593
+ },
594
+ {
595
+ "cell_type": "code",
596
+ "execution_count": null,
597
+ "id": "d2eeb1a8-4cfb-478c-81da-a7825e8caf3f",
598
+ "metadata": {
599
+ "tags": []
600
+ },
601
+ "outputs": [],
602
+ "source": [
603
+ "\n",
604
+ "%cd ~/stable-diffusion-webui/extentions\n",
605
+ "!git clone https://github.com/camenduru/tunnels\n"
606
+ ]
607
+ },
608
+ {
609
+ "cell_type": "code",
610
+ "execution_count": null,
611
+ "id": "1efae36f-e7b6-44ab-aef8-6a70eea650d8",
612
+ "metadata": {
613
+ "tags": []
614
+ },
615
+ "outputs": [],
616
+ "source": [
617
+ "from http.server import HTTPServer, BaseHTTPRequestHandler\n",
618
+ "\n",
619
+ "class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):\n",
620
+ " def do_GET(self):\n",
621
+ " self.send_response(200)\n",
622
+ " self.send_header('Content-type', 'text/html')\n",
623
+ " self.end_headers()\n",
624
+ " self.wfile.write(b\"Hello, welcome to your local server!\")\n",
625
+ "\n",
626
+ "def run(server_class=HTTPServer, handler_class=SimpleHTTPRequestHandler, port=7860):\n",
627
+ " server_address = ('', port)\n",
628
+ " httpd = server_class(server_address, handler_class)\n",
629
+ " print(f\"Server running on http://127.0.0.1:{port}\")\n",
630
+ " httpd.serve_forever()\n",
631
+ "\n",
632
+ "run()\n"
633
+ ]
634
+ },
635
+ {
636
+ "cell_type": "markdown",
637
+ "id": "c9058578-7096-44ce-8ea2-0153cf151c44",
638
+ "metadata": {
639
+ "tags": []
640
+ },
641
+ "source": [
642
+ "<h4><b>🖼️ Step 5. Download all your outputs </b></h4> \n",
643
+ "If your setup folder doesn't have problem, skip this step."
644
+ ]
645
+ },
646
+ {
647
+ "cell_type": "code",
648
+ "execution_count": null,
649
+ "id": "a0245311-d83a-469a-bb00-2c7c37def333",
650
+ "metadata": {
651
+ "tags": []
652
+ },
653
+ "outputs": [],
654
+ "source": [
655
+ "#download and compress all outputs\n",
656
+ "import zipfile\n",
657
+ "import os\n",
658
+ "\n",
659
+ "def create_zip_archive(source_dir, output_path):\n",
660
+ " with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:\n",
661
+ " for root, dirs, files in os.walk(source_dir):\n",
662
+ " for file in files:\n",
663
+ " file_path = os.path.join(root, file)\n",
664
+ " zipf.write(file_path, os.path.relpath(file_path, source_dir))\n",
665
+ "\n",
666
+ "# Specify the source directory and output path\n",
667
+ "source_dir = '/home/studio-lab-user/drive/MyDrive/SD-IMG-OUT'\n",
668
+ "output_path = '/home/studio-lab-user/outputs.zip'\n",
669
+ "\n",
670
+ "# Create the ZIP archive\n",
671
+ "create_zip_archive(source_dir, output_path)"
672
+ ]
673
+ },
674
+ {
675
+ "cell_type": "code",
676
+ "execution_count": null,
677
+ "id": "fdeece9b-7e0a-4c93-aec2-6d96b95cdc84",
678
+ "metadata": {
679
+ "tags": []
680
+ },
681
+ "outputs": [],
682
+ "source": [
683
+ "#download and compress all outputs\n",
684
+ "import os\n",
685
+ "import zipfile\n",
686
+ "def zip_folder(input_folder, output_folder, max_size_mb=20):\n",
687
+ " # Create the output folder if it doesn't exist\n",
688
+ " os.makedirs(output_folder, exist_ok=True)\n",
689
+ " zip_number = 1\n",
690
+ " current_zip_size = 0\n",
691
+ " current_zip_name = os.path.join(output_folder, f\"part_{zip_number}.zip\") \n",
692
+ " with zipfile.ZipFile(current_zip_name, 'w', zipfile.ZIP_DEFLATED) as current_zip:\n",
693
+ " for root, _, files in os.walk(input_folder):\n",
694
+ " for file in files:\n",
695
+ " file_path = os.path.join(root, file)\n",
696
+ " file_size = os.path.getsize(file_path) \n",
697
+ " # Check if adding the current file exceeds the max size\n",
698
+ " if current_zip_size + file_size > max_size_mb * 1024 * 1024:\n",
699
+ " # Close the current zip file\n",
700
+ " current_zip.close() \n",
701
+ " # Start a new zip file\n",
702
+ " zip_number += 1\n",
703
+ " current_zip_name = os.path.join(output_folder, f\"part_{zip_number}.zip\")\n",
704
+ " current_zip = zipfile.ZipFile(current_zip_name, 'w', zipfile.ZIP_DEFLATED)\n",
705
+ " current_zip_size = 0 \n",
706
+ " # Add the file to the current zip\n",
707
+ " current_zip.write(file_path, os.path.relpath(file_path, input_folder))\n",
708
+ " current_zip_size += file_size\n",
709
+ "# Specify the input folder to be zipped\n",
710
+ "input_folder = 'drive/MyDrive/SD-IMG-OUT/extras' # Replace with the path to your input folder\n",
711
+ "# Specify the output folder where zip files will be saved\n",
712
+ "output_folder = 'drive/MyDrive' # Replace with the path to your output folder\n",
713
+ "# Specify the maximum size for each zip file in MB\n",
714
+ "max_size_mb = 200\n",
715
+ "# Create zip files with a maximum size of 20MB\n",
716
+ "zip_folder(input_folder, output_folder, max_size_mb)"
717
+ ]
718
+ },
719
+ {
720
+ "cell_type": "code",
721
+ "execution_count": null,
722
+ "id": "b8a56c3a-f0af-4c87-bf83-c99942a3a3b0",
723
+ "metadata": {},
724
+ "outputs": [],
725
+ "source": [
726
+ "#delete and empty the OUTPUT folder\n",
727
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/outputs/*"
728
+ ]
729
+ },
730
+ {
731
+ "cell_type": "markdown",
732
+ "id": "1d0a3313-0c65-44ef-b89e-459fa779e84b",
733
+ "metadata": {
734
+ "tags": []
735
+ },
736
+ "source": [
737
+ "<h4><b> Backup Tools </b></h4>\n",
738
+ "If your setup folder doesn't have problem, skip this step."
739
+ ]
740
+ },
741
+ {
742
+ "cell_type": "code",
743
+ "execution_count": null,
744
+ "id": "213d1125-9602-46bb-90d8-3d5cd1ca684a",
745
+ "metadata": {},
746
+ "outputs": [],
747
+ "source": [
748
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/animatrix.safetensors\" \"https://civitai.com/api/download/models/44827?type=Model&format=PickleTensor&size=pruned&fp=fp16\""
749
+ ]
750
+ },
751
+ {
752
+ "cell_type": "code",
753
+ "execution_count": null,
754
+ "id": "eaca1b93-a213-4778-84fa-43605b6f75dd",
755
+ "metadata": {
756
+ "tags": []
757
+ },
758
+ "outputs": [],
759
+ "source": [
760
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/VAE/sdxl_vae.safetensors\" \"https://huggingface.co/ckpt/sdxl_vae/resolve/main/sdxl_vae.safetensors\""
761
+ ]
762
+ },
763
+ {
764
+ "cell_type": "code",
765
+ "execution_count": null,
766
+ "id": "f4fd3fe0-7f79-4359-9e5d-8305c31ae68b",
767
+ "metadata": {},
768
+ "outputs": [],
769
+ "source": [
770
+ "# tmp\n",
771
+ "!ln -vs /tmp/controlnet_models /home/studio-lab-user/stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
772
+ "!mkdir -p /tmp/controlnet_models\n",
773
+ "%cd ~/stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
774
+ "\n",
775
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -o control_v11e_sd15_ip2p_fp16.safetensors\n",
776
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -o control_v11e_sd15_shuffle_fp16.safetensors\n",
777
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors -o control_v11p_sd15_canny_fp16.safetensors\n",
778
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -o control_v11f1p_sd15_depth_fp16.safetensors\n",
779
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -o control_v11p_sd15_inpaint_fp16.safetensors\n",
780
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -o control_v11p_sd15_lineart_fp16.safetensors\n",
781
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -o control_v11p_sd15_mlsd_fp16.safetensors\n",
782
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -o control_v11p_sd15_normalbae_fp16.safetensors\n",
783
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -o control_v11p_sd15_openpose_fp16.safetensors\n",
784
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -o control_v11p_sd15_scribble_fp16.safetensors\n",
785
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors -o control_v11p_sd15_seg_fp16.safetensors\n",
786
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -o control_v11p_sd15_softedge_fp16.safetensors\n",
787
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -o control_v11p_sd15s2_lineart_anime_fp16.safetensors\n",
788
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors -o control_v11f1e_sd15_tile_fp16.safetensors\n",
789
+ "\n",
790
+ "\n",
791
+ "\n",
792
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml -o control_v11e_sd15_ip2p_fp16.yaml\n",
793
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml -o control_v11e_sd15_shuffle_fp16.yaml\n",
794
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml -o control_v11p_sd15_canny_fp16.yaml\n",
795
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml -o control_v11f1p_sd15_depth_fp16.yaml\n",
796
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml -o control_v11p_sd15_inpaint_fp16.yaml\n",
797
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml -o control_v11p_sd15_lineart_fp16.yaml\n",
798
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml -o control_v11p_sd15_mlsd_fp16.yaml\n",
799
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml -o control_v11p_sd15_normalbae_fp16.yaml\n",
800
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml -o control_v11p_sd15_openpose_fp16.yaml\n",
801
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml -o control_v11p_sd15_scribble_fp16.yaml\n",
802
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml -o control_v11p_sd15_seg_fp16.yaml\n",
803
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml -o control_v11p_sd15_softedge_fp16.yaml\n",
804
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml -o control_v11p_sd15s2_lineart_anime_fp16.yaml\n",
805
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml -o control_v11f1e_sd15_tile_fp16.yaml"
806
+ ]
807
+ },
808
+ {
809
+ "cell_type": "code",
810
+ "execution_count": null,
811
+ "id": "aaea3473-1ac6-40d8-98c2-a29386ca147e",
812
+ "metadata": {
813
+ "tags": []
814
+ },
815
+ "outputs": [],
816
+ "source": [
817
+ "#List all folders and sizes\n",
818
+ "!du -h --max-depth=1 /home/studio-lab-user"
819
+ ]
820
+ },
821
+ {
822
+ "cell_type": "code",
823
+ "execution_count": null,
824
+ "id": "747e82f8-7884-4e66-8628-bd1f899c99a4",
825
+ "metadata": {
826
+ "tags": []
827
+ },
828
+ "outputs": [],
829
+ "source": [
830
+ "# create symlink to temporary folder\n",
831
+ "!ln -vs /tmp ~/tmp\n",
832
+ "#\n",
833
+ "!ln -vs /tmp/outputs /home/studio-lab-user/stable-diffusion-webui/outputs\n",
834
+ "#\n",
835
+ "!ln -vs /tmp/models /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
836
+ "#\n",
837
+ "!mkdir ~/stable-diffusion-webui/models/Lora\n",
838
+ "!ln -vs /tmp/Lora /home/studio-lab-user/stable-diffusion-webui/models/Lora/tmp_Lora"
839
+ ]
840
+ },
841
+ {
842
+ "cell_type": "code",
843
+ "execution_count": null,
844
+ "id": "02ccc281-c43a-4bc7-9b97-adf6bea6f8f6",
845
+ "metadata": {
846
+ "tags": []
847
+ },
848
+ "outputs": [],
849
+ "source": [
850
+ "!conda list"
851
+ ]
852
+ },
853
+ {
854
+ "cell_type": "code",
855
+ "execution_count": null,
856
+ "id": "ab02c781-46ea-4f07-8c4b-f329069d903b",
857
+ "metadata": {
858
+ "tags": []
859
+ },
860
+ "outputs": [],
861
+ "source": [
862
+ "#clean remove all env, cache and file\n",
863
+ "!rm -r /home/studio-lab-user/.cache\n",
864
+ "!rm -r /home/studio-lab-user/.stable-diffusion-webui\n",
865
+ "!conda remove -n \"env_name\" --all\n",
866
+ "!rm -rf /home/studio-lab-user/*"
867
+ ]
868
+ },
869
+ {
870
+ "cell_type": "code",
871
+ "execution_count": null,
872
+ "id": "820e32ee-5b82-488b-8daa-767d3b746f2d",
873
+ "metadata": {},
874
+ "outputs": [],
875
+ "source": [
876
+ "!rm -rf /home/studio-lab-user/tmp\n",
877
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
878
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/\n",
879
+ "\n",
880
+ "\n",
881
+ "#delete and empty the MODELS folder\n",
882
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/*\n",
883
+ "\n",
884
+ "# persistent\n",
885
+ "#%cd ~/asd/models/Stable-diffusion\n",
886
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77744 -o Meichidark_Mix_V2.safetensors"
887
+ ]
888
+ },
889
+ {
890
+ "cell_type": "markdown",
891
+ "id": "baaf8967-78f3-4b63-9427-313bffa67a93",
892
+ "metadata": {},
893
+ "source": []
894
+ },
895
+ {
896
+ "cell_type": "code",
897
+ "execution_count": null,
898
+ "id": "4596433a-b219-482d-81bc-622468f9af97",
899
+ "metadata": {},
900
+ "outputs": [],
901
+ "source": [
902
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/sdxl_base.safetensors\" \"https://huggingface.co/ckpt/sd_xl_base_1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors\"\n",
903
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/sdxl_refiner.safetensors\" \"https://huggingface.co/ckpt/sd_xl_refiner_1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors\"\n"
904
+ ]
905
+ },
906
+ {
907
+ "cell_type": "markdown",
908
+ "id": "bf5499c3-18fb-4325-8c37-5298751e4f97",
909
+ "metadata": {},
910
+ "source": [
911
+ "BELOW ONLY FOR TROUBLESHOOTING"
912
+ ]
913
+ },
914
+ {
915
+ "cell_type": "code",
916
+ "execution_count": null,
917
+ "id": "38f3b678-ce14-47c8-b8ca-5b2295fc628c",
918
+ "metadata": {},
919
+ "outputs": [],
920
+ "source": [
921
+ "%cd ~/stable-diffusion-webui\n",
922
+ "!pip install -r requirements.txt"
923
+ ]
924
+ },
925
+ {
926
+ "cell_type": "code",
927
+ "execution_count": null,
928
+ "id": "6c7131fd-9ce7-4c3c-861c-a3acc252c086",
929
+ "metadata": {
930
+ "tags": []
931
+ },
932
+ "outputs": [],
933
+ "source": [
934
+ "%cd ~/stable-diffusion-webui\n",
935
+ "!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --ngrok auth"
936
+ ]
937
+ },
938
+ {
939
+ "cell_type": "code",
940
+ "execution_count": null,
941
+ "id": "5bb61644-e972-402e-aff6-c6445ff99965",
942
+ "metadata": {
943
+ "tags": []
944
+ },
945
+ "outputs": [],
946
+ "source": [
947
+ "import torch\n",
948
+ "torch.cuda.get_device_name(0)"
949
+ ]
950
+ },
951
+ {
952
+ "cell_type": "code",
953
+ "execution_count": null,
954
+ "id": "d6a8c055-4668-40cd-aa41-8bc6474c9ff0",
955
+ "metadata": {
956
+ "tags": []
957
+ },
958
+ "outputs": [],
959
+ "source": [
960
+ "import torch\n",
961
+ "print(torch.version.cuda)"
962
+ ]
963
+ },
964
+ {
965
+ "cell_type": "code",
966
+ "execution_count": null,
967
+ "id": "6b3f9867-000e-43f4-9b04-ae5c0d9166bd",
968
+ "metadata": {
969
+ "tags": []
970
+ },
971
+ "outputs": [],
972
+ "source": [
973
+ "!pip uninstall torchvision -y"
974
+ ]
975
+ },
976
+ {
977
+ "cell_type": "code",
978
+ "execution_count": null,
979
+ "id": "2d990595-7f34-4946-9a21-197306222434",
980
+ "metadata": {
981
+ "tags": []
982
+ },
983
+ "outputs": [],
984
+ "source": [
985
+ "!pip install torchvision==0.10.0"
986
+ ]
987
+ },
988
+ {
989
+ "cell_type": "code",
990
+ "execution_count": null,
991
+ "id": "5b85fa10-c03f-4942-a227-02d1cbe90f4a",
992
+ "metadata": {
993
+ "tags": []
994
+ },
995
+ "outputs": [],
996
+ "source": [
997
+ "!pip install torch==1.10.0"
998
+ ]
999
+ },
1000
+ {
1001
+ "cell_type": "code",
1002
+ "execution_count": null,
1003
+ "id": "abc7178a-c5b7-4722-8e9e-728308d83d70",
1004
+ "metadata": {
1005
+ "tags": []
1006
+ },
1007
+ "outputs": [],
1008
+ "source": [
1009
+ "!pip install xformers==0.0.20 tomesd==0.1.3 pytorch-lightning==1.9.4 accelerate==0.21.0"
1010
+ ]
1011
+ },
1012
+ {
1013
+ "cell_type": "code",
1014
+ "execution_count": null,
1015
+ "id": "577b9843-0e8c-4dd8-aa02-8eaf8c51f1d8",
1016
+ "metadata": {
1017
+ "tags": []
1018
+ },
1019
+ "outputs": [],
1020
+ "source": [
1021
+ "!conda install -c conda-forge libglib -y"
1022
+ ]
1023
+ },
1024
+ {
1025
+ "cell_type": "code",
1026
+ "execution_count": null,
1027
+ "id": "f24321a3-700a-47e9-8995-0893dd2f834f",
1028
+ "metadata": {},
1029
+ "outputs": [],
1030
+ "source": [
1031
+ "import os\n",
1032
+ "import zipfile\n",
1033
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other, https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor'\n",
1034
+ "url_list = embeddings_zip_url.split(\", \")\n",
1035
+ "for url in url_list:\n",
1036
+ " !curl -Lo /home/studio-lab-user/stable-diffusion-webui/models/new {url}\n",
1037
+ "current_dir = '/home/studio-lab-user/stable-diffusion-webui/models/new'\n",
1038
+ "for entry in os.scandir(current_dir):\n",
1039
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
1040
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
1041
+ " zip_ref.extractall(current_dir)\n",
1042
+ "!rm /home/studio-lab-user/stable-diffusion-webui/models/new*.zip"
1043
+ ]
1044
+ },
1045
+ {
1046
+ "cell_type": "code",
1047
+ "execution_count": null,
1048
+ "id": "c830ad32-b536-434f-ae9e-7bf845acd15e",
1049
+ "metadata": {
1050
+ "tags": []
1051
+ },
1052
+ "outputs": [],
1053
+ "source": [
1054
+ "import os\n",
1055
+ "import zipfile\n",
1056
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other, https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor'\n",
1057
+ "url_list = embeddings_zip_url.split(\", \")\n",
1058
+ "for url in url_list:\n",
1059
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /home/studio-lab-user/stable-diffusion-webui/models/new {url}\n",
1060
+ "current_dir = '/home/studio-lab-user/stable-diffusion-webui/models/new'\n",
1061
+ "for entry in os.scandir(current_dir):\n",
1062
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
1063
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
1064
+ " zip_ref.extractall(current_dir)\n",
1065
+ "!rm /home/studio-lab-user/stable-diffusion-webui/models/new*.zip"
1066
+ ]
1067
+ },
1068
+ {
1069
+ "cell_type": "code",
1070
+ "execution_count": null,
1071
+ "id": "28f19aa6-a322-4bbb-bcaa-fccf89e0b174",
1072
+ "metadata": {},
1073
+ "outputs": [],
1074
+ "source": []
1075
+ }
1076
+ ],
1077
+ "metadata": {
1078
+ "kernelspec": {
1079
+ "display_name": "default:Python",
1080
+ "language": "python",
1081
+ "name": "conda-env-default-py"
1082
+ },
1083
+ "language_info": {
1084
+ "codemirror_mode": {
1085
+ "name": "ipython",
1086
+ "version": 3
1087
+ },
1088
+ "file_extension": ".py",
1089
+ "mimetype": "text/x-python",
1090
+ "name": "python",
1091
+ "nbconvert_exporter": "python",
1092
+ "pygments_lexer": "ipython3",
1093
+ "version": "3.9.16"
1094
+ }
1095
+ },
1096
+ "nbformat": 4,
1097
+ "nbformat_minor": 5
1098
+ }
SDXLBase_Notebook_zrock.ipynb ADDED
@@ -0,0 +1,1068 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "23bf0d68-cd40-4803-bf04-7ede3e53b524",
6
+ "metadata": {},
7
+ "source": [
8
+ "<center><span style=\"font-size: 24px;font-weight: bold\">SDXL Models - Dreamscape Notebook 1.9</span></center>\n",
9
+ "<center>Follow tutorial on my <a href=\"www.youtube.com/@dreamscapeyoutube\">Youtube Channel</a>. Join our <a href=\"https://discord.gg/VCqcfZH2jV\">Discord Community</a> for support.</center>"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "markdown",
14
+ "id": "e4dd09f1-eb19-4fd1-ae06-fc8c604366fb",
15
+ "metadata": {
16
+ "tags": []
17
+ },
18
+ "source": [
19
+ "<h4><b>🧼 Step 1. Fresh Clean Environments </b>(launch if it's your first start)</h4>\n",
20
+ "If you have a healthy and working install, SKIP to STEP 3. This can be launched in CPU mode."
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": null,
26
+ "id": "ea5bcd71-2b71-4d27-90c1-053444ef33f0",
27
+ "metadata": {
28
+ "tags": []
29
+ },
30
+ "outputs": [],
31
+ "source": [
32
+ "!rm -r /home/studio-lab-user/.cache\n",
33
+ "!rm -r /home/studio-lab-user/.conda\n",
34
+ "!conda remove -n \"env_name\" --all\n",
35
+ "!rm -rf /home/studio-lab-user/*"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "markdown",
40
+ "id": "f05fa0e9-8141-471e-a9a5-b12cc04a9c94",
41
+ "metadata": {},
42
+ "source": [
43
+ "☢️*Your Browser Panel (on the left) should be empty.*<br>\n",
44
+ "☢️You need to restart the Jupyter Lab now (before running next cell)."
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "id": "c55242c5-3887-4dd4-a384-0b480b0d11f1",
51
+ "metadata": {
52
+ "tags": []
53
+ },
54
+ "outputs": [],
55
+ "source": [
56
+ "import subprocess\n",
57
+ "\n",
58
+ "# Run the command and capture the output\n",
59
+ "result = subprocess.run(['du', '-h', '--max-depth=1', '/home/studio-lab-user'], capture_output=True, text=True)\n",
60
+ "\n",
61
+ "# Check if the desired line is present in the output\n",
62
+ "if '1.1G\\t/home/studio-lab-user/.conda' in result.stdout:\n",
63
+ " print(\"Ok, your conda is clean (1.1GB) please continue with Step 2\")"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "markdown",
68
+ "id": "af2f3f5b-f9ba-4221-92fa-126600e39d9b",
69
+ "metadata": {
70
+ "tags": []
71
+ },
72
+ "source": [
73
+ "<h4><b>🔥 Step 2. Install essentials </b>(launch if it's your first start)</h4>\n",
74
+ "This will install essentials. This can be launched in CPU mode. Be patient it might take a while."
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "id": "7ad40e45-9797-4188-be16-2e6c4d218ddc",
81
+ "metadata": {
82
+ "scrolled": true,
83
+ "tags": []
84
+ },
85
+ "outputs": [],
86
+ "source": [
87
+ "#Install all essentials for stable diffusion\n",
88
+ "!conda install -c conda-forge libglib -y & conda update -n base conda -y\n",
89
+ "%conda install -q -y aria2\n",
90
+ "%conda install -q -y libglib2.0-0\n",
91
+ "%conda install -q -y glib\n",
92
+ "%cd /home/studio-lab-user/\n",
93
+ "!git clone --depth 1 https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
94
+ "%cd /home/studio-lab-user/stable-diffusion-webui/embeddings\n",
95
+ "!git clone --depth 1 https://github.com/dreamscapeai/negativekit\n",
96
+ "%cd /home/studio-lab-user/stable-diffusion-webui/extensions\n",
97
+ "!git clone --depth 1 https://github.com/ahgsql/StyleSelectorXL\n",
98
+ "!git clone --depth 1 https://github.com/etherealxx/batchlinks-webui\n",
99
+ "!git clone --depth 1 https://github.com/zanllp/sd-webui-infinite-image-browsing\n",
100
+ "!git clone --depth 1 https://github.com/dreamscapeai/ultimatesdupscale\n",
101
+ "!git clone --depth 1 https://github.com/dreamscapeai/tagcomplete\n",
102
+ "!git clone --depth 1 https://github.com/IDEA-Research/DWPose\n",
103
+ "!git clone --depth 1 https://github.com/dreamscapeai/CN-v11400\n",
104
+ "!git clone --depth 1 https://github.com/dreamscapeai/adetailer\n",
105
+ "!git clone --depth 1 https://github.com/dreamscapeai/ultimatesdupscale\n",
106
+ "!git clone --depth 1 https://github.com/Ysb321/roooop\n",
107
+ "!git clone --depth 1 https://github.com/Ysb321/sd-artists-ui-tweak\n",
108
+ "!git clone --depth 1 https://github.com/Ysb321/sd-model-downloader"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "id": "3811c75f-0d9f-4b42-84e4-1d304530caf6",
115
+ "metadata": {
116
+ "tags": []
117
+ },
118
+ "outputs": [],
119
+ "source": [
120
+ "%cd /home/studio-lab-user/stable-diffusion-webui/extensions\n",
121
+ "!git clone --depth 1 https://github.com/Gourieff/sd-webui-reactor"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "markdown",
126
+ "id": "2f8db6a2-a6f2-49aa-8037-c591a378c4af",
127
+ "metadata": {
128
+ "tags": []
129
+ },
130
+ "source": [
131
+ "<h4><b>💾 Step 3. Downloads Models and Checkpoints </b></h4>\n",
132
+ "The model are downloaded in tmp folder, which will be emptied at every new runtime. This MUST be launched in GPU MODE."
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": null,
138
+ "id": "7264a7c8-4386-4996-8da7-babb387770d6",
139
+ "metadata": {
140
+ "tags": []
141
+ },
142
+ "outputs": [],
143
+ "source": [
144
+ "!rm -rf /home/studio-lab-user/tmp\n",
145
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
146
+ "!ln -vs /tmp ~/tmp\n",
147
+ "!ln -vs /tmp/models /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
148
+ "!mkdir -p /tmp/models\n",
149
+ "%cd ~/stable-diffusion-webui/models/Stable-diffusion/\n",
150
+ "!aria2c https://civitai.com/api/download/models/130121?type=Model&format=SafeTensor&size=pruned&fp=fp16\n",
151
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/127416?type=Model&format=SafeTensor&size=pruned&fp=fp16\n",
152
+ "%cd ~/stable-diffusion-webui/models/VAE\n",
153
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/Ysb321/supper/releases/download/vae/vae-ft-mse-840000-ema-pruned.vae.pt"
154
+ ]
155
+ },
156
+ {
157
+ "cell_type": "code",
158
+ "execution_count": null,
159
+ "id": "f737271e-bc08-4eb8-9cd3-beff93103067",
160
+ "metadata": {
161
+ "tags": []
162
+ },
163
+ "outputs": [],
164
+ "source": [
165
+ "# For Lora url\n",
166
+ "\n",
167
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Lora\n",
168
+ "import requests\n",
169
+ "\n",
170
+ "# Define a list of URLs to download\n",
171
+ "urls = [\n",
172
+ " 'https://civitai.com/api/download/models/61160?type=Model&format=SafeTensor',\n",
173
+ " 'https://civitai.com/api/download/models/146600?type=Model&format=SafeTensor',\n",
174
+ " 'https://civitai.com/api/download/models/182772?type=Model&format=SafeTensor',\n",
175
+ " 'https://civitai.com/api/download/models/186168?type=Model&format=SafeTensor',\n",
176
+ " 'https://civitai.com/api/download/models/182038?type=Model&format=SafeTensor',\n",
177
+ " 'https://civitai.com/api/download/models/32066?type=Model&format=SafeTensor&size=full&fp=fp16',\n",
178
+ " 'https://civitai.com/api/download/models/55644?type=Model&format=SafeTensor',\n",
179
+ " 'https://civitai.com/api/download/models/149622?type=Model&format=SafeTensor',\n",
180
+ " 'https://example.com/file3.pdf'\n",
181
+ "]\n",
182
+ "\n",
183
+ "# Loop through the URLs and download each file\n",
184
+ "for url in urls:\n",
185
+ " response = requests.get(url)\n",
186
+ " if 'content-disposition' in response.headers:\n",
187
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
188
+ " with open(filename, 'wb') as f:\n",
189
+ " f.write(response.content)\n",
190
+ " else:\n",
191
+ " print(f'Error: Content-Disposition header not found for {url}')"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "code",
196
+ "execution_count": null,
197
+ "id": "6701a25f-3fbd-46b5-b880-65a1789c4761",
198
+ "metadata": {
199
+ "tags": []
200
+ },
201
+ "outputs": [],
202
+ "source": [
203
+ "# For Lora url\n",
204
+ "\n",
205
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Lora\n",
206
+ "import requests\n",
207
+ "\n",
208
+ "# Define a list of URLs to download\n",
209
+ "urls = [\n",
210
+ " 'https://civitai.com/api/download/models/53452?type=Model&format=SafeTensor',\n",
211
+ " 'https://civitai.com/api/download/models/45030?type=Model&format=SafeTensor',\n",
212
+ " 'https://civitai.com/api/download/models/47342?type=Model&format=SafeTensor',\n",
213
+ " 'https://civitai.com/api/download/models/45019?type=Model&format=SafeTensor',\n",
214
+ " 'https://civitai.com/api/download/models/48351?type=Model&format=SafeTensor',\n",
215
+ " 'https://civitai.com/api/download/models/50931?type=Model&format=SafeTensor',\n",
216
+ " 'https://civitai.com/api/download/models/96186?type=Model&format=SafeTensor',\n",
217
+ " 'https://civitai.com/api/download/models/67464?type=Model&format=SafeTensor'\n",
218
+ "]\n",
219
+ "\n",
220
+ "# Loop through the URLs and download each file\n",
221
+ "for url in urls:\n",
222
+ " response = requests.get(url)\n",
223
+ " if 'content-disposition' in response.headers:\n",
224
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
225
+ " with open(filename, 'wb') as f:\n",
226
+ " f.write(response.content)\n",
227
+ " else:\n",
228
+ " print(f'Error: Content-Disposition header not found for {url}')"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "code",
233
+ "execution_count": null,
234
+ "id": "1e0609ad-d797-4222-8390-65902e00dbe7",
235
+ "metadata": {
236
+ "tags": []
237
+ },
238
+ "outputs": [],
239
+ "source": [
240
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/\n",
241
+ "!mkdir -p Stable-diffusion\n",
242
+ "%cd /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion\n",
243
+ "import requests\n",
244
+ "\n",
245
+ "# Define a list of URLs to download\n",
246
+ "urls = [\n",
247
+ " 'https://civitai.com/api/download/models/178879?type=Model&format=SafeTensor&size=pruned&fp=fp16'\n",
248
+ "]\n",
249
+ "\n",
250
+ "# Loop through the URLs and download each file\n",
251
+ "for url in urls:\n",
252
+ " response = requests.get(url)\n",
253
+ " if 'content-disposition' in response.headers:\n",
254
+ " filename = response.headers.get('content-disposition').split('filename=')[1].strip('\"')\n",
255
+ " with open(filename, 'wb') as f:\n",
256
+ " f.write(response.content)\n",
257
+ " else:\n",
258
+ " print(f'Error: Content-Disposition header not found for {url}')"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": null,
264
+ "id": "d04c62cc-fda7-427c-80cd-5c158b9b22b8",
265
+ "metadata": {
266
+ "tags": []
267
+ },
268
+ "outputs": [],
269
+ "source": [
270
+ "%cd ~/stable-diffusion-webui/models/Stable-diffusion/\n",
271
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/178879?type=Model&format=SafeTensor&size=pruned&fp=fp16"
272
+ ]
273
+ },
274
+ {
275
+ "cell_type": "markdown",
276
+ "id": "6a87cf1c-7b77-4618-9576-c7e4181dde49",
277
+ "metadata": {
278
+ "tags": []
279
+ },
280
+ "source": [
281
+ "<h4><b>🌟 Step 4. BOOT LAUNCHER WEBUI (MUST BE in GPU Mode)</b></h4> \n",
282
+ "Don't forget to paste your NGROK token below. Create one token here https://dashboard.ngrok.com/get-started/your-authtoken"
283
+ ]
284
+ },
285
+ {
286
+ "cell_type": "code",
287
+ "execution_count": null,
288
+ "id": "42129da6-cb4d-48c6-af2f-1e803a511634",
289
+ "metadata": {},
290
+ "outputs": [],
291
+ "source": []
292
+ },
293
+ {
294
+ "cell_type": "code",
295
+ "execution_count": null,
296
+ "id": "2b6ce256-5678-4521-b473-4d5f2c121da5",
297
+ "metadata": {
298
+ "tags": []
299
+ },
300
+ "outputs": [],
301
+ "source": [
302
+ "%cd /tmp\n",
303
+ "!wget https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz\n",
304
+ "!mkdir /tmp/zrok\n",
305
+ "!tar -xf ./zrok*linux*.tar.gz -C /tmp/zrok\n",
306
+ "!mkdir -p /tmp/zrok/bin && install /tmp/zrok/zrok /tmp/zrok/bin\n",
307
+ "import os\n",
308
+ "os.environ['PATH'] = \"/tmp/zrok/bin:\" + os.environ['PATH']\n",
309
+ "!zrok version"
310
+ ]
311
+ },
312
+ {
313
+ "cell_type": "code",
314
+ "execution_count": null,
315
+ "id": "a8c824f7-4868-43b8-9980-a7dad6110bb2",
316
+ "metadata": {},
317
+ "outputs": [],
318
+ "source": [
319
+ "#Only launch this command in the terminal\n",
320
+ "export PATH=$PATH:/tmp/zrok/bin\n",
321
+ "zrok invite"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "code",
326
+ "execution_count": null,
327
+ "id": "1e99ecb3-ed61-4503-a1a0-5d9f1688cb66",
328
+ "metadata": {
329
+ "tags": []
330
+ },
331
+ "outputs": [],
332
+ "source": [
333
+ "!zrok enable 4wJsCtYsgeDT"
334
+ ]
335
+ },
336
+ {
337
+ "cell_type": "markdown",
338
+ "id": "97b1e0b7-ff3e-4d35-8a83-05a09c682048",
339
+ "metadata": {},
340
+ "source": [
341
+ "RUN BOTTOM Cell"
342
+ ]
343
+ },
344
+ {
345
+ "cell_type": "code",
346
+ "execution_count": null,
347
+ "id": "a21a9399-21a2-4529-be7a-f0440a867ce6",
348
+ "metadata": {
349
+ "tags": []
350
+ },
351
+ "outputs": [],
352
+ "source": [
353
+ "%cd ~/stable-diffusion-webui\n",
354
+ "from multiprocessing import Process\n",
355
+ "import time\n",
356
+ "\n",
357
+ "def run_command1():\n",
358
+ "# time.sleep(15)\n",
359
+ " !zrok share public http://localhost:7860 --headless\n",
360
+ "\n",
361
+ "def run_command2():\n",
362
+ " time.sleep(2)\n",
363
+ " !python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue\n",
364
+ "\n",
365
+ "if __name__ == '__main__':\n",
366
+ " p1 = Process(target=run_command1)\n",
367
+ " p2 = Process(target=run_command2)\n",
368
+ " p1.start()\n",
369
+ " p2.start()\n",
370
+ " p1.join()\n",
371
+ " p2.join()"
372
+ ]
373
+ },
374
+ {
375
+ "cell_type": "code",
376
+ "execution_count": 8,
377
+ "id": "e257f61c-7aa2-44b6-8641-efb4285ac844",
378
+ "metadata": {
379
+ "tags": []
380
+ },
381
+ "outputs": [
382
+ {
383
+ "name": "stdout",
384
+ "output_type": "stream",
385
+ "text": [
386
+ "[ 103.808] INFO main.(*sharePublicCommand).run: [] -> GET /assets/index-ceec2f2d.js\n",
387
+ "[ 103.814] INFO main.(*sharePublicCommand).run: [] -> GET /assets/index-7c64fb49.js\n",
388
+ "[ 109.841] INFO main.(*sharePublicCommand).run: [] -> POST /run/predict\n",
389
+ "[ 109.845] INFO main.(*sharePublicCommand).run: [] -> POST /run/predict\n",
390
+ "[ 109.852] INFO main.(*sharePublicCommand).run: [] -> POST /run/predict\n",
391
+ "[ 109.856] INFO main.(*sharePublicCommand).run: [] -> POST /run/predict\n",
392
+ "[ 110.130] INFO main.(*sharePublicCommand).run: [] -> POST /run/predict\n",
393
+ "[ 110.485] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n",
394
+ "[ 111.391] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/index-4399f518.js\n",
395
+ "[ 111.399] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/index-896679b3.css\n",
396
+ "[ 111.473] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n",
397
+ "[ 114.062] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n",
398
+ "Traceback (most recent call last):\n",
399
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/routes.py\", line 488, in run_predict\n",
400
+ " output = await app.get_blocks().process_api(\n",
401
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/blocks.py\", line 1431, in process_api\n",
402
+ " result = await self.call_function(\n",
403
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/blocks.py\", line 1103, in call_function\n",
404
+ " prediction = await anyio.to_thread.run_sync(\n",
405
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/to_thread.py\", line 33, in run_sync\n",
406
+ " return await get_asynclib().run_sync_in_worker_thread(\n",
407
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 877, in run_sync_in_worker_thread\n",
408
+ " return await future\n",
409
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 807, in run\n",
410
+ " result = context.run(func, *args)\n",
411
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/utils.py\", line 707, in wrapper\n",
412
+ " response = f(*args, **kwargs)\n",
413
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks.py\", line 419, in pages_html\n",
414
+ " return refresh()\n",
415
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks.py\", line 425, in refresh\n",
416
+ " pg.refresh()\n",
417
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks_textual_inversion.py\", line 13, in refresh\n",
418
+ " sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)\n",
419
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py\", line 222, in load_textual_inversion_embeddings\n",
420
+ " self.expected_shape = self.get_expected_shape()\n",
421
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py\", line 154, in get_expected_shape\n",
422
+ " vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(\",\", 1)\n",
423
+ "AttributeError: 'NoneType' object has no attribute 'cond_stage_model'\n",
424
+ "[ 115.041] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n",
425
+ "[ 115.070] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/db-ccfd5d0c.js\n",
426
+ "[ 115.076] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/emptyStartup-392c1d3a.js\n",
427
+ "[ 115.117] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/global_setting\n",
428
+ "Traceback (most recent call last):\n",
429
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/routes.py\", line 488, in run_predict\n",
430
+ " output = await app.get_blocks().process_api(\n",
431
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/blocks.py\", line 1431, in process_api\n",
432
+ " result = await self.call_function(\n",
433
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/blocks.py\", line 1103, in call_function\n",
434
+ " prediction = await anyio.to_thread.run_sync(\n",
435
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/to_thread.py\", line 33, in run_sync\n",
436
+ " return await get_asynclib().run_sync_in_worker_thread(\n",
437
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 877, in run_sync_in_worker_thread\n",
438
+ " return await future\n",
439
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 807, in run\n",
440
+ " result = context.run(func, *args)\n",
441
+ " File \"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/utils.py\", line 707, in wrapper\n",
442
+ " response = f(*args, **kwargs)\n",
443
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks.py\", line 419, in pages_html\n",
444
+ " return refresh()\n",
445
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks.py\", line 425, in refresh\n",
446
+ " pg.refresh()\n",
447
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/ui_extra_networks_textual_inversion.py\", line 13, in refresh\n",
448
+ " sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)\n",
449
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py\", line 222, in load_textual_inversion_embeddings\n",
450
+ " self.expected_shape = self.get_expected_shape()\n",
451
+ " File \"/home/studio-lab-user/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py\", line 154, in get_expected_shape\n",
452
+ " vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(\",\", 1)\n",
453
+ "AttributeError: 'NoneType' object has no attribute 'cond_stage_model'\n",
454
+ "[ 115.982] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n",
455
+ "[ 116.616] INFO main.(*sharePublicCommand).run: [] -> POST /infinite_image_browsing/check_path_exists\n",
456
+ "[ 116.637] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/emptyStartup-f9353e31.css\n",
457
+ "[ 117.226] INFO main.(*sharePublicCommand).run: [] -> GET /infinite_image_browsing/fe-static/assets/antd.dark-35e9b327.js\n",
458
+ "[ 120.826] INFO main.(*sharePublicCommand).run: [] -> GET /file=tmp/tagAutocompletePath.txt?1714837242268\n",
459
+ "[ 121.547] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/extra-quality-tags.csv?1714837242977\n",
460
+ "[ 121.897] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/e621.csv?1714837243340\n",
461
+ "[ 130.451] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/extra-quality-tags.csv?1714837251892\n",
462
+ "[ 130.799] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/demo-chants.json??1714837252250\n",
463
+ "[ 131.160] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/demo-chants.json??1714837252592\n",
464
+ "[ 131.511] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/emb.txt?1714837252962\n",
465
+ "[ 131.870] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/hyp.txt?1714837253308\n",
466
+ "[ 132.210] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/lora.txt?1714837253660\n",
467
+ "[ 132.564] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/lyco.txt?1714837254004\n",
468
+ "[ 132.904] INFO main.(*sharePublicCommand).run: [] -> GET /file=tmp/modelKeywordPath.txt?1714837254354\n",
469
+ "[ 133.247] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/umi_tags.txt?1714837254692\n",
470
+ "[ 133.587] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/wc.txt?1714837255039\n",
471
+ "[ 133.951] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/wce.txt?1714837255376\n",
472
+ "[ 134.292] INFO main.(*sharePublicCommand).run: [] -> GET /file=/home/studio-lab-user/stable-diffusion-webui/extensions/tagcomplete/tags/temp/wc_yaml.json?1714837255744\n",
473
+ "[ 146.477] INFO main.(*sharePublicCommand).run: [] -> GET /file=/tmp/gradio/952f9b63cd937f0440f35dd204d7765471e81688/notification.mp3\n",
474
+ "[ 150.526] INFO main.(*sharePublicCommand).run: [] -> GET /queue/join\n"
475
+ ]
476
+ },
477
+ {
478
+ "ename": "KeyboardInterrupt",
479
+ "evalue": "",
480
+ "output_type": "error",
481
+ "traceback": [
482
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
483
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
484
+ "\u001b[0;32m/tmp/ipykernel_141/1068629004.py\u001b[0m in \u001b[0;36m<cell line: 13>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0mp1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mp2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mp1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0mp2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
485
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/process.py\u001b[0m in \u001b[0;36mjoin\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 147\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_parent_pid\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetpid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'can only join a child process'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 148\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_popen\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'can only join a started process'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 149\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_popen\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 150\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 151\u001b[0m \u001b[0m_children\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdiscard\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
486
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/popen_fork.py\u001b[0m in \u001b[0;36mwait\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[0;31m# This shouldn't block if wait() returned successfully.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 43\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpoll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mWNOHANG\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtimeout\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0.0\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 44\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreturncode\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
487
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/popen_fork.py\u001b[0m in \u001b[0;36mpoll\u001b[0;34m(self, flag)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreturncode\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m \u001b[0mpid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwaitpid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mflag\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[0;31m# Child process not yet created. See #1731717\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
488
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
489
+ ]
490
+ },
491
+ {
492
+ "name": "stdout",
493
+ "output_type": "stream",
494
+ "text": [
495
+ "^C\n",
496
+ "Interrupted with signal 2 in <frame at 0x5645ae75e660, file '/home/studio-lab-user/.conda/envs/default/lib/python3.9/threading.py', line 316, code wait>\n",
497
+ "^C\n"
498
+ ]
499
+ }
500
+ ],
501
+ "source": [
502
+ "%cd ~/stable-diffusion-webui\n",
503
+ "from multiprocessing import Process\n",
504
+ "import time\n",
505
+ "\n",
506
+ "def run_command1():\n",
507
+ "# time.sleep(15)\n",
508
+ " !zrok share public http://localhost:7860 --headless\n",
509
+ "\n",
510
+ "def run_command2():\n",
511
+ " time.sleep(2)\n",
512
+ " !python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --skip-torch-cuda-test --no-half-vae\n",
513
+ "\n",
514
+ "if __name__ == '__main__':\n",
515
+ " p1 = Process(target=run_command1)\n",
516
+ " p2 = Process(target=run_command2)\n",
517
+ " p1.start()\n",
518
+ " p2.start()\n",
519
+ " p1.join()\n",
520
+ " p2.join()"
521
+ ]
522
+ },
523
+ {
524
+ "cell_type": "code",
525
+ "execution_count": null,
526
+ "id": "9ea3ea45-056c-4863-a06a-3f7422bf7e20",
527
+ "metadata": {
528
+ "scrolled": true,
529
+ "tags": []
530
+ },
531
+ "outputs": [],
532
+ "source": [
533
+ "#Don't forget to paste your NGROK token here\n",
534
+ "argu = '--skip-torch-cuda-test --enable-insecure-extension-access --disable-console-progressbars --xformers --enable-insecure-extension-access --theme dark --lowram' \n",
535
+ "%cd ~/stable-diffusion-webui\n",
536
+ "\n",
537
+ "#!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/config.json\n",
538
+ "#!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/styles.csv\n",
539
+ "#!conda install -y -c conda-forge nodejs\n",
540
+ "#!npm install -g localtunnel\n",
541
+ "\n",
542
+ "\n",
543
+ "!git pull\n",
544
+ "#!conda install -y -c conda-forge openssh\n",
545
+ "!python3 -m pip install gradio\n",
546
+ "!wget -q -O - https://loca.lt/mytunnelpassword\n",
547
+ "!lt --port 7860 --subdomain example-subdomain --local_https False & python launch.py {argu} --share\n",
548
+ "#!python launch.py --skip-torch-cuda-test --remotemoe --enable-insecure-extension-access --disable-console-progressbars --xformers --enable-insecure-extension-access --theme dark --lowram"
549
+ ]
550
+ },
551
+ {
552
+ "cell_type": "code",
553
+ "execution_count": null,
554
+ "id": "08cc20d4-3cb7-45b9-8ca7-506abe0cf79c",
555
+ "metadata": {
556
+ "tags": []
557
+ },
558
+ "outputs": [],
559
+ "source": [
560
+ "#Check your available storage\n",
561
+ "!df -h | grep -E 'Avail|home'"
562
+ ]
563
+ },
564
+ {
565
+ "cell_type": "code",
566
+ "execution_count": null,
567
+ "id": "d2eeb1a8-4cfb-478c-81da-a7825e8caf3f",
568
+ "metadata": {
569
+ "tags": []
570
+ },
571
+ "outputs": [],
572
+ "source": [
573
+ "\n",
574
+ "%cd ~/stable-diffusion-webui/extentions\n",
575
+ "!git clone https://github.com/camenduru/tunnels\n"
576
+ ]
577
+ },
578
+ {
579
+ "cell_type": "code",
580
+ "execution_count": null,
581
+ "id": "1efae36f-e7b6-44ab-aef8-6a70eea650d8",
582
+ "metadata": {
583
+ "tags": []
584
+ },
585
+ "outputs": [],
586
+ "source": [
587
+ "from http.server import HTTPServer, BaseHTTPRequestHandler\n",
588
+ "\n",
589
+ "class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):\n",
590
+ " def do_GET(self):\n",
591
+ " self.send_response(200)\n",
592
+ " self.send_header('Content-type', 'text/html')\n",
593
+ " self.end_headers()\n",
594
+ " self.wfile.write(b\"Hello, welcome to your local server!\")\n",
595
+ "\n",
596
+ "def run(server_class=HTTPServer, handler_class=SimpleHTTPRequestHandler, port=7860):\n",
597
+ " server_address = ('', port)\n",
598
+ " httpd = server_class(server_address, handler_class)\n",
599
+ " print(f\"Server running on http://127.0.0.1:{port}\")\n",
600
+ " httpd.serve_forever()\n",
601
+ "\n",
602
+ "run()\n"
603
+ ]
604
+ },
605
+ {
606
+ "cell_type": "markdown",
607
+ "id": "c9058578-7096-44ce-8ea2-0153cf151c44",
608
+ "metadata": {
609
+ "tags": []
610
+ },
611
+ "source": [
612
+ "<h4><b>🖼️ Step 5. Download all your outputs </b></h4> \n",
613
+ "If your setup folder doesn't have problem, skip this step."
614
+ ]
615
+ },
616
+ {
617
+ "cell_type": "code",
618
+ "execution_count": null,
619
+ "id": "a0245311-d83a-469a-bb00-2c7c37def333",
620
+ "metadata": {
621
+ "tags": []
622
+ },
623
+ "outputs": [],
624
+ "source": [
625
+ "#download and compress all outputs\n",
626
+ "import zipfile\n",
627
+ "import os\n",
628
+ "\n",
629
+ "def create_zip_archive(source_dir, output_path):\n",
630
+ " with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:\n",
631
+ " for root, dirs, files in os.walk(source_dir):\n",
632
+ " for file in files:\n",
633
+ " file_path = os.path.join(root, file)\n",
634
+ " zipf.write(file_path, os.path.relpath(file_path, source_dir))\n",
635
+ "\n",
636
+ "# Specify the source directory and output path\n",
637
+ "source_dir = '/home/studio-lab-user/drive/MyDrive/SD-IMG-OUT'\n",
638
+ "output_path = '/home/studio-lab-user/outputs.zip'\n",
639
+ "\n",
640
+ "# Create the ZIP archive\n",
641
+ "create_zip_archive(source_dir, output_path)"
642
+ ]
643
+ },
644
+ {
645
+ "cell_type": "code",
646
+ "execution_count": null,
647
+ "id": "fdeece9b-7e0a-4c93-aec2-6d96b95cdc84",
648
+ "metadata": {
649
+ "tags": []
650
+ },
651
+ "outputs": [],
652
+ "source": [
653
+ "#download and compress all outputs\n",
654
+ "import os\n",
655
+ "import zipfile\n",
656
+ "def zip_folder(input_folder, output_folder, max_size_mb=20):\n",
657
+ " # Create the output folder if it doesn't exist\n",
658
+ " os.makedirs(output_folder, exist_ok=True)\n",
659
+ " zip_number = 1\n",
660
+ " current_zip_size = 0\n",
661
+ " current_zip_name = os.path.join(output_folder, f\"part_{zip_number}.zip\") \n",
662
+ " with zipfile.ZipFile(current_zip_name, 'w', zipfile.ZIP_DEFLATED) as current_zip:\n",
663
+ " for root, _, files in os.walk(input_folder):\n",
664
+ " for file in files:\n",
665
+ " file_path = os.path.join(root, file)\n",
666
+ " file_size = os.path.getsize(file_path) \n",
667
+ " # Check if adding the current file exceeds the max size\n",
668
+ " if current_zip_size + file_size > max_size_mb * 1024 * 1024:\n",
669
+ " # Close the current zip file\n",
670
+ " current_zip.close() \n",
671
+ " # Start a new zip file\n",
672
+ " zip_number += 1\n",
673
+ " current_zip_name = os.path.join(output_folder, f\"part_{zip_number}.zip\")\n",
674
+ " current_zip = zipfile.ZipFile(current_zip_name, 'w', zipfile.ZIP_DEFLATED)\n",
675
+ " current_zip_size = 0 \n",
676
+ " # Add the file to the current zip\n",
677
+ " current_zip.write(file_path, os.path.relpath(file_path, input_folder))\n",
678
+ " current_zip_size += file_size\n",
679
+ "# Specify the input folder to be zipped\n",
680
+ "input_folder = 'drive/MyDrive/SD-IMG-OUT/extras' # Replace with the path to your input folder\n",
681
+ "# Specify the output folder where zip files will be saved\n",
682
+ "output_folder = 'drive/MyDrive' # Replace with the path to your output folder\n",
683
+ "# Specify the maximum size for each zip file in MB\n",
684
+ "max_size_mb = 200\n",
685
+ "# Create zip files with a maximum size of 20MB\n",
686
+ "zip_folder(input_folder, output_folder, max_size_mb)"
687
+ ]
688
+ },
689
+ {
690
+ "cell_type": "code",
691
+ "execution_count": null,
692
+ "id": "b8a56c3a-f0af-4c87-bf83-c99942a3a3b0",
693
+ "metadata": {},
694
+ "outputs": [],
695
+ "source": [
696
+ "#delete and empty the OUTPUT folder\n",
697
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/outputs/*"
698
+ ]
699
+ },
700
+ {
701
+ "cell_type": "markdown",
702
+ "id": "1d0a3313-0c65-44ef-b89e-459fa779e84b",
703
+ "metadata": {
704
+ "tags": []
705
+ },
706
+ "source": [
707
+ "<h4><b> Backup Tools </b></h4>\n",
708
+ "If your setup folder doesn't have problem, skip this step."
709
+ ]
710
+ },
711
+ {
712
+ "cell_type": "code",
713
+ "execution_count": null,
714
+ "id": "213d1125-9602-46bb-90d8-3d5cd1ca684a",
715
+ "metadata": {},
716
+ "outputs": [],
717
+ "source": [
718
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/animatrix.safetensors\" \"https://civitai.com/api/download/models/44827?type=Model&format=PickleTensor&size=pruned&fp=fp16\""
719
+ ]
720
+ },
721
+ {
722
+ "cell_type": "code",
723
+ "execution_count": null,
724
+ "id": "eaca1b93-a213-4778-84fa-43605b6f75dd",
725
+ "metadata": {
726
+ "tags": []
727
+ },
728
+ "outputs": [],
729
+ "source": [
730
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/VAE/sdxl_vae.safetensors\" \"https://huggingface.co/ckpt/sdxl_vae/resolve/main/sdxl_vae.safetensors\""
731
+ ]
732
+ },
733
+ {
734
+ "cell_type": "code",
735
+ "execution_count": null,
736
+ "id": "f4fd3fe0-7f79-4359-9e5d-8305c31ae68b",
737
+ "metadata": {},
738
+ "outputs": [],
739
+ "source": [
740
+ "# tmp\n",
741
+ "!ln -vs /tmp/controlnet_models /home/studio-lab-user/stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
742
+ "!mkdir -p /tmp/controlnet_models\n",
743
+ "%cd ~/stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
744
+ "\n",
745
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -o control_v11e_sd15_ip2p_fp16.safetensors\n",
746
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -o control_v11e_sd15_shuffle_fp16.safetensors\n",
747
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors -o control_v11p_sd15_canny_fp16.safetensors\n",
748
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -o control_v11f1p_sd15_depth_fp16.safetensors\n",
749
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -o control_v11p_sd15_inpaint_fp16.safetensors\n",
750
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -o control_v11p_sd15_lineart_fp16.safetensors\n",
751
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -o control_v11p_sd15_mlsd_fp16.safetensors\n",
752
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -o control_v11p_sd15_normalbae_fp16.safetensors\n",
753
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -o control_v11p_sd15_openpose_fp16.safetensors\n",
754
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -o control_v11p_sd15_scribble_fp16.safetensors\n",
755
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors -o control_v11p_sd15_seg_fp16.safetensors\n",
756
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -o control_v11p_sd15_softedge_fp16.safetensors\n",
757
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -o control_v11p_sd15s2_lineart_anime_fp16.safetensors\n",
758
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors -o control_v11f1e_sd15_tile_fp16.safetensors\n",
759
+ "\n",
760
+ "\n",
761
+ "\n",
762
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml -o control_v11e_sd15_ip2p_fp16.yaml\n",
763
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml -o control_v11e_sd15_shuffle_fp16.yaml\n",
764
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml -o control_v11p_sd15_canny_fp16.yaml\n",
765
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml -o control_v11f1p_sd15_depth_fp16.yaml\n",
766
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml -o control_v11p_sd15_inpaint_fp16.yaml\n",
767
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml -o control_v11p_sd15_lineart_fp16.yaml\n",
768
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml -o control_v11p_sd15_mlsd_fp16.yaml\n",
769
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml -o control_v11p_sd15_normalbae_fp16.yaml\n",
770
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml -o control_v11p_sd15_openpose_fp16.yaml\n",
771
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml -o control_v11p_sd15_scribble_fp16.yaml\n",
772
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml -o control_v11p_sd15_seg_fp16.yaml\n",
773
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml -o control_v11p_sd15_softedge_fp16.yaml\n",
774
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml -o control_v11p_sd15s2_lineart_anime_fp16.yaml\n",
775
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml -o control_v11f1e_sd15_tile_fp16.yaml"
776
+ ]
777
+ },
778
+ {
779
+ "cell_type": "code",
780
+ "execution_count": null,
781
+ "id": "aaea3473-1ac6-40d8-98c2-a29386ca147e",
782
+ "metadata": {
783
+ "tags": []
784
+ },
785
+ "outputs": [],
786
+ "source": [
787
+ "#List all folders and sizes\n",
788
+ "!du -h --max-depth=1 /home/studio-lab-user"
789
+ ]
790
+ },
791
+ {
792
+ "cell_type": "code",
793
+ "execution_count": null,
794
+ "id": "747e82f8-7884-4e66-8628-bd1f899c99a4",
795
+ "metadata": {
796
+ "tags": []
797
+ },
798
+ "outputs": [],
799
+ "source": [
800
+ "# create symlink to temporary folder\n",
801
+ "!ln -vs /tmp ~/tmp\n",
802
+ "#\n",
803
+ "!ln -vs /tmp/outputs /home/studio-lab-user/stable-diffusion-webui/outputs\n",
804
+ "#\n",
805
+ "!ln -vs /tmp/models /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
806
+ "#\n",
807
+ "!mkdir ~/stable-diffusion-webui/models/Lora\n",
808
+ "!ln -vs /tmp/Lora /home/studio-lab-user/stable-diffusion-webui/models/Lora/tmp_Lora"
809
+ ]
810
+ },
811
+ {
812
+ "cell_type": "code",
813
+ "execution_count": null,
814
+ "id": "02ccc281-c43a-4bc7-9b97-adf6bea6f8f6",
815
+ "metadata": {
816
+ "tags": []
817
+ },
818
+ "outputs": [],
819
+ "source": [
820
+ "!conda list"
821
+ ]
822
+ },
823
+ {
824
+ "cell_type": "code",
825
+ "execution_count": null,
826
+ "id": "ab02c781-46ea-4f07-8c4b-f329069d903b",
827
+ "metadata": {
828
+ "tags": []
829
+ },
830
+ "outputs": [],
831
+ "source": [
832
+ "#clean remove all env, cache and file\n",
833
+ "!rm -r /home/studio-lab-user/.cache\n",
834
+ "!rm -r /home/studio-lab-user/.stable-diffusion-webui\n",
835
+ "!conda remove -n \"env_name\" --all\n",
836
+ "!rm -rf /home/studio-lab-user/*"
837
+ ]
838
+ },
839
+ {
840
+ "cell_type": "code",
841
+ "execution_count": null,
842
+ "id": "820e32ee-5b82-488b-8daa-767d3b746f2d",
843
+ "metadata": {},
844
+ "outputs": [],
845
+ "source": [
846
+ "!rm -rf /home/studio-lab-user/tmp\n",
847
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/tmp_models\n",
848
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/\n",
849
+ "\n",
850
+ "\n",
851
+ "#delete and empty the MODELS folder\n",
852
+ "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/*\n",
853
+ "\n",
854
+ "# persistent\n",
855
+ "#%cd ~/asd/models/Stable-diffusion\n",
856
+ "#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77744 -o Meichidark_Mix_V2.safetensors"
857
+ ]
858
+ },
859
+ {
860
+ "cell_type": "markdown",
861
+ "id": "baaf8967-78f3-4b63-9427-313bffa67a93",
862
+ "metadata": {},
863
+ "source": []
864
+ },
865
+ {
866
+ "cell_type": "code",
867
+ "execution_count": null,
868
+ "id": "4596433a-b219-482d-81bc-622468f9af97",
869
+ "metadata": {},
870
+ "outputs": [],
871
+ "source": [
872
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/sdxl_base.safetensors\" \"https://huggingface.co/ckpt/sd_xl_base_1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors\"\n",
873
+ "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/sdxl_refiner.safetensors\" \"https://huggingface.co/ckpt/sd_xl_refiner_1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors\"\n"
874
+ ]
875
+ },
876
+ {
877
+ "cell_type": "markdown",
878
+ "id": "bf5499c3-18fb-4325-8c37-5298751e4f97",
879
+ "metadata": {},
880
+ "source": [
881
+ "BELOW ONLY FOR TROUBLESHOOTING"
882
+ ]
883
+ },
884
+ {
885
+ "cell_type": "code",
886
+ "execution_count": null,
887
+ "id": "38f3b678-ce14-47c8-b8ca-5b2295fc628c",
888
+ "metadata": {},
889
+ "outputs": [],
890
+ "source": [
891
+ "%cd ~/stable-diffusion-webui\n",
892
+ "!pip install -r requirements.txt"
893
+ ]
894
+ },
895
+ {
896
+ "cell_type": "code",
897
+ "execution_count": null,
898
+ "id": "6c7131fd-9ce7-4c3c-861c-a3acc252c086",
899
+ "metadata": {
900
+ "tags": []
901
+ },
902
+ "outputs": [],
903
+ "source": [
904
+ "%cd ~/stable-diffusion-webui\n",
905
+ "!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --ngrok auth"
906
+ ]
907
+ },
908
+ {
909
+ "cell_type": "code",
910
+ "execution_count": null,
911
+ "id": "5bb61644-e972-402e-aff6-c6445ff99965",
912
+ "metadata": {
913
+ "tags": []
914
+ },
915
+ "outputs": [],
916
+ "source": [
917
+ "import torch\n",
918
+ "torch.cuda.get_device_name(0)"
919
+ ]
920
+ },
921
+ {
922
+ "cell_type": "code",
923
+ "execution_count": null,
924
+ "id": "d6a8c055-4668-40cd-aa41-8bc6474c9ff0",
925
+ "metadata": {
926
+ "tags": []
927
+ },
928
+ "outputs": [],
929
+ "source": [
930
+ "import torch\n",
931
+ "print(torch.version.cuda)"
932
+ ]
933
+ },
934
+ {
935
+ "cell_type": "code",
936
+ "execution_count": null,
937
+ "id": "6b3f9867-000e-43f4-9b04-ae5c0d9166bd",
938
+ "metadata": {
939
+ "tags": []
940
+ },
941
+ "outputs": [],
942
+ "source": [
943
+ "!pip uninstall torchvision -y"
944
+ ]
945
+ },
946
+ {
947
+ "cell_type": "code",
948
+ "execution_count": null,
949
+ "id": "2d990595-7f34-4946-9a21-197306222434",
950
+ "metadata": {
951
+ "tags": []
952
+ },
953
+ "outputs": [],
954
+ "source": [
955
+ "!pip install torchvision==0.10.0"
956
+ ]
957
+ },
958
+ {
959
+ "cell_type": "code",
960
+ "execution_count": null,
961
+ "id": "5b85fa10-c03f-4942-a227-02d1cbe90f4a",
962
+ "metadata": {
963
+ "tags": []
964
+ },
965
+ "outputs": [],
966
+ "source": [
967
+ "!pip install torch==1.10.0"
968
+ ]
969
+ },
970
+ {
971
+ "cell_type": "code",
972
+ "execution_count": null,
973
+ "id": "abc7178a-c5b7-4722-8e9e-728308d83d70",
974
+ "metadata": {
975
+ "tags": []
976
+ },
977
+ "outputs": [],
978
+ "source": [
979
+ "!pip install xformers==0.0.20 tomesd==0.1.3 pytorch-lightning==1.9.4 accelerate==0.21.0"
980
+ ]
981
+ },
982
+ {
983
+ "cell_type": "code",
984
+ "execution_count": null,
985
+ "id": "577b9843-0e8c-4dd8-aa02-8eaf8c51f1d8",
986
+ "metadata": {
987
+ "tags": []
988
+ },
989
+ "outputs": [],
990
+ "source": [
991
+ "!conda install -c conda-forge libglib -y"
992
+ ]
993
+ },
994
+ {
995
+ "cell_type": "code",
996
+ "execution_count": null,
997
+ "id": "f24321a3-700a-47e9-8995-0893dd2f834f",
998
+ "metadata": {},
999
+ "outputs": [],
1000
+ "source": [
1001
+ "import os\n",
1002
+ "import zipfile\n",
1003
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other, https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor'\n",
1004
+ "url_list = embeddings_zip_url.split(\", \")\n",
1005
+ "for url in url_list:\n",
1006
+ " !curl -Lo /home/studio-lab-user/stable-diffusion-webui/models/new {url}\n",
1007
+ "current_dir = '/home/studio-lab-user/stable-diffusion-webui/models/new'\n",
1008
+ "for entry in os.scandir(current_dir):\n",
1009
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
1010
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
1011
+ " zip_ref.extractall(current_dir)\n",
1012
+ "!rm /home/studio-lab-user/stable-diffusion-webui/models/new*.zip"
1013
+ ]
1014
+ },
1015
+ {
1016
+ "cell_type": "code",
1017
+ "execution_count": null,
1018
+ "id": "c830ad32-b536-434f-ae9e-7bf845acd15e",
1019
+ "metadata": {
1020
+ "tags": []
1021
+ },
1022
+ "outputs": [],
1023
+ "source": [
1024
+ "import os\n",
1025
+ "import zipfile\n",
1026
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/42247?type=Model&format=Other, https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor'\n",
1027
+ "url_list = embeddings_zip_url.split(\", \")\n",
1028
+ "for url in url_list:\n",
1029
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /home/studio-lab-user/stable-diffusion-webui/models/new {url}\n",
1030
+ "current_dir = '/home/studio-lab-user/stable-diffusion-webui/models/new'\n",
1031
+ "for entry in os.scandir(current_dir):\n",
1032
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
1033
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
1034
+ " zip_ref.extractall(current_dir)\n",
1035
+ "!rm /home/studio-lab-user/stable-diffusion-webui/models/new*.zip"
1036
+ ]
1037
+ },
1038
+ {
1039
+ "cell_type": "code",
1040
+ "execution_count": null,
1041
+ "id": "28f19aa6-a322-4bbb-bcaa-fccf89e0b174",
1042
+ "metadata": {},
1043
+ "outputs": [],
1044
+ "source": []
1045
+ }
1046
+ ],
1047
+ "metadata": {
1048
+ "kernelspec": {
1049
+ "display_name": "default:Python",
1050
+ "language": "python",
1051
+ "name": "conda-env-default-py"
1052
+ },
1053
+ "language_info": {
1054
+ "codemirror_mode": {
1055
+ "name": "ipython",
1056
+ "version": 3
1057
+ },
1058
+ "file_extension": ".py",
1059
+ "mimetype": "text/x-python",
1060
+ "name": "python",
1061
+ "nbconvert_exporter": "python",
1062
+ "pygments_lexer": "ipython3",
1063
+ "version": "3.9.16"
1064
+ }
1065
+ },
1066
+ "nbformat": 4,
1067
+ "nbformat_minor": 5
1068
+ }
Sagemaker_Notebook.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
StableDiffusionWebUI-SageMaker-pinggy,zrok.ipynb ADDED
@@ -0,0 +1,595 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "cde84736-33ea-41fb-97d6-801331d0cf88",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Automatic1111's Stable Diffusion WebUI - SageMaker Studio Lab Notebook\n",
9
+ "\n",
10
+ "This notebook on GitHub: https://github.com/wandaweb/stable-diffusion-webui-sagemaker \n",
11
+ "Automatic1111's WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui \n",
12
+ "\n",
13
+ "---\n",
14
+ "Connect with us for updates! - https://pogscafe.bio.link"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "markdown",
19
+ "id": "f137a625-b2e1-48d4-b115-74ff2fb0585a",
20
+ "metadata": {},
21
+ "source": [
22
+ "## Installation"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 2,
28
+ "id": "b4e76687-4bd8-4c44-92d5-780c78741a1f",
29
+ "metadata": {
30
+ "collapsed": true,
31
+ "jupyter": {
32
+ "outputs_hidden": true
33
+ },
34
+ "tags": []
35
+ },
36
+ "outputs": [
37
+ {
38
+ "name": "stdout",
39
+ "output_type": "stream",
40
+ "text": [
41
+ "fatal: destination path 'stable-diffusion-webui' already exists and is not an empty directory.\n",
42
+ "/home/studio-lab-user/Auto1111/stable-diffusion-webui\n",
43
+ "HEAD is now at adadb4e3 Merge branch 'release_candidate'\n",
44
+ "\u001b[31mERROR: Could not open requirements file: [Errno 2] No such file or directory: '-q'\u001b[0m\n",
45
+ "Collecting package metadata (current_repodata.json): done\n",
46
+ "Solving environment: done\n",
47
+ "\n",
48
+ "\n",
49
+ "==> WARNING: A newer version of conda exists. <==\n",
50
+ " current version: 4.10.3\n",
51
+ " latest version: 24.3.0\n",
52
+ "\n",
53
+ "Please update conda by running\n",
54
+ "\n",
55
+ " $ conda update -n base conda\n",
56
+ "\n",
57
+ "\n",
58
+ "\n",
59
+ "# All requested packages already installed.\n",
60
+ "\n"
61
+ ]
62
+ }
63
+ ],
64
+ "source": [
65
+ "!mkdir /home/studio-lab-user/Auto1111\n",
66
+ "%cd /home/studio-lab-user/Auto1111\n",
67
+ "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
68
+ "%cd stable-diffusion-webui\n",
69
+ "!git checkout tags/v1.9.0 # Remove this line to use the latest code\n",
70
+ "!pip install -r -q requirements.txt\n",
71
+ "!conda install -y conda-forge::glib"
72
+ ]
73
+ },
74
+ {
75
+ "cell_type": "code",
76
+ "execution_count": 3,
77
+ "id": "c12a9940-8c09-4a1b-8ae0-c2ab77adb291",
78
+ "metadata": {
79
+ "collapsed": true,
80
+ "jupyter": {
81
+ "outputs_hidden": true
82
+ },
83
+ "tags": []
84
+ },
85
+ "outputs": [
86
+ {
87
+ "name": "stdout",
88
+ "output_type": "stream",
89
+ "text": [
90
+ "Python 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:39:03) \n",
91
+ "[GCC 11.3.0]\n",
92
+ "Version: v1.9.0\n",
93
+ "Commit hash: adadb4e3c7382bf3e4f7519126cd6c70f4f8557b\n",
94
+ "Launching Web UI with arguments: --skip-torch-cuda-test --share\n",
95
+ "no module 'xformers'. Processing without...\n",
96
+ "no module 'xformers'. Processing without...\n",
97
+ "No module 'xformers'. Proceeding without it.\n",
98
+ "Loading weights [6ce0161689] from /home/studio-lab-user/Auto1111/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors\n",
99
+ "Running on local URL: http://127.0.0.1:7860\n",
100
+ "Creating model from config: /home/studio-lab-user/Auto1111/stable-diffusion-webui/configs/v1-inference.yaml\n",
101
+ "Applying attention optimization: Doggettx... done.\n",
102
+ "Model loaded in 34.3s (load weights from disk: 1.5s, create model: 0.5s, apply weights to model: 31.2s, apply half(): 0.1s, load textual inversion embeddings: 0.4s, calculate empty prompt: 0.5s).\n",
103
+ "^C\n",
104
+ "Interrupted with signal 2 in <frame at 0x559a1d073680, file '/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/gradio/tunneling.py', line 95, code _start_tunnel>\n"
105
+ ]
106
+ }
107
+ ],
108
+ "source": [
109
+ "#!python launch.py --skip-torch-cuda-test --share # This won't work"
110
+ ]
111
+ },
112
+ {
113
+ "cell_type": "markdown",
114
+ "id": "d7eea923-e295-4eac-8b55-ecf774741aae",
115
+ "metadata": {},
116
+ "source": [
117
+ "## Download a model to the temporary folder\n",
118
+ "\n",
119
+ "How to download any model from CivitAI - https://youtu.be/mbNZ5AWy0sc"
120
+ ]
121
+ },
122
+ {
123
+ "cell_type": "code",
124
+ "execution_count": 9,
125
+ "id": "c51281d5-fbfb-42ed-8b34-c79ab58c6e0b",
126
+ "metadata": {
127
+ "collapsed": true,
128
+ "jupyter": {
129
+ "outputs_hidden": true
130
+ },
131
+ "tags": []
132
+ },
133
+ "outputs": [
134
+ {
135
+ "name": "stdout",
136
+ "output_type": "stream",
137
+ "text": [
138
+ "--2024-04-18 09:50:50-- https://civitai-delivery-worker-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com/model/2896350/wildcardxXLFusion.d8pf.safetensors?X-Amz-Expires=86400&response-content-disposition=attachment%3B%20filename%3D%22wildcardxXLFusion_fusionOG.safetensors%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=e01358d793ad6966166af8b3064953ad/20240418/us-east-1/s3/aws4_request&X-Amz-Date=20240418T094733Z&X-Amz-SignedHeaders=host&X-Amz-Signature=1f37579eb6cee65e1fa0667a7f88ecc1db5af3043ce0197a666f7f9dd74b7ed3\n",
139
+ "Resolving civitai-delivery-worker-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com (civitai-delivery-worker-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com)... 104.18.8.90, 104.18.9.90, 2606:4700::6812:95a, ...\n",
140
+ "Connecting to civitai-delivery-worker-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com (civitai-delivery-worker-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com)|104.18.8.90|:443... connected.\n",
141
+ "HTTP request sent, awaiting response... 200 OK\n",
142
+ "Length: 7105370872 (6.6G)\n",
143
+ "Saving to: '/tmp/model.safetensors'\n",
144
+ "\n",
145
+ "/tmp/model.safetens 100%[===================>] 6.62G 44.8MB/s in 2m 29s \n",
146
+ "\n",
147
+ "2024-04-18 09:53:19 (45.4 MB/s) - '/tmp/model.safetensors' saved [7105370872/7105370872]\n",
148
+ "\n"
149
+ ]
150
+ }
151
+ ],
152
+ "source": [
153
+ "!wget \"https://civitai.com/api/download/models/456751\" \\\n",
154
+ " -O /tmp/model.safetensors\n",
155
+ "!ln -s /tmp/model.safetensors /home/studio-lab-user/Auto1111/stable-diffusion-webui/models/Stable-diffusion/"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "id": "43c5d45d-40f0-465c-88a8-a525af3fa57a",
161
+ "metadata": {},
162
+ "source": [
163
+ "# Start with Pinggy"
164
+ ]
165
+ },
166
+ {
167
+ "cell_type": "code",
168
+ "execution_count": null,
169
+ "id": "e55f7804-de11-4a70-a489-d11177449346",
170
+ "metadata": {},
171
+ "outputs": [],
172
+ "source": [
173
+ "# Install SSH (only needs to run once)\n",
174
+ "!conda config --add channels conda-forge\n",
175
+ "!conda config --set channel_priority strict\n",
176
+ "!conda install -y openssh"
177
+ ]
178
+ },
179
+ {
180
+ "cell_type": "code",
181
+ "execution_count": 10,
182
+ "id": "856cc160-1cbf-408a-9298-a88ca4115de8",
183
+ "metadata": {
184
+ "collapsed": true,
185
+ "jupyter": {
186
+ "outputs_hidden": true
187
+ },
188
+ "tags": []
189
+ },
190
+ "outputs": [
191
+ {
192
+ "name": "stdout",
193
+ "output_type": "stream",
194
+ "text": [
195
+ "/home/studio-lab-user/Auto1111/stable-diffusion-webui\n",
196
+ "waiting for output\n",
197
+ "Python 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:39:03) \n",
198
+ "[GCC 11.3.0]\n",
199
+ "Version: v1.9.0\n",
200
+ "Commit hash: adadb4e3c7382bf3e4f7519126cd6c70f4f8557b\n",
201
+ "Launching Web UI with arguments: --skip-torch-cuda-test\n",
202
+ "Allocated port 6 for remote forward to localhost:7860\n",
203
+ "😁 😁 😁\n",
204
+ "URL: http://rnaup-3-20-229-229.a.free.pinggy.link\n",
205
+ "😁 😁 😁\n",
206
+ "\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006l\u001b[?2004l\u001b7\u001b[?47h\u001b[?1h\u001b=\u001b)0\u001b[H\u001b[2J\u001b[25;81H\u001b[1;1H\u001b[m\u001b]8;;\u001b\\ \u001b[2;1H \u001b[3;1H \u001b[4;1H \u001b[5;1H \u001b[6;1H \u001b[7;1H \u001b[8;1H \u001b[9;1H ┌────────────────────────────┐ \u001b[10;1H │ │ \u001b[11;1H │ Wait while we prepare the │ \u001b[12;1H │ UI │ \u001b[13;1H │ │ \u001b[14;1H │ │ \u001b[15;1H │ │ \u001b[16;1H └────────────────────────────┘ \u001b[17;1H \u001b[18;1H \u001b[19;1H \u001b[20;1H \u001b[21;1H \u001b[22;1H \u001b[23;1H \u001b[24;1H \u001b[25;81H\u001b[25;81H\u001b[25;81H\u001b[25;81H\u001b[m\u001b]8;;\u001b\\\u001b[H\u001b[2J\u001b[9;26H\u001b[m\u001b]8;;\u001b\\┌────────────────────────────┐\u001b[10;26H│\u001b[10;55H│\u001b[11;26H│\u001b[11;28HWait\u001b[11;33Hwhile\u001b[11;39Hwe\u001b[11;42Hprepare\u001b[11;50Hthe\u001b[11;55H│\u001b[12;26H│\u001b[12;40HUI\u001b[12;55H│\u001b[13;26H│\u001b[13;55H│\u001b[14;26H│\u001b[14;55H│\u001b[15;26H│\u001b[15;55H│\u001b[16;26H└────────────────────────────┘\u001b[25;81H\u001b[25;81H\u001b[1;28H\u001b[m\u001b]8;;\u001b\\You\u001b[1;32Hare\u001b[1;36Hnot\u001b[1;40Hauthenticated.\u001b[2;1HYour\u001b[2;6Htunnel\u001b[2;13Hwill\u001b[2;18Hexpire\u001b[2;25Hin\u001b[2;28H60\u001b[2;31Hminutes.\u001b[2;40HUpgrade\u001b[2;48Hto\u001b[2;51HPinggy\u001b[2;58HPro\u001b[2;62Hto\u001b[2;65Hget\u001b[2;69Hunrestricted\u001b[3;23Htunnels.\u001b[3;32Hhttps://dashboard.pinggy.io\u001b[5;4Hhttp://rnaup-3-20-229-229.a.free.pinggy.link\u001b[6;4Hhttps://rnaup-3-20-229-229.a.free.pinggy.link\u001b[9;26H \u001b[10;26H \u001b[10;55H \u001b[11;26H \u001b[11;28H \u001b[11;33H \u001b[11;39H \u001b[11;42H \u001b[11;50H \u001b[11;55H \u001b[12;26H \u001b[12;40H \u001b[12;55H \u001b[13;26H \u001b[13;55H \u001b[14;26H \u001b[14;55H \u001b[15;26H \u001b[15;55H \u001b[16;26H \u001b[24;28HPress\u001b[24;34H`h`\u001b[24;38Hfor\u001b[24;42Hkeybindings\u001b[25;81H\u001b[25;81H\u001b[25;81H\n",
207
+ "connect_to localhost port 7860: failed.\n",
208
+ "connect_to localhost port 7860: failed.\n",
209
+ "connect_to localhost port 7860: failed.\n",
210
+ "connect_to localhost port 7860: failed.\n",
211
+ "no module 'xformers'. Processing without...\n",
212
+ "no module 'xformers'. Processing without...\n",
213
+ "No module 'xformers'. Proceeding without it.\n",
214
+ "Calculating sha256 for /home/studio-lab-user/Auto1111/stable-diffusion-webui/models/Stable-diffusion/model.safetensors: Running on local URL: http://127.0.0.1:7860\n",
215
+ "\n",
216
+ "To create a public link, set `share=True` in `launch()`.\n",
217
+ "Startup time: 20.2s (prepare environment: 0.2s, import torch: 9.5s, import gradio: 2.2s, setup paths: 5.1s, initialize shared: 0.6s, other imports: 1.4s, load scripts: 0.4s, create ui: 0.6s, gradio launch: 0.1s).\n",
218
+ "changing setting sd_model_checkpoint to model.safetensors: AttributeError\n",
219
+ "Traceback (most recent call last):\n",
220
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/options.py\", line 165, in set\n",
221
+ " option.onchange()\n",
222
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/call_queue.py\", line 13, in f\n",
223
+ " res = func(*args, **kwargs)\n",
224
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/initialize_util.py\", line 181, in <lambda>\n",
225
+ " shared.opts.onchange(\"sd_model_checkpoint\", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)\n",
226
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/sd_models.py\", line 860, in reload_model_weights\n",
227
+ " sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer)\n",
228
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/sd_models.py\", line 793, in reuse_model_from_already_loaded\n",
229
+ " send_model_to_cpu(sd_model)\n",
230
+ " File \"/home/studio-lab-user/Auto1111/stable-diffusion-webui/modules/sd_models.py\", line 662, in send_model_to_cpu\n",
231
+ " if m.lowvram:\n",
232
+ "AttributeError: 'NoneType' object has no attribute 'lowvram'\n",
233
+ "\n",
234
+ "22ebc61141bb5afbe0520ceb498cbdfea747096b88438e13837485466ce9b972\n",
235
+ "Loading weights [22ebc61141] from /home/studio-lab-user/Auto1111/stable-diffusion-webui/models/Stable-diffusion/model.safetensors\n",
236
+ "Creating model from config: /home/studio-lab-user/Auto1111/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml\n",
237
+ "vocab.json: 100%|████████████████████████████| 961k/961k [00:00<00:00, 38.0MB/s]\n",
238
+ "merges.txt: 100%|████████████████████████████| 525k/525k [00:00<00:00, 22.0MB/s]\n",
239
+ "special_tokens_map.json: 100%|██████████████████| 389/389 [00:00<00:00, 244kB/s]\n",
240
+ "tokenizer_config.json: 100%|████████████████████| 905/905 [00:00<00:00, 570kB/s]\n",
241
+ "config.json: 100%|██████████████████████████| 4.52k/4.52k [00:00<00:00, 773kB/s]\n",
242
+ "Applying attention optimization: Doggettx... done.\n",
243
+ "Model loaded in 26.5s (calculate hash: 20.7s, create model: 1.2s, apply weights to model: 2.7s, apply half(): 0.1s, load textual inversion embeddings: 0.6s, calculate empty prompt: 1.0s).\n",
244
+ "Downloading VAEApprox model to: /home/studio-lab-user/Auto1111/stable-diffusion-webui/models/VAE-approx/vaeapprox-sdxl.pt\n",
245
+ "100%|████████████████████████████████████████| 209k/209k [00:00<00:00, 63.2MB/s]\n",
246
+ " 0%| | 0/20 [00:00<?, ?it/s]\n",
247
+ " 5%|██▏ | 1/20 [00:01<00:29, 1.55s/it]\u001b[A\n",
248
+ " 10%|████▍ | 2/20 [00:01<00:13, 1.29it/s]\u001b[A\n",
249
+ " 15%|██████▌ | 3/20 [00:02<00:08, 1.91it/s]\u001b[A\n",
250
+ " 20%|████████▊ | 4/20 [00:02<00:06, 2.45it/s]\u001b[A\n",
251
+ " 25%|███████████ | 5/20 [00:02<00:05, 2.91it/s]\u001b[A\n",
252
+ " 30%|█████████████▏ | 6/20 [00:02<00:04, 3.28it/s]\u001b[A\n",
253
+ " 35%|███████████████▍ | 7/20 [00:02<00:03, 3.57it/s]\u001b[A\n",
254
+ " 40%|█████████████████▌ | 8/20 [00:03<00:03, 3.79it/s]\u001b[A\n",
255
+ " 45%|███████████████████▊ | 9/20 [00:03<00:02, 3.95it/s]\u001b[A\n",
256
+ " 50%|█████████████████████▌ | 10/20 [00:03<00:02, 4.07it/s]\u001b[A\n",
257
+ " 55%|███████████████████████▋ | 11/20 [00:03<00:02, 4.17it/s]\u001b[A\n",
258
+ " 60%|█████████████████████████▊ | 12/20 [00:04<00:01, 4.23it/s]\u001b[A\n",
259
+ " 65%|███████████████████████████▉ | 13/20 [00:04<00:01, 4.28it/s]\u001b[A\n",
260
+ " 70%|██████████████████████████████ | 14/20 [00:04<00:01, 4.26it/s]\u001b[A\n",
261
+ " 75%|████████████████████████████████▎ | 15/20 [00:04<00:01, 4.23it/s]\u001b[A\n",
262
+ " 80%|██████████████████████████████████▍ | 16/20 [00:05<00:00, 4.27it/s]\u001b[A\n",
263
+ " 85%|████████████████████████████████████▌ | 17/20 [00:05<00:00, 4.29it/s]\u001b[A\n",
264
+ " 90%|██████████████████████████████████████▋ | 18/20 [00:05<00:00, 4.31it/s]\u001b[A\n",
265
+ " 95%|████████████████████████████████████████▊ | 19/20 [00:05<00:00, 4.32it/s]\u001b[A\n",
266
+ "100%|███████████████████████████████████████████| 20/20 [00:05<00:00, 3.38it/s]\u001b[A\n",
267
+ "==========================================================================================\n",
268
+ "A tensor with all NaNs was produced in VAE.\n",
269
+ "Web UI will now convert VAE into 32-bit float and retry.\n",
270
+ "To disable this behavior, disable the 'Automatically revert VAE to 32-bit floats' setting.\n",
271
+ "To always start with 32-bit VAE, use --no-half-vae commandline flag.\n",
272
+ "==========================================================================================\n",
273
+ "\n",
274
+ "Total progress: 100%|███████████████████████████| 20/20 [00:05<00:00, 3.83it/s]\u001b[A\n",
275
+ " 0%| | 0/50 [00:00<?, ?it/s]\n",
276
+ " 2%|▉ | 1/50 [00:01<00:50, 1.02s/it]\u001b[A\n",
277
+ " 4%|█▊ | 2/50 [00:02<00:48, 1.01s/it]\u001b[A\n",
278
+ " 6%|██▋ | 3/50 [00:03<00:47, 1.00s/it]\u001b[A\n",
279
+ " 8%|███▌ | 4/50 [00:04<00:45, 1.00it/s]\u001b[A\n",
280
+ " 10%|████▍ | 5/50 [00:05<00:44, 1.00it/s]\u001b[A\n",
281
+ " 12%|█████▎ | 6/50 [00:06<00:43, 1.00it/s]\u001b[A\n",
282
+ " 14%|██████▏ | 7/50 [00:06<00:42, 1.00it/s]\u001b[A\n",
283
+ " 16%|███████ | 8/50 [00:08<00:41, 1.00it/s]\u001b[A\n",
284
+ " 18%|███████▉ | 9/50 [00:09<00:40, 1.00it/s]\u001b[A\n",
285
+ " 20%|████████▌ | 10/50 [00:10<00:39, 1.00it/s]\u001b[A\n",
286
+ " 22%|█████████▍ | 11/50 [00:11<00:39, 1.00s/it]\u001b[A\n",
287
+ " 24%|██████████▎ | 12/50 [00:12<00:38, 1.00s/it]\u001b[A\n",
288
+ " 26%|███████████▏ | 13/50 [00:13<00:37, 1.00s/it]\u001b[A\n",
289
+ " 28%|████████████ | 14/50 [00:14<00:36, 1.01s/it]\u001b[A\n",
290
+ " 30%|████████████▉ | 15/50 [00:15<00:35, 1.00s/it]\u001b[A\n",
291
+ " 32%|█████████████▊ | 16/50 [00:16<00:34, 1.01s/it]\u001b[A\n",
292
+ " 34%|██████████████▌ | 17/50 [00:17<00:33, 1.00s/it]\u001b[A\n",
293
+ " 36%|███████████████▍ | 18/50 [00:18<00:32, 1.00s/it]\u001b[A\n",
294
+ " 38%|████████████████▎ | 19/50 [00:19<00:30, 1.00it/s]\u001b[A\n",
295
+ " 40%|█████████████████▏ | 20/50 [00:20<00:29, 1.00it/s]\u001b[A\n",
296
+ " 42%|██████████████████ | 21/50 [00:21<00:28, 1.00it/s]\u001b[A\n",
297
+ " 44%|██████████████████▉ | 22/50 [00:22<00:27, 1.00it/s]\u001b[A\n",
298
+ " 46%|███████████████████▊ | 23/50 [00:23<00:26, 1.00it/s]\u001b[A\n",
299
+ " 48%|████████████████████▋ | 24/50 [00:24<00:25, 1.00it/s]\u001b[A\n",
300
+ " 50%|█████████████████████▌ | 25/50 [00:25<00:24, 1.00it/s]\u001b[A\n",
301
+ " 52%|██████████████████████▎ | 26/50 [00:26<00:23, 1.00it/s]\u001b[A\n",
302
+ " 54%|███████████████████████▏ | 27/50 [00:27<00:22, 1.00it/s]\u001b[A\n",
303
+ " 56%|████████████████████████ | 28/50 [00:28<00:21, 1.00it/s]\u001b[A\n",
304
+ " 58%|████████████████████████▉ | 29/50 [00:29<00:20, 1.00it/s]\u001b[A\n",
305
+ " 60%|█████████████████████████▊ | 30/50 [00:30<00:20, 1.00s/it]\u001b[A\n",
306
+ " 62%|██████████████████████████▋ | 31/50 [00:31<00:19, 1.00s/it]\u001b[A\n",
307
+ " 64%|███████████████████████████▌ | 32/50 [00:32<00:18, 1.00s/it]\u001b[A\n",
308
+ " 66%|████████████████████████████▍ | 33/50 [00:33<00:17, 1.00s/it]\u001b[A\n",
309
+ " 68%|█████████████████████████████▏ | 34/50 [00:34<00:16, 1.00s/it]\u001b[A\n",
310
+ " 70%|██████████████████████████████ | 35/50 [00:35<00:15, 1.00s/it]\u001b[A\n",
311
+ " 72%|██████████████████████████████▉ | 36/50 [00:36<00:14, 1.00s/it]\u001b[A\n",
312
+ " 74%|███████████████████████████████▊ | 37/50 [00:37<00:13, 1.00s/it]\u001b[A\n",
313
+ " 76%|████████████████████████████████▋ | 38/50 [00:38<00:12, 1.01s/it]\u001b[A\n",
314
+ " 78%|█████████████████████████████████▌ | 39/50 [00:39<00:11, 1.01s/it]\u001b[A\n",
315
+ " 80%|██████████████████████████████████▍ | 40/50 [00:40<00:10, 1.01s/it]\u001b[A\n",
316
+ " 82%|███████████████████████████████████▎ | 41/50 [00:41<00:09, 1.01s/it]\u001b[A\n",
317
+ " 84%|████████████████████████████████████ | 42/50 [00:42<00:08, 1.01s/it]\u001b[A\n",
318
+ " 86%|████████████████████████████████████▉ | 43/50 [00:43<00:07, 1.01s/it]\u001b[A\n",
319
+ " 88%|█████████████████████████████████████▊ | 44/50 [00:44<00:06, 1.01s/it]\u001b[A\n",
320
+ " 90%|██████████████████████████████████████▋ | 45/50 [00:45<00:05, 1.01s/it]\u001b[A\n",
321
+ " 92%|███████████████████████████████████████▌ | 46/50 [00:46<00:04, 1.01s/it]\u001b[A\n",
322
+ " 94%|████████████████████████████████████████▍ | 47/50 [00:47<00:03, 1.01s/it]\u001b[A\n",
323
+ " 96%|█████████████████████████████████████████▎ | 48/50 [00:48<00:02, 1.01s/it]\u001b[A\n",
324
+ " 98%|██████████████████████████████████████████▏| 49/50 [00:49<00:01, 1.01s/it]\u001b[A\n",
325
+ "100%|███████████████████████████████████████████| 50/50 [00:50<00:00, 1.00s/it]\u001b[A\n",
326
+ "\n",
327
+ "Total progress: 100%|███████████████████████████| 50/50 [00:51<00:00, 1.03s/it]\u001b[A\n",
328
+ " 0%| | 0/50 [00:00<?, ?it/s]\n",
329
+ " 2%|▉ | 1/50 [00:01<00:50, 1.04s/it]\u001b[A\n",
330
+ " 4%|█▊ | 2/50 [00:02<00:48, 1.02s/it]\u001b[A\n",
331
+ " 6%|██▋ | 3/50 [00:03<00:47, 1.01s/it]\u001b[A\n",
332
+ " 8%|███▌ | 4/50 [00:04<00:46, 1.00s/it]\u001b[A\n",
333
+ " 10%|████▍ | 5/50 [00:05<00:45, 1.00s/it]\u001b[A\n",
334
+ " 12%|█████▎ | 6/50 [00:06<00:43, 1.00it/s]\u001b[A\n",
335
+ " 14%|██████▏ | 7/50 [00:07<00:42, 1.00it/s]\u001b[A\n",
336
+ " 16%|███████ | 8/50 [00:08<00:41, 1.00it/s]\u001b[A\n",
337
+ " 18%|███████▉ | 9/50 [00:09<00:40, 1.00it/s]\u001b[A\n",
338
+ " 20%|████████▌ | 10/50 [00:10<00:39, 1.00it/s]\u001b[A\n",
339
+ " 22%|█████████▍ | 11/50 [00:11<00:38, 1.00it/s]\u001b[A\n",
340
+ " 24%|██████████▎ | 12/50 [00:12<00:37, 1.00it/s]\u001b[A\n",
341
+ " 26%|███████████▏ | 13/50 [00:13<00:37, 1.00s/it]\u001b[A\n",
342
+ " 28%|████████████ | 14/50 [00:14<00:36, 1.00s/it]\u001b[A\n",
343
+ " 30%|████████████▉ | 15/50 [00:15<00:35, 1.00s/it]\u001b[A\n",
344
+ " 32%|█████████████▊ | 16/50 [00:16<00:34, 1.00s/it]\u001b[A\n",
345
+ " 34%|██████████████▌ | 17/50 [00:17<00:33, 1.00s/it]\u001b[A\n",
346
+ " 36%|███████████████▍ | 18/50 [00:18<00:32, 1.01s/it]\u001b[A\n",
347
+ " 38%|████████████████▎ | 19/50 [00:19<00:31, 1.00s/it]\u001b[A\n",
348
+ " 40%|█████████████████▏ | 20/50 [00:20<00:30, 1.01s/it]\u001b[A\n",
349
+ " 42%|██████████████████ | 21/50 [00:21<00:29, 1.01s/it]\u001b[A\n",
350
+ " 44%|██████████████████▉ | 22/50 [00:22<00:28, 1.01s/it]\u001b[A\n",
351
+ " 46%|███████████████████▊ | 23/50 [00:23<00:27, 1.01s/it]\u001b[A\n",
352
+ " 48%|████████████████████▋ | 24/50 [00:24<00:26, 1.01s/it]\u001b[A\n",
353
+ " 50%|█████████████████████▌ | 25/50 [00:25<00:25, 1.01s/it]\u001b[A\n",
354
+ " 52%|██████████████████████▎ | 26/50 [00:26<00:24, 1.01s/it]\u001b[A\n",
355
+ " 54%|███████████████████████��� | 27/50 [00:27<00:23, 1.01s/it]\u001b[A\n",
356
+ " 56%|████████████████████████ | 28/50 [00:28<00:22, 1.01s/it]\u001b[A\n",
357
+ " 58%|████████████████████████▉ | 29/50 [00:29<00:21, 1.01s/it]\u001b[A\n",
358
+ " 60%|█████████████████████████▊ | 30/50 [00:30<00:20, 1.01s/it]\u001b[A\n",
359
+ " 62%|██████████████████████████▋ | 31/50 [00:31<00:19, 1.01s/it]\u001b[A\n",
360
+ " 64%|███████████████████████████▌ | 32/50 [00:32<00:18, 1.01s/it]\u001b[A\n",
361
+ " 66%|████████████████████████████▍ | 33/50 [00:33<00:17, 1.01s/it]\u001b[A\n",
362
+ " 68%|█████████████████████████████▏ | 34/50 [00:34<00:16, 1.01s/it]\u001b[A\n",
363
+ " 70%|██████████████████████████████ | 35/50 [00:35<00:15, 1.01s/it]\u001b[A\n",
364
+ " 72%|██████████████████████████████▉ | 36/50 [00:36<00:14, 1.01s/it]\u001b[A\n",
365
+ " 74%|███████████████████████████████▊ | 37/50 [00:37<00:13, 1.01s/it]\u001b[A\n",
366
+ " 76%|████████████████████████████████▋ | 38/50 [00:38<00:12, 1.01s/it]\u001b[A\n",
367
+ " 78%|█████████████████████████████████▌ | 39/50 [00:39<00:11, 1.01s/it]\u001b[A\n",
368
+ " 80%|██████████████████████████████████▍ | 40/50 [00:40<00:10, 1.01s/it]\u001b[A\n",
369
+ " 82%|███████████████████████████████████▎ | 41/50 [00:41<00:09, 1.01s/it]\u001b[A\n",
370
+ " 84%|████████████████████████████████████ | 42/50 [00:42<00:08, 1.01s/it]\u001b[A\n",
371
+ " 86%|████████████████████████████████████▉ | 43/50 [00:43<00:07, 1.02s/it]\u001b[A\n",
372
+ " 88%|█████████████████████████████████████▊ | 44/50 [00:44<00:06, 1.01s/it]\u001b[A\n",
373
+ " 90%|██████████████████████████████████████▋ | 45/50 [00:45<00:05, 1.01s/it]\u001b[A\n",
374
+ " 92%|███████████████████████████████████████▌ | 46/50 [00:46<00:04, 1.00s/it]\u001b[A\n",
375
+ " 94%|████████████████████████████████████████▍ | 47/50 [00:47<00:03, 1.00s/it]\u001b[A\n",
376
+ " 96%|█████████████████████████████████████████▎ | 48/50 [00:48<00:02, 1.00s/it]\u001b[A\n",
377
+ " 98%|██████████████████████████████████████████▏| 49/50 [00:49<00:01, 1.00s/it]\u001b[A\n",
378
+ "100%|███████████████████████████████████████████| 50/50 [00:50<00:00, 1.01s/it]\u001b[A\n",
379
+ "\n",
380
+ "Total progress: 100%|███████████████████████████| 50/50 [00:51<00:00, 1.03s/it]\u001b[A\n"
381
+ ]
382
+ },
383
+ {
384
+ "ename": "KeyboardInterrupt",
385
+ "evalue": "",
386
+ "output_type": "error",
387
+ "traceback": [
388
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
389
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
390
+ "\u001b[0;32m/tmp/ipykernel_104/3317210253.py\u001b[0m in \u001b[0;36m<cell line: 45>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[0mp_app\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0mp_url\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 45\u001b[0;31m \u001b[0mp_app\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 46\u001b[0m \u001b[0mp_url\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
391
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/process.py\u001b[0m in \u001b[0;36mjoin\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 147\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_parent_pid\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetpid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'can only join a child process'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 148\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_popen\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'can only join a started process'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 149\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_popen\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 150\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 151\u001b[0m \u001b[0m_children\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdiscard\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
392
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/popen_fork.py\u001b[0m in \u001b[0;36mwait\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[0;31m# This shouldn't block if wait() returned successfully.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 43\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpoll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mWNOHANG\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtimeout\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0.0\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 44\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreturncode\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
393
+ "\u001b[0;32m~/.conda/envs/default/lib/python3.9/multiprocessing/popen_fork.py\u001b[0m in \u001b[0;36mpoll\u001b[0;34m(self, flag)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreturncode\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m \u001b[0mpid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwaitpid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mflag\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[0;31m# Child process not yet created. See #1731717\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
394
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
395
+ ]
396
+ },
397
+ {
398
+ "name": "stdout",
399
+ "output_type": "stream",
400
+ "text": [
401
+ "Connection to a.pinggy.io closed by remote host.\n",
402
+ "Connection to a.pinggy.io closed.\n"
403
+ ]
404
+ }
405
+ ],
406
+ "source": [
407
+ "# Start the WebUI with Pinggy\n",
408
+ "%cd /home/studio-lab-user/Auto1111/stable-diffusion-webui\n",
409
+ "command = 'python launch.py --skip-torch-cuda-test'\n",
410
+ "port = '7860'\n",
411
+ "# ------------------------\n",
412
+ "\n",
413
+ "from multiprocessing import Process\n",
414
+ "import sys\n",
415
+ "import time\n",
416
+ "\n",
417
+ "!touch log.txt\n",
418
+ "open('log.txt', 'w').close()\n",
419
+ "\n",
420
+ "def run_app():\n",
421
+ " get_ipython().system(f'{command} & ssh -o StrictHostKeyChecking=no -p 80 -R0:localhost:{port} a.pinggy.io > log.txt')\n",
422
+ " \n",
423
+ "def print_url():\n",
424
+ " print(\"waiting for output\")\n",
425
+ " time.sleep(2)\n",
426
+ " sys.stdout.flush()\n",
427
+ " \n",
428
+ " found = False\n",
429
+ " with open('log.txt', 'r') as file:\n",
430
+ " end_word = '.pinggy.link'\n",
431
+ " for line in file:\n",
432
+ " #print(line)\n",
433
+ " start_index = line.find('http:')\n",
434
+ " if start_index != -1:\n",
435
+ " end_index = line.find(end_word, start_index)\n",
436
+ " if end_index != -1:\n",
437
+ " print('😁 😁 😁')\n",
438
+ " print('URL: ' + line[start_index:end_index + len(end_word)])\n",
439
+ " print('😁 😁 😁')\n",
440
+ " found = True\n",
441
+ " if not found:\n",
442
+ " print_url()\n",
443
+ " else:\n",
444
+ " with open('log.txt', 'r') as file:\n",
445
+ " for line in file:\n",
446
+ " print(line)\n",
447
+ " \n",
448
+ "p_app = Process(target=run_app)\n",
449
+ "p_url = Process(target=print_url)\n",
450
+ "p_app.start()\n",
451
+ "p_url.start()\n",
452
+ "p_app.join()\n",
453
+ "p_url.join()"
454
+ ]
455
+ },
456
+ {
457
+ "cell_type": "markdown",
458
+ "id": "728f0f89-deb5-490c-8a0a-21190067fa68",
459
+ "metadata": {},
460
+ "source": [
461
+ "# Start with Zrok"
462
+ ]
463
+ },
464
+ {
465
+ "cell_type": "markdown",
466
+ "id": "f4391dac-9f37-4e87-bfcc-9d70b7c051ca",
467
+ "metadata": {},
468
+ "source": [
469
+ "### Install Zrok (only needs to run once)"
470
+ ]
471
+ },
472
+ {
473
+ "cell_type": "code",
474
+ "execution_count": null,
475
+ "id": "d3f761df-f02d-47d8-8588-b5118d11f8f1",
476
+ "metadata": {},
477
+ "outputs": [],
478
+ "source": [
479
+ "# Install Zrok (only needs to run once)\n",
480
+ "\n",
481
+ "!mkdir /home/studio-lab-user/zrok\n",
482
+ "%cd /home/studio-lab-user/zrok\n",
483
+ "!wget https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz\n",
484
+ "!tar -xvf ./zrok*.gz \n",
485
+ "!chmod a+x /home/studio-lab-user/zrok/zrok "
486
+ ]
487
+ },
488
+ {
489
+ "cell_type": "markdown",
490
+ "id": "bf602587-2ea5-4726-a662-3d89ec82cd97",
491
+ "metadata": {},
492
+ "source": [
493
+ "### Create a Zrok account\n",
494
+ "Enter your email address in the email variable"
495
+ ]
496
+ },
497
+ {
498
+ "cell_type": "code",
499
+ "execution_count": null,
500
+ "id": "80d0d756-9a6e-4aac-bdc7-4bee9647d528",
501
+ "metadata": {},
502
+ "outputs": [],
503
+ "source": [
504
+ "email = '####@gmail.com' # replace with your email\n",
505
+ "\n",
506
+ "cmd = '/home/studio-lab-user/zrok/zrok invite'\n",
507
+ "log = '/home/studio-lab-user/zrok/log.txt'\n",
508
+ "\n",
509
+ "!pip install pexpect\n",
510
+ "!touch $log\n",
511
+ "\n",
512
+ "import pexpect\n",
513
+ "import time\n",
514
+ "child = pexpect.spawn('bash')\n",
515
+ "child.sendline(f'{cmd} | tee {log}')\n",
516
+ "child.expect('enter and confirm your email address...')\n",
517
+ "time.sleep(1); child.sendline(email); time.sleep(1); child.send(chr(9)); time.sleep(1)\n",
518
+ "child.sendline(email); time.sleep(1); child.send('\\n'); time.sleep(1); child.send(chr(9))\n",
519
+ "time.sleep(1); child.send('\\r\\n'); time.sleep(2); child.close()\n",
520
+ "!cat $log\n",
521
+ "!rm $log"
522
+ ]
523
+ },
524
+ {
525
+ "cell_type": "markdown",
526
+ "id": "0fd14c5f-918c-4f99-8b82-f99780e39e48",
527
+ "metadata": {},
528
+ "source": [
529
+ "### Enable Zrok (only needs to run once)\n",
530
+ "Paste your Zrok token in the token variable"
531
+ ]
532
+ },
533
+ {
534
+ "cell_type": "code",
535
+ "execution_count": null,
536
+ "id": "b7befdfa-3c1b-41cc-9619-51f2c168bad9",
537
+ "metadata": {},
538
+ "outputs": [],
539
+ "source": [
540
+ "# Enable Zrok (only neeeds to run once)\n",
541
+ "# Paste your Zrok token in the token variable\n",
542
+ "\n",
543
+ "token = \"\"\n",
544
+ "\n",
545
+ "!/home/studio-lab-user/zrok/zrok enable $token"
546
+ ]
547
+ },
548
+ {
549
+ "cell_type": "markdown",
550
+ "id": "ce49c4d6-f959-4655-9832-d890746db1c0",
551
+ "metadata": {},
552
+ "source": [
553
+ "### Start the WebUI with Zrok"
554
+ ]
555
+ },
556
+ {
557
+ "cell_type": "code",
558
+ "execution_count": null,
559
+ "id": "a08e5d9b-4cea-4179-99ac-951ec9b6485e",
560
+ "metadata": {},
561
+ "outputs": [],
562
+ "source": [
563
+ "# Start the WebUI with Zrok\n",
564
+ "%cd /home/studio-lab-user/Auto1111/stable-diffusion-webui\n",
565
+ "command = 'python launch.py --skip-torch-cuda-test'\n",
566
+ "port = '7860'\n",
567
+ "# ------------------------\n",
568
+ "\n",
569
+ "cmd = f'{command} & /home/studio-lab-user/zrok/zrok share public http://localhost:{port} --headless'\n",
570
+ "get_ipython().system(cmd)"
571
+ ]
572
+ }
573
+ ],
574
+ "metadata": {
575
+ "kernelspec": {
576
+ "display_name": "default:Python",
577
+ "language": "python",
578
+ "name": "conda-env-default-py"
579
+ },
580
+ "language_info": {
581
+ "codemirror_mode": {
582
+ "name": "ipython",
583
+ "version": 3
584
+ },
585
+ "file_extension": ".py",
586
+ "mimetype": "text/x-python",
587
+ "name": "python",
588
+ "nbconvert_exporter": "python",
589
+ "pygments_lexer": "ipython3",
590
+ "version": "3.9.16"
591
+ }
592
+ },
593
+ "nbformat": 4,
594
+ "nbformat_minor": 5
595
+ }
automatic1111_fixv1_6_0_.ipynb ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "tIygNPKGLQl9"
7
+ },
8
+ "source": [
9
+ "# **Best SD colab by Yashraj ✌️✌️**"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": null,
15
+ "metadata": {
16
+ "cellView": "form",
17
+ "id": "uAb214siYuY-"
18
+ },
19
+ "outputs": [],
20
+ "source": [
21
+ "\n",
22
+ "#@markdown ****\n",
23
+ "\n",
24
+ "from IPython.display import clear_output, display, HTML\n",
25
+ "import os\n",
26
+ "import sys\n",
27
+ "import time\n",
28
+ "import subprocess\n",
29
+ "import shutil\n",
30
+ "from datetime import timedelta\n",
31
+ "from google.colab import drive\n",
32
+ "from IPython.utils import capture\n",
33
+ "from subprocess import getoutput\n",
34
+ "from urllib.parse import unquote\n",
35
+ "from google.colab.output import eval_js\n",
36
+ "from urllib.request import urlopen\n",
37
+ "import requests\n",
38
+ "\n",
39
+ "print('\u001b[1;92m')\n",
40
+ "mount_drive = True # @param {type:\"boolean\"}\n",
41
+ "%cd /content\n",
42
+ "print('\u001b[1;92m')\n",
43
+ "if mount_drive == True:\n",
44
+ " drive.mount('/content/drive')\n",
45
+ "else:\n",
46
+ " print(\"No GDrive Found!!\")\n",
47
+ "\n",
48
+ "if os.path.isdir('/content/Repo'):\n",
49
+ " shutil.rmtree('/content/Repo', ignore_errors=False, onerror=None)\n",
50
+ "else:\n",
51
+ " clear_output()\n",
52
+ "\n",
53
+ "print('\u001b[1;92m')\n",
54
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\"]\n",
55
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
56
+ "theme = 'catppuccin' #@param [\"None\",\"lobe\", \"catppuccin\",\"kitchen-theme\"]\n",
57
+ "\n",
58
+ "if os.path.isdir('/content/sd.net'):\n",
59
+ " shutil.rmtree('/content/sd.net', ignore_errors=False, onerror=None)\n",
60
+ " !git clone https://github.com/Ysb321/sd.net\n",
61
+ "else:\n",
62
+ " !git clone https://github.com/Ysb321/sd.net\n",
63
+ "\n",
64
+ "file = open('/content/sd.net/DataFiles/words.txt', 'r')\n",
65
+ "content = file.read()\n",
66
+ "words = content.split()\n",
67
+ "file.close()\n",
68
+ "url = f'https://github.com/{repo}/'\n",
69
+ "for word in words:\n",
70
+ " full_url = url + word\n",
71
+ "# Print the secret words\n",
72
+ "\n",
73
+ "clear_output()\n",
74
+ "\n",
75
+ "\n",
76
+ "%cd /content/\n",
77
+ "print('\u001b[1;92m')\n",
78
+ "if repo == 'automatic':\n",
79
+ " !git clone https://github.com/vladmandic/automatic Repo\n",
80
+ " !pip install -r /content/Repo/requirements.txt\n",
81
+ " clear_output()\n",
82
+ "elif repo == 'anapnoe':\n",
83
+ " !git clone {full_url}-ux Repo\n",
84
+ " !pip install -r requirements.txt\n",
85
+ " clear_output()\n",
86
+ "else:\n",
87
+ " !git clone {full_url} Repo\n",
88
+ " !pip install -r requirements.txt\n",
89
+ "clear_output()\n",
90
+ "\n",
91
+ "%cd /content/Repo\n",
92
+ "print('\u001b[1;92m')\n",
93
+ "!pip install wget\n",
94
+ "!pip install tqdm\n",
95
+ "!pip install pyngrok\n",
96
+ "!pip install cloudflare\n",
97
+ "!apt-get install aria2\n",
98
+ "!pip install pycloudflared\n",
99
+ "!pip install tntn\n",
100
+ "!pip install rarfile\n",
101
+ "!pip install fastapi==0.90\n",
102
+ "!pip install ultralytics==8.0.168\n",
103
+ "!apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev\n",
104
+ "clear_output()\n",
105
+ "def install_extensions():\n",
106
+ " print('\u001b[1;92m')\n",
107
+ " %cd /content/Repo/extensions-builtin/\n",
108
+ " !git clone https://github.com/Ysb321/sd-tunnels\n",
109
+ "\n",
110
+ " %cd /content/Repo/extensions/\n",
111
+ " print('\u001b[1;92m')\n",
112
+ " remove_ext = '/content/sd.net/DataFiles/RM ControlNet.txt'\n",
113
+ " base_directory = '/content/Repo/extensions-builtin/'\n",
114
+ " with open(remove_ext, 'r') as file:\n",
115
+ " folder_names = file.read().splitlines()\n",
116
+ " for folder_name in folder_names:\n",
117
+ " folder_path = os.path.join(base_directory, folder_name)\n",
118
+ " try:\n",
119
+ " shutil.rmtree(folder_path, ignore_errors=True)\n",
120
+ " print(f\"Folder '{folder_name}' removed successfully.\")\n",
121
+ " except Exception as e:\n",
122
+ " print(f\"Error occurred while removing folder '{folder_name}': {e}\")\n",
123
+ " print('\u001b[1;92m')\n",
124
+ " with open('/content/sd.net/DataFiles/Extension.txt', 'r') as file:\n",
125
+ " for line in file:\n",
126
+ " repo_url = line.strip()\n",
127
+ " !git clone $repo_url\n",
128
+ "\n",
129
+ "def clone_MiDaS():\n",
130
+ " print('\u001b[1;92m')\n",
131
+ " %cd /content/Repo/\n",
132
+ " !mkdir -p repositories\n",
133
+ " %cd /content/Repo/repositories\n",
134
+ " !git clone https://github.com/isl-org/MiDaS\n",
135
+ "def move_config_files():\n",
136
+ " print('\u001b[1;92m')\n",
137
+ " Start_with_ControlNet = \"Yes\" # @param [\"No\", \"Yes\", \"Download All\"]\n",
138
+ "\n",
139
+ " # Check if \"/content/Repo/ui-config.json\" exists and remove it if it does\n",
140
+ " if os.path.exists(\"/content/Repo/config.json\"):\n",
141
+ " os.remove(\"/content/Repo/config.json\")\n",
142
+ "\n",
143
+ " if Start_with_ControlNet == \"No\":\n",
144
+ "\n",
145
+ " print(\"No CN Models\")\n",
146
+ " elif Start_with_ControlNet == \"Yes\":\n",
147
+ " print('\u001b[1;92m')\n",
148
+ " name_i = 'sd-webui'\n",
149
+ " controlnet_url = 'https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors' # @param {'type': 'string'}\n",
150
+ " url_list = controlnet_url.split(\", \")\n",
151
+ " for url in url_list:\n",
152
+ " !wget --content-disposition -qq {url} -P /content/Repo/extensions/{name_i}-controlnet/models/\n",
153
+ " elif Start_with_ControlNet == \"Download All\":\n",
154
+ " name_i = 'sd-webui'\n",
155
+ " !wget --content-disposition -i /content/sd.net/DataFiles/CN.txt -P /content/Repo/extensions/{name_i}-controlnet/models/\n",
156
+ " else:\n",
157
+ " print(\"Invalid value for Start_with_ControlNet. Please choose either 'No' or 'Yes'.\")\n",
158
+ "\n",
159
+ " # Move \"/content/sd.net/SD Original/ui-config.json\" to \"/content/sd.a1111\"\n",
160
+ " shutil.copy2(\"/content/sd.net/styles.csv\", \"/content/Repo\")\n",
161
+ " shutil.copy2(\"/content/sd.net/SD Original/new2/config.json\", \"/content/Repo\")\n",
162
+ " shutil.copy2(\"/content/sd.net/SD Original/ui-config.json\", \"/content/Repo\")\n",
163
+ "\n",
164
+ "def lobe(repo, theme):\n",
165
+ " if repo == 'AUTOMATIC1111' and theme == 'lobe':\n",
166
+ " name_i = 'sd-webui'\n",
167
+ " !git clone https://github.com/lobehub/{name_i}-lobe-theme /content/Repo/extensions/lobe-theme\n",
168
+ " shutil.copy2(\"/content/sd.net/config.json\", \"/content/Repo\")\n",
169
+ " shutil.copy2(\"/content/sd.net/ui-config.json\", \"/content/Repo\")\n",
170
+ " elif repo == 'AUTOMATIC1111' and theme == 'catppuccin':\n",
171
+ " file = open('/content/sd.net/DataFiles/words.txt', 'r')\n",
172
+ " content = file.read()\n",
173
+ " words = content.split()\n",
174
+ " file.close()\n",
175
+ " url = f'https://github.com/catppuccin/'\n",
176
+ " for word in words:\n",
177
+ " full_url = url + word\n",
178
+ " !git clone {full_url} /content/Repo/extensions/catpuccin-theme\n",
179
+ " elif repo == 'AUTOMATIC1111' and theme == 'kitchen-theme':\n",
180
+ " name_i = 'sd-webui'\n",
181
+ " !git clone https://github.com/canisminor1990/{name_i}-kitchen-theme-legacy /content/Repo/extensions/kitchen-theme\n",
182
+ " else :\n",
183
+ " print(\"Default theme\")\n",
184
+ "\n",
185
+ "# Ekstension Install\n",
186
+ "install_extensions()\n",
187
+ "# Clone MiDaS\n",
188
+ "clone_MiDaS()\n",
189
+ "move_config_files()\n",
190
+ "lobe(repo, theme)\n",
191
+ "#@markdown Minimum one Model should be added and Multiple links are supported\n",
192
+ "\n",
193
+ "\n",
194
+ "import rarfile\n",
195
+ "import zipfile\n",
196
+ "print('\u001b[1;92m')\n",
197
+ "%cd /content/Repo/models/\n",
198
+ "!mkdir -p Stable-diffusion\n",
199
+ "print('\u001b[1;92m')\n",
200
+ "%cd /content/Repo/models/Stable-diffusion/\n",
201
+ "civitai_model_urls = \"https://civitai.com/api/download/models/141190?type=Model&format=SafeTensor&size=pruned&fp=fp16, https://civitai.com/api/download/models/107675?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {'type': 'string'}\n",
202
+ "url_list = civitai_model_urls.split(\", \")\n",
203
+ "for url in url_list:\n",
204
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition {url}\n",
205
+ "print('\u001b[1;92m')\n",
206
+ "%cd /content/Repo/models/Stable-diffusion/\n",
207
+ "huggface_model_urls = \"\" # @param {'type': 'string'}\n",
208
+ "url_list = huggface_model_urls.split(\", \")\n",
209
+ "for url in url_list:\n",
210
+ " !wget --content-disposition {url}\n",
211
+ "print('\u001b[1;92m')\n",
212
+ "%cd /content/Repo/models/\n",
213
+ "!mkdir -p Lora\n",
214
+ "print('\u001b[1;92m')\n",
215
+ "%cd /content/Repo/models/Lora/\n",
216
+ "lora_zip_url = 'https://github.com/Ysb321/supper/releases/download/LOR/LOR.zip, https://huggingface.co/datasets/ysb123/repo/resolve/main/ddd.zip' # @param {'type': 'string'}\n",
217
+ "url_list = lora_zip_url.split(\", \")\n",
218
+ "for url in url_list:\n",
219
+ " !wget --content-disposition {url}\n",
220
+ "current_dir = os.getcwd()\n",
221
+ "for entry in os.scandir(current_dir):\n",
222
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
223
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
224
+ " zip_ref.extractall(current_dir)\n",
225
+ "!rm *.zip\n",
226
+ "print('\u001b[1;92m')\n",
227
+ "%cd /content/Repo/models/\n",
228
+ "!mkdir -p ESRGAN\n",
229
+ "%cd /content/Repo/models/ESRGAN\n",
230
+ "esrgan_url = 'https://github.com/Ysb321/supper/releases/download/esrgan/ESRGAN.rar'\n",
231
+ "url_list = esrgan_url.split(\", \")\n",
232
+ "for url in url_list:\n",
233
+ " !wget --content-disposition {url}\n",
234
+ "filename = \"ESRGAN.rar\"\n",
235
+ "with rarfile.RarFile(filename) as rf:\n",
236
+ " rf.extractall()\n",
237
+ "!rm *.rar\n",
238
+ "print('\u001b[1;92m')\n",
239
+ "%cd /content/Repo/models/\n",
240
+ "!mkdir -p VAE\n",
241
+ "%cd /content/Repo/models/VAE/\n",
242
+ "!wget --content-disposition https://github.com/Ysb321/supper/releases/download/vae/vae-ft-mse-840000-ema-pruned.vae.pt\n",
243
+ "print('\u001b[1;92m')\n",
244
+ "%cd /content/Repo/models/\n",
245
+ "!mkdir -p embeddings\n",
246
+ "%cd /content/Repo/models/embeddings\n",
247
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip' # @param {'type': 'string'}\n",
248
+ "url_list = embeddings_zip_url.split(\", \")\n",
249
+ "for url in url_list:\n",
250
+ " !wget --content-disposition {url}\n",
251
+ "current_dir = os.getcwd()\n",
252
+ "for entry in os.scandir(current_dir):\n",
253
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
254
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
255
+ " zip_ref.extractall(current_dir)\n",
256
+ "!rm *.zip\n",
257
+ "print('\u001b[1;92m')\n",
258
+ "%cd /content/Repo/extensions/\n",
259
+ "extensions_urls = 'https://github.com/Ysb321/sd-fabric, https://github.com/Ysb321/sd-inpaint-anything, https://github.com/Ysb321/sd-segment-anything, https://github.com/IDEA-Research/DWPose, https://github.com/Klokinator/Umi-AI' # @param {'type': 'string'}\n",
260
+ "url_list = extensions_urls.split(\", \")\n",
261
+ "for url in url_list:\n",
262
+ " !git clone {url}\n",
263
+ "print('\u001b[1;92m')\n",
264
+ "%cd /content/Repo/models/\n",
265
+ "!mkdir -p roop\n",
266
+ "print('\u001b[1;92m')\n",
267
+ "%cd /content/Repo/models/roop/\n",
268
+ "!wget --content-disposition --quiet https://github.com/Ysb321/sd-roooop/releases/download/maiiin/inswapper_128.onnx\n",
269
+ "\n",
270
+ "!git clone https://huggingface.co/Bingsu/adetailer /content/Repo/models/adetailer\n",
271
+ "# Clear the output to keep the notebook clean\n",
272
+ "clear_output()\n",
273
+ "\n",
274
+ "import gc\n",
275
+ "import os\n",
276
+ "import threading\n",
277
+ "import requests\n",
278
+ "import logging\n",
279
+ "import urllib.request\n",
280
+ "from pyngrok import ngrok\n",
281
+ "from IPython.display import display, HTML\n",
282
+ "from IPython.display import clear_output\n",
283
+ "\n",
284
+ "%cd /content/Repo\n",
285
+ "audio_url = \"https://raw.githubusercontent.com/KoboldAI/KoboldAI-Client/main/colab/silence.m4a\"\n",
286
+ "def install_jemalloc():\n",
287
+ " !apt -y update -qq\n",
288
+ " !apt -y install libjemalloc-dev\n",
289
+ " %env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
290
+ "install_jemalloc()\n",
291
+ "\n",
292
+ "def new():\n",
293
+ " !sed -i \"s@os.path.splitext(checkpoint_file)@os.path.splitext(checkpoint_file); map_location='cuda'@\" /content/Repo/modules/sd_models.py\n",
294
+ " !sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /content/Repo/webui.py\n",
295
+ " !sed -i \"s@map_location='cpu'@map_location='cuda'@\" /content/Repo/modules/extras.py\n",
296
+ "new()\n",
297
+ "# Function AntiDissconnect in the background\n",
298
+ "def play_audio(url):\n",
299
+ " display(HTML(f'<audio src=\"{url}\" controls autoplay style=\"display:none\"></audio>'))\n",
300
+ "# Create a separate thread for AntiDissconnect\n",
301
+ "audio_thread = threading.Thread(target=play_audio, args=(audio_url,))\n",
302
+ "audio_thread.start()\n",
303
+ "\n",
304
+ "# Continue with your code execution here\n",
305
+ "# Disable logging for the pyngrok module to suppress the warnings\n",
306
+ "logging.getLogger(\"pyngrok\").setLevel(logging.ERROR)\n",
307
+ "\n",
308
+ "#@markdown Copy AuthToken https://dashboard.ngrok.com/get-started/your-authtoken and put here 👇 if you dont wwant to use gpu --skip-torch-cuda-test --no-half --no-half-vae paste in CA\n",
309
+ "ngrok_token = \"2SefQiS69n2ZPossu5ODyKDTUiF_4o9Qd7PUj953ZBUwx5rdz\" # @param {'type': 'string'}\n",
310
+ "\n",
311
+ "# Move the ngrok configuration file from the XDG-compliant location to the legacy location\n",
312
+ "os.system(\"mv /root/.config/ngrok/ngrok.yml /root/.ngrok2/ngrok.yml\")\n",
313
+ "\n",
314
+ "# Set the ngrok configuration directory to the legacy location\n",
315
+ "os.environ[\"NGROK_CONFIG_PATH\"] = \"/root/.ngrok2/ngrok.yml\"\n",
316
+ "\n",
317
+ "# Create an Event object to signal when ngrok is ready\n",
318
+ "ngrok_ready_event = threading.Event()\n",
319
+ "\n",
320
+ "# Function to install ngrok via TGZ file\n",
321
+ "def install_ngrok():\n",
322
+ " os.system(\"wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.tgz\")\n",
323
+ " os.system(\"sudo tar xvzf ngrok-stable-linux-amd64.tgz -C /usr/local/bin\")\n",
324
+ " os.remove(\"ngrok-stable-linux-amd64.tgz\") # Remove the TGZ file after installation\n",
325
+ " ngrok_ready_event.set() # Signal that ngrok installation is complete\n",
326
+ "\n",
327
+ "# Function to start ngrok and print the ngrok URL when the local URL is accessible\n",
328
+ "def start_ngrok():\n",
329
+ " ngrok.set_auth_token(ngrok_token)\n",
330
+ " public_url = ngrok.connect(7860, \"http\").public_url\n",
331
+ " # Convert to HTTPS by replacing \"http://\" with \"https://\"\n",
332
+ " public_url_https = public_url.replace(\"http://\", \"https://\", 1) # Use count=1 to replace only the first occurrence\n",
333
+ "\n",
334
+ " # Print the ngrok URL once the local URL is accessible\n",
335
+ " url_printed = False\n",
336
+ " while True:\n",
337
+ " try:\n",
338
+ " response = requests.get(\"http://127.0.0.1:7860\")\n",
339
+ " if response.status_code == 200 and not url_printed:\n",
340
+ " print(\"Ngrok URL:\", public_url_https)\n",
341
+ " print(\"+++\")\n",
342
+ " url_printed = True # Set the flag to indicate that the URL has been printed\n",
343
+ " break\n",
344
+ " except requests.ConnectionError:\n",
345
+ " pass\n",
346
+ "\n",
347
+ " ngrok_ready_event.set() # Signal that ngrok tunnel is ready\n",
348
+ "\n",
349
+ "# Install ngrok via TGZ file in a separate thread\n",
350
+ "install_thread = threading.Thread(target=install_ngrok)\n",
351
+ "install_thread.start()\n",
352
+ "\n",
353
+ "# Wait for ngrok installation to complete\n",
354
+ "ngrok_ready_event.wait()\n",
355
+ "\n",
356
+ "# Create a Timer to allow the main thread to continue after 5 seconds\n",
357
+ "timer = threading.Timer(1, lambda: None) # A dummy timer function to unblock the main thread after 5 seconds\n",
358
+ "\n",
359
+ "# Start ngrok in a separate thread\n",
360
+ "start_thread = threading.Thread(target=start_ngrok)\n",
361
+ "start_thread.start()\n",
362
+ "\n",
363
+ "# Start the timer to unblock the main thread after 5 seconds\n",
364
+ "timer.start()\n",
365
+ "gc.collect()\n",
366
+ "# Wait for the main thread to unblock after the timer expires\n",
367
+ "timer.join()\n",
368
+ "clear_output()\n",
369
+ "%env TF_CPP_MIN_LOG_LEVEL=1\n",
370
+ "Command_arguments = ' --listen --opt-split-attention --force-enable-xformers --opt-channelslast --allow-code --no-hashing --xformers --disable-safe-unpickle --enable-insecure-extension-access --disable-console-progressbars' # @param {'type': 'string'}\n",
371
+ "print('\u001b[96m')\n",
372
+ "if repo == 'automatic':\n",
373
+ " !git reset --hard {commit_hash}\n",
374
+ " !mkdir /content/automatic\n",
375
+ " shutil.copy2('/content/sd.net/styles.csv' , '/content/automatic')\n",
376
+ " name_i = 'sd-webui'\n",
377
+ " !python launch.py --multiple --cloudflared --localhostrun --remotemoe --lyco-dir /content/Repo/models/Lora/ --controlnet-dir /content/Repo/extensions/{name_i}-controlnet/\n",
378
+ " ngrok.kill()\n",
379
+ "elif repo == 'anapnoe':\n",
380
+ " !git reset --hard {commit_hash}\n",
381
+ " !python launch.py {Command_arguments} --theme=dark --multiple --cloudflared --localhostrun --remotemoe --embeddings-dir /content/Repo/models/embeddings\n",
382
+ " ngrok.kill()\n",
383
+ "else:\n",
384
+ " !git reset --hard {commit_hash}\n",
385
+ " !python launch.py {Command_arguments} --theme=dark --multiple --cloudflared --localhostrun --remotemoe --embeddings-dir /content/Repo/models/embeddings\n",
386
+ " gc.collect()\n",
387
+ " ngrok.kill()\n",
388
+ "\n",
389
+ " #@markdown ****"
390
+ ]
391
+ },
392
+ {
393
+ "cell_type": "code",
394
+ "execution_count": null,
395
+ "metadata": {
396
+ "cellView": "form",
397
+ "id": "Ct8zW2JooNw4"
398
+ },
399
+ "outputs": [],
400
+ "source": [
401
+ "\n",
402
+ "import gc\n",
403
+ "import shutil\n",
404
+ "import os\n",
405
+ "import threading\n",
406
+ "import requests\n",
407
+ "import logging\n",
408
+ "import urllib.request\n",
409
+ "from pyngrok import ngrok\n",
410
+ "from IPython.display import display, HTML\n",
411
+ "from IPython.display import clear_output\n",
412
+ "# --Function AntiDissconnect\n",
413
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\"]\n",
414
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
415
+ "%cd /content/Repo\n",
416
+ "audio_url = \"https://raw.githubusercontent.com/KoboldAI/KoboldAI-Client/main/colab/silence.m4a\"\n",
417
+ "def install_jemalloc():\n",
418
+ " !apt -y update -qq\n",
419
+ " !apt -y install libjemalloc-dev\n",
420
+ " %env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
421
+ "install_jemalloc()\n",
422
+ "\n",
423
+ "def new():\n",
424
+ " !sed -i \"s@os.path.splitext(checkpoint_file)@os.path.splitext(checkpoint_file); map_location='cuda'@\" /content/Repo/modules/sd_models.py\n",
425
+ " !sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /content/Repo/webui.py\n",
426
+ " !sed -i \"s@map_location='cpu'@map_location='cuda'@\" /content/Repo/modules/extras.py\n",
427
+ " !cp /content/Repo/assets/blocks.py /usr/local/lib/python3.10/dist-packages/gradio/blocks.py\n",
428
+ "new()\n",
429
+ "# Function AntiDissconnect in the background\n",
430
+ "def play_audio(url):\n",
431
+ " display(HTML(f'<audio src=\"{url}\" controls autoplay style=\"display:none\"></audio>'))\n",
432
+ "# Create a separate thread for AntiDissconnect\n",
433
+ "audio_thread = threading.Thread(target=play_audio, args=(audio_url,))\n",
434
+ "audio_thread.start()\n",
435
+ "\n",
436
+ "# Continue with your code execution here\n",
437
+ "# Disable logging for the pyngrok module to suppress the warnings\n",
438
+ "logging.getLogger(\"pyngrok\").setLevel(logging.ERROR)\n",
439
+ "\n",
440
+ "#@markdown Copy AuthToken https://dashboard.ngrok.com/get-started/your-authtoken and put here 👇\n",
441
+ "ngrok_token = \"\" # @param {'type': 'string'}\n",
442
+ "\n",
443
+ "# Move the ngrok configuration file from the XDG-compliant location to the legacy location\n",
444
+ "os.system(\"mv /root/.config/ngrok/ngrok.yml /root/.ngrok2/ngrok.yml\")\n",
445
+ "\n",
446
+ "# Set the ngrok configuration directory to the legacy location\n",
447
+ "os.environ[\"NGROK_CONFIG_PATH\"] = \"/root/.ngrok2/ngrok.yml\"\n",
448
+ "\n",
449
+ "# Create an Event object to signal when ngrok is ready\n",
450
+ "ngrok_ready_event = threading.Event()\n",
451
+ "\n",
452
+ "# Function to install ngrok via TGZ file\n",
453
+ "def install_ngrok():\n",
454
+ " os.system(\"wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.tgz\")\n",
455
+ " os.system(\"sudo tar xvzf ngrok-stable-linux-amd64.tgz -C /usr/local/bin\")\n",
456
+ " os.remove(\"ngrok-stable-linux-amd64.tgz\") # Remove the TGZ file after installation\n",
457
+ " ngrok_ready_event.set() # Signal that ngrok installation is complete\n",
458
+ "\n",
459
+ "# Function to start ngrok and print the ngrok URL when the local URL is accessible\n",
460
+ "def start_ngrok():\n",
461
+ " ngrok.set_auth_token(ngrok_token)\n",
462
+ " public_url = ngrok.connect(7860, \"http\").public_url\n",
463
+ " # Convert to HTTPS by replacing \"http://\" with \"https://\"\n",
464
+ " public_url_https = public_url.replace(\"http://\", \"https://\", 1) # Use count=1 to replace only the first occurrence\n",
465
+ "\n",
466
+ " # Print the ngrok URL once the local URL is accessible\n",
467
+ " url_printed = False\n",
468
+ " while True:\n",
469
+ " try:\n",
470
+ " response = requests.get(\"http://127.0.0.1:7860\")\n",
471
+ " if response.status_code == 200 and not url_printed:\n",
472
+ " print(\"Ngrok URL:\", public_url_https)\n",
473
+ " print(\"+++\")\n",
474
+ " url_printed = True # Set the flag to indicate that the URL has been printed\n",
475
+ " break\n",
476
+ " except requests.ConnectionError:\n",
477
+ " pass\n",
478
+ "\n",
479
+ " ngrok_ready_event.set() # Signal that ngrok tunnel is ready\n",
480
+ "\n",
481
+ "# Install ngrok via TGZ file in a separate thread\n",
482
+ "install_thread = threading.Thread(target=install_ngrok)\n",
483
+ "install_thread.start()\n",
484
+ "\n",
485
+ "# Wait for ngrok installation to complete\n",
486
+ "ngrok_ready_event.wait()\n",
487
+ "\n",
488
+ "# Create a Timer to allow the main thread to continue after 5 seconds\n",
489
+ "timer = threading.Timer(1, lambda: None) # A dummy timer function to unblock the main thread after 5 seconds\n",
490
+ "\n",
491
+ "# Start ngrok in a separate thread\n",
492
+ "start_thread = threading.Thread(target=start_ngrok)\n",
493
+ "start_thread.start()\n",
494
+ "\n",
495
+ "# Start the timer to unblock the main thread after 5 seconds\n",
496
+ "timer.start()\n",
497
+ "gc.collect()\n",
498
+ "# Wait for the main thread to unblock after the timer expires\n",
499
+ "timer.join()\n",
500
+ "clear_output()\n",
501
+ "%env TF_CPP_MIN_LOG_LEVEL=1\n",
502
+ "Command_arguments = ' --opt-split-attention --force-enable-xformers --opt-channelslast --allow-code --no-hashing --xformers --disable-safe-unpickle --enable-insecure-extension-access --disable-console-progressbars' # @param {'type': 'string'}\n",
503
+ "if repo == 'automatic':\n",
504
+ " !git reset --hard {commit_hash}\n",
505
+ " !mkdir /content/automatic\n",
506
+ " shutil.copy2('/content/sd.net/styles.csv' , '/content/automatic')\n",
507
+ " name_i = 'sd-webui'\n",
508
+ " !python launch.py --multiple --cloudflared --localhostrun --remotemoe --lyco-dir /content/Repo/models/Lora/ --controlnet-dir /content/Repo/extensions/{name_i}-controlnet/\n",
509
+ " ngrok.kill()\n",
510
+ "elif repo == 'anapnoe':\n",
511
+ " !git reset --hard {commit_hash}\n",
512
+ " !python launch.py {Command_arguments} --theme dark --multiple --cloudflared --localhostrun --remotemoe --embeddings-dir /content/Repo/models/embeddings\n",
513
+ " ngrok.kill()\n",
514
+ "else:\n",
515
+ "\n",
516
+ " !python launch.py {Command_arguments} --theme=dark --multiple --cloudflared --localhostrun --remotemoe --embeddings-dir /content/Repo/models/embeddings\n",
517
+ " gc.collect()\n",
518
+ " ngrok.kill()"
519
+ ]
520
+ },
521
+ {
522
+ "cell_type": "code",
523
+ "execution_count": null,
524
+ "metadata": {
525
+ "cellView": "form",
526
+ "id": "jU_uT2YT4YxP"
527
+ },
528
+ "outputs": [],
529
+ "source": [
530
+ "import os\n",
531
+ "import shutil\n",
532
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\", \"lobe-theme\"]\n",
533
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
534
+ "theme = 'kitchen-theme' #@param [\"None\",\"lobe\", \"catppuccin\",\"kitchen-theme\"]\n",
535
+ "\n",
536
+ "!git clone https://github.com/Ysb321/sd.net\n",
537
+ "!git clone https://github.com/Ysb321/a1111 Repo\n",
538
+ "\n",
539
+ "file = open('/content/sd.net/DataFiles/words.txt', 'r')\n",
540
+ "content = file.read()\n",
541
+ "words = content.split()\n",
542
+ "file.close()\n",
543
+ "url = f'https://github.com/{repo}/'\n",
544
+ "for word in words:\n",
545
+ " full_url = url + word\n",
546
+ "\n",
547
+ "def lobe(repo ='AUTOMATIC1111'):\n",
548
+ " if theme == 'lobe':\n",
549
+ " name_i = 'sd-webui'\n",
550
+ " !git clone https://github.com/lobehub/{name_i}-lobe-theme /content/Repo/extensions/lobe-theme\n",
551
+ " shutil.copy2(\"/content/sd.net/config.json\", \"/content/Repo\")\n",
552
+ " shutil.copy2(\"/content/sd.net/ui-config.json\", \"/content/Repo\")\n",
553
+ " elif theme == 'catppuccin':\n",
554
+ " file = open('/content/sd.net/DataFiles/words.txt', 'r')\n",
555
+ " content = file.read()\n",
556
+ " words = content.split()\n",
557
+ " file.close()\n",
558
+ " url = f'https://github.com/catppuccin/'\n",
559
+ " for word in words:\n",
560
+ " full_url = url + word\n",
561
+ " !git clone {full_url} /content/Repo/extensions/catpuccin-theme\n",
562
+ " elif theme == 'kitchen-theme':\n",
563
+ " name_i = 'sd-web-ui'\n",
564
+ " !git clone https://github.com/canisminor1990/{name_i}-kitchen-theme /content/Repo/extensions/kitchen-theme\n",
565
+ " else :\n",
566
+ " print(\"Default theme\")\n",
567
+ "lobe()\n"
568
+ ]
569
+ },
570
+ {
571
+ "cell_type": "code",
572
+ "execution_count": null,
573
+ "metadata": {
574
+ "cellView": "form",
575
+ "id": "7bCtIKIU4cTM"
576
+ },
577
+ "outputs": [],
578
+ "source": [
579
+ "%cd /content/Repo/models/Stable-diffusion/\n",
580
+ "civitai_model_urls = \"https://civitai.com/api/download/models/118817?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {'type': 'string'}\n",
581
+ "url_list = civitai_model_urls.split(\", \")\n",
582
+ "for url in url_list:\n",
583
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition {url}"
584
+ ]
585
+ }
586
+ ],
587
+ "metadata": {
588
+ "accelerator": "GPU",
589
+ "colab": {
590
+ "provenance": [],
591
+ "gpuType": "T4"
592
+ },
593
+ "kernelspec": {
594
+ "display_name": "Python 3",
595
+ "name": "python3"
596
+ },
597
+ "language_info": {
598
+ "name": "python"
599
+ }
600
+ },
601
+ "nbformat": 4,
602
+ "nbformat_minor": 0
603
+ }
invokeai latest fix.ipynb ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "D4TNDJdRpPN9"
7
+ },
8
+ "source": [
9
+ "#Invoke AI Notebook\n",
10
+ "\n",
11
+ "Works on the free tier: Generating images with the SDXL base model and refiner. Adding SDXL models in diffusers format from HuggingFace.\n",
12
+ "\n",
13
+ "Works, but only with Colab Pro: Adding custom checkpoints and LoRAs."
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "markdown",
18
+ "metadata": {
19
+ "id": "Ow5L4LUnr_Cs"
20
+ },
21
+ "source": [
22
+ "Step 1"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {
29
+ "cellView": "form",
30
+ "id": "MIhVvU8jkdm6"
31
+ },
32
+ "outputs": [],
33
+ "source": [
34
+ "#@markdown # Installing InvokeAI\n",
35
+ "\n",
36
+ "#@markdown Use Google Drive to store models (uses about 7 GB). Uncheck this if you don't have enough space in your Drive.\n",
37
+ "useGoogleDrive = False #@param {type:\"boolean\"}\n",
38
+ "\n",
39
+ "googleDriveModelsFolder = '/stablemodels' #@param {type:\"string\"}\n",
40
+ "\n",
41
+ "#@markdown This step usually takes about 5 minutes.\n",
42
+ "\n",
43
+ "#@markdown You can ignore the message about restarting the runtime.\n",
44
+ "import os\n",
45
+ "import subprocess\n",
46
+ "from google.colab import drive\n",
47
+ "if useGoogleDrive:\n",
48
+ " drive.mount('/content/drive')\n",
49
+ " if not googleDriveModelsFolder.startswith('/'):\n",
50
+ " googleDriveModelsFolder = '/' + googleDriveModelsFolder\n",
51
+ " modelsPath = \"/content/drive/MyDrive\"+googleDriveModelsFolder\n",
52
+ " if not modelsPath.endswith(\"/\"):\n",
53
+ " modelsPath = modelsPath + \"/\"\n",
54
+ "\n",
55
+ "env = os.environ.copy()\n",
56
+ "\n",
57
+ "# !pip install \"InvokeAI[xformers]==3.5.1\" --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121\n",
58
+ "!pip install \"InvokeAI[xformers]\" --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121\n",
59
+ "!pip3 install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121\n",
60
+ "\n",
61
+ "# Install version 3.3.0post3, laset one verified to work on the free tier\n",
62
+ "#!pip install 'InvokeAI[xformers]==3.3.0post3' --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu118"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {
69
+ "id": "vo7f1aKTBCUT"
70
+ },
71
+ "outputs": [],
72
+ "source": [
73
+ "!pip install insightface gfpgan codeformer-pip realesrgan cython opencv-python onnx onnxruntime\n",
74
+ "!pip install -q dependency_injector diffusers einops eventlet facexlib flask_cors flask_socketio flaskwebgui getpass_asterisk huggingface-hub\n",
75
+ "!pip install -q kornia omegaconf pudb pyreadline3 pytorch-lightning realesrgan streamlit taming-transformers-rom1504 test-tube torch-fidelity\n",
76
+ "!pip install -q torchmetrics transformers picklescan\n",
77
+ "!pip install -q pillow python-socketio triton\n",
78
+ "!pip install -q git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan\n",
79
+ "!pip install git+https://github.com/openai/CLIP.git@main#egg=clip\n",
80
+ "!pip install git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion\n",
81
+ "!pip install git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg\n",
82
+ "!pip install git+https://github.com/invoke-ai/PyPatchMatch@0.1.4#egg=pypatchmatch"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "markdown",
87
+ "metadata": {
88
+ "id": "ERca0J67r8Ss"
89
+ },
90
+ "source": [
91
+ "Step 2"
92
+ ]
93
+ },
94
+ {
95
+ "cell_type": "code",
96
+ "execution_count": null,
97
+ "metadata": {
98
+ "cellView": "form",
99
+ "id": "YTkFxvuH0BsX"
100
+ },
101
+ "outputs": [],
102
+ "source": [
103
+ "#@markdown # Configuration and downloading default models\n",
104
+ "\n",
105
+ "!mkdir /content/invokeai\n",
106
+ "!mkdir /content/invokeai/configs\n",
107
+ "\n",
108
+ "#@markdown Download only the default model in initial configuration.\n",
109
+ "#@markdown Checking this prevents running out of space in Colab.\n",
110
+ "\n",
111
+ "defaultOnly = True #@param {type:\"boolean\"}\n",
112
+ "skipWeights = True #@param {type:\"boolean\"}\n",
113
+ "noFullPrecision = True #@param {type:\"boolean\"}\n",
114
+ "#@markdown This step usually takes about 2 minutes with only the default model and no weights.\n",
115
+ "\n",
116
+ "#@markdown You can ignore \"File exists\" warnings in the output.\n",
117
+ "\n",
118
+ "cmd = 'invokeai-configure --root_dir /content/invokeai --yes'\n",
119
+ "\n",
120
+ "if defaultOnly:\n",
121
+ " cmd += ' --default_only'\n",
122
+ "\n",
123
+ "if skipWeights:\n",
124
+ " cmd += ' --skip-sd-weights'\n",
125
+ "\n",
126
+ "if noFullPrecision:\n",
127
+ " cmd += ' --no-full-precision'\n",
128
+ "\n",
129
+ "get_ipython().system(cmd)\n",
130
+ "\n",
131
+ "import fileinput\n",
132
+ "import os\n",
133
+ "def find(name, path):\n",
134
+ " for root, dirs, files in os.walk(path):\n",
135
+ " if name in files:\n",
136
+ " return os.path.join(root, name)\n",
137
+ "\n",
138
+ "if noFullPrecision:\n",
139
+ " model_install_file = find('model_install_backend.py', '/usr/local/lib')\n",
140
+ " print('modifying file ' + model_install_file)\n",
141
+ " for line in fileinput.input(model_install_file, inplace=True):\n",
142
+ " if ('precision = torch_dtype(choose_torch_device())' in line):\n",
143
+ " line = line.replace('torch_dtype(choose_torch_device())', 'torch.float16')\n",
144
+ " print(line, end='')\n"
145
+ ]
146
+ },
147
+ {
148
+ "cell_type": "code",
149
+ "execution_count": null,
150
+ "metadata": {
151
+ "cellView": "form",
152
+ "id": "3owdtpnWsRoU"
153
+ },
154
+ "outputs": [],
155
+ "source": [
156
+ "# Linking output images to Google Drive\n",
157
+ "outputDrivePath = '/content/drive/MyDrive/images/invoke-outputs/new' #@param {type:\"string\"}\n",
158
+ "# Full path to the output folder on Google Drive\n",
159
+ "\n",
160
+ "saveDatabase = False #@param {type:\"boolean\"}\n",
161
+ "from os import path\n",
162
+ "\n",
163
+ "from google.colab import drive\n",
164
+ "import os\n",
165
+ "from os import path\n",
166
+ "drive.mount('/content/drive')\n",
167
+ "\n",
168
+ "if not outputDrivePath.endswith('/'):\n",
169
+ " outputDrivePath = outputDrivePath + '/'\n",
170
+ "imagesDrivePath = outputDrivePath + 'images'\n",
171
+ "databaseDrivePath = outputDrivePath + 'databases'\n",
172
+ "if not path.exists(imagesDrivePath):\n",
173
+ " os.makedirs(imagesDrivePath, exist_ok=True)\n",
174
+ "\n",
175
+ "\n",
176
+ "outputsLocalPath = '/content/invokeai/outputs'\n",
177
+ "imagesLocalPath = '/content/invokeai/outputs/images'\n",
178
+ "\n",
179
+ "if not path.exists(outputsLocalPath):\n",
180
+ " os.makedirs(outputsLocalPath, exist_ok=True)\n",
181
+ "\n",
182
+ "import datetime\n",
183
+ "\n",
184
+ "if path.exists(imagesLocalPath):\n",
185
+ " cmd = f'mv {imagesLocalPath} {imagesLocalPath}-backup{datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\")}'\n",
186
+ " get_ipython().system(cmd)\n",
187
+ "\n",
188
+ "cmd = f'ln -s {imagesDrivePath} {outputsLocalPath}'\n",
189
+ "get_ipython().system(cmd)\n",
190
+ "\n",
191
+ "# Linking the database\n",
192
+ "if saveDatabase:\n",
193
+ " if not path.exists(databaseDrivePath):\n",
194
+ " os.makedirs(databaseDrivePath, exist_ok=True)\n",
195
+ "\n",
196
+ " databaseLocalPath = '/content/invokeai/databases'\n",
197
+ "\n",
198
+ " cmd = f'mv {databaseLocalPath} {databaseLocalPath}-backup{datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\")}'\n",
199
+ " get_ipython().system(cmd)\n",
200
+ "\n",
201
+ " cmd = f'ln -s {databaseDrivePath} /content/invokeai'\n",
202
+ " get_ipython().system(cmd)\n"
203
+ ]
204
+ },
205
+ {
206
+ "cell_type": "markdown",
207
+ "metadata": {
208
+ "id": "T4xrUy3Gsomd"
209
+ },
210
+ "source": [
211
+ "Step 7: Starting the app"
212
+ ]
213
+ },
214
+ {
215
+ "cell_type": "code",
216
+ "execution_count": null,
217
+ "metadata": {
218
+ "id": "nCiDkdSlqZhd"
219
+ },
220
+ "outputs": [],
221
+ "source": [
222
+ "def install_jemalloc():\n",
223
+ " !apt -y update -qq\n",
224
+ " !apt -y install libjemalloc-dev\n",
225
+ " !apt install aria2\n",
226
+ "install_jemalloc()"
227
+ ]
228
+ },
229
+ {
230
+ "cell_type": "code",
231
+ "execution_count": null,
232
+ "metadata": {
233
+ "cellView": "form",
234
+ "id": "rbSwyE1S3-aO"
235
+ },
236
+ "outputs": [],
237
+ "source": [
238
+ "!apt-get install aria2\n",
239
+ "civitai_model_urls = \"https://civitai.com/api/download/models/264879?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/237459?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {'type': 'string'}\n",
240
+ "url_list = civitai_model_urls.split(\", \")\n",
241
+ "for url in url_list:\n",
242
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main {url}"
243
+ ]
244
+ },
245
+ {
246
+ "cell_type": "code",
247
+ "execution_count": null,
248
+ "metadata": {
249
+ "id": "OMHCTl-cxrjn"
250
+ },
251
+ "outputs": [],
252
+ "source": [
253
+ "!apt-get install aria2\n",
254
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main https://civitai.com/api/download/models/161715?type=Model&format=SafeTensor&size=pruned&fp=fp16"
255
+ ]
256
+ },
257
+ {
258
+ "cell_type": "code",
259
+ "execution_count": null,
260
+ "metadata": {
261
+ "id": "RGaWaz6cZR90"
262
+ },
263
+ "outputs": [],
264
+ "source": [
265
+ "!apt-get install aria2\n",
266
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main https://civitai.com/api/download/models/306531"
267
+ ]
268
+ },
269
+ {
270
+ "cell_type": "code",
271
+ "execution_count": null,
272
+ "metadata": {
273
+ "id": "IY8CqXCSwi3N"
274
+ },
275
+ "outputs": [],
276
+ "source": [
277
+ "!apt-get install aria2\n",
278
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main https://civitai.com/api/download/models/159646?type=Model&format=SafeTensor&size=full&fp=fp16"
279
+ ]
280
+ },
281
+ {
282
+ "cell_type": "code",
283
+ "source": [
284
+ "!curl -L -H \"Content-Type: application/json\" -H \"Authorization: Bearer 6748e0f8e6085cd9349551385ce8943a\" -o /content/invokeai/models/sd-1/main/sad.safetensors https://civitai.com/api/download/models/370979?type=Model&format=SafeTensor&token=6748e0f8e6085cd9349551385ce8943a&size=full&fp=fp16"
285
+ ],
286
+ "metadata": {
287
+ "id": "Kf7ksAV_Up_w"
288
+ },
289
+ "execution_count": null,
290
+ "outputs": []
291
+ },
292
+ {
293
+ "cell_type": "code",
294
+ "execution_count": null,
295
+ "metadata": {
296
+ "id": "cBl07BmEM7BM"
297
+ },
298
+ "outputs": [],
299
+ "source": [
300
+ "!apt-get install aria2\n",
301
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/main https://civitai.com/api/download/models/299488?type=Model&format=SafeTensor&size=pruned&fp=fp16"
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "code",
306
+ "execution_count": null,
307
+ "metadata": {
308
+ "id": "W_VxGyNnw1ZL"
309
+ },
310
+ "outputs": [],
311
+ "source": [
312
+ "https://civitai.com/api/download/models/132136?type=Model&format=SafeTensor&size=pruned&fp=fp16 https://civitai.com/api/download/models/277120?type=Model&format=SafeTensor&size=full&fp=fp16"
313
+ ]
314
+ },
315
+ {
316
+ "cell_type": "code",
317
+ "execution_count": null,
318
+ "metadata": {
319
+ "id": "02fRrgfOESBv"
320
+ },
321
+ "outputs": [],
322
+ "source": [
323
+ "!wget -P /content/invokeai/models/sd-1/vae https://github.com/Ysb321/supper/releases/download/vae/vae-ft-mse-840000-ema-pruned.vae.pt"
324
+ ]
325
+ },
326
+ {
327
+ "cell_type": "code",
328
+ "execution_count": null,
329
+ "metadata": {
330
+ "id": "HVGXPIvP1S8x"
331
+ },
332
+ "outputs": [],
333
+ "source": [
334
+ "!wget --content-disposition -P /content/invokeai/models/sd-1/lora https://civitai.com/api/download/models/196140?type=Model&format=SafeTensor"
335
+ ]
336
+ },
337
+ {
338
+ "cell_type": "code",
339
+ "execution_count": null,
340
+ "metadata": {
341
+ "id": "nIc41Dk1l0Qv"
342
+ },
343
+ "outputs": [],
344
+ "source": [
345
+ "!wget --content-disposition -P /content/invokeai/models/core/upscaling/realesrgan https://civitai.com/api/download/models/125843?type=Model&format=PickleTensor"
346
+ ]
347
+ },
348
+ {
349
+ "cell_type": "code",
350
+ "execution_count": null,
351
+ "metadata": {
352
+ "id": "QC6jE2afaVHy"
353
+ },
354
+ "outputs": [],
355
+ "source": [
356
+ "# @title Embeddings\n",
357
+ "import os\n",
358
+ "import zipfile\n",
359
+ "embeddings_zip_url = 'https://github.com/Ysb321/supper/releases/download/emm/emm.zip, https://civitai.com/api/download/models/301684?type=Negative&format=Other, https://civitai.com/api/download/models/152133?type=Negative&format=Other, https://civitai.com/api/download/models/110510?type=Negative&format=Other, https://civitai.com/api/download/models/345593?type=Model&format=PickleTensor, https://civitai.com/api/download/models/64063?type=Negative&format=Other, https://civitai.com/api/download/models/97691?type=Negative&format=Other, https://civitai.com/api/download/models/42247?type=Model&format=Other, https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor, https://civitai.com/api/download/models/57451?type=Model&format=Other, https://civitai.com/api/download/models/111570?type=Model&format=PickleTensor, https://civitai.com/api/download/models/125020?type=Model&format=PickleTensor'\n",
360
+ "url_list = embeddings_zip_url.split(\", \")\n",
361
+ "for url in url_list:\n",
362
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M -d /content/invokeai/models/sd-1/embedding {url}\n",
363
+ "current_dir = '/content/invokeai/models/sd-1/embedding'\n",
364
+ "for entry in os.scandir(current_dir):\n",
365
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
366
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
367
+ " zip_ref.extractall(current_dir)\n",
368
+ "!rm /content/invokeai/models/sd-1/embedding/*.zip"
369
+ ]
370
+ },
371
+ {
372
+ "cell_type": "code",
373
+ "execution_count": null,
374
+ "metadata": {
375
+ "cellView": "form",
376
+ "id": "zPR0gqrAc97R"
377
+ },
378
+ "outputs": [],
379
+ "source": [
380
+ "# @title lorazip\n",
381
+ "import zipfile\n",
382
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/LOR.zip'\n",
383
+ "url_list = lora_zip_url.split(\", \")\n",
384
+ "for url in url_list:\n",
385
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/lora {url}\n",
386
+ "directory = '/content/invokeai/models/sd-1/lora'\n",
387
+ "for filename in os.listdir(directory):\n",
388
+ " if '.' not in filename:\n",
389
+ " old_filepath = os.path.join(directory, filename)\n",
390
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
391
+ " os.rename(old_filepath, new_filepath)\n",
392
+ "current_dir = '/content/invokeai/models/sd-1/lora'\n",
393
+ "for entry in os.scandir(current_dir):\n",
394
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
395
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
396
+ " zip_ref.extractall(current_dir)\n",
397
+ "!rm /content/invokeai/models/sd-1/lora/*.zip"
398
+ ]
399
+ },
400
+ {
401
+ "cell_type": "code",
402
+ "execution_count": null,
403
+ "metadata": {
404
+ "cellView": "form",
405
+ "id": "iOf2elAdGwqc"
406
+ },
407
+ "outputs": [],
408
+ "source": [
409
+ "lora_url = 'https://civitai.com/api/download/models/85591?type=Model&format=SafeTensor, https://civitai.com/api/download/models/180084?type=Model&format=SafeTensor, https://civitai.com/api/download/models/349887?type=Model&format=SafeTensor, https://civitai.com/api/download/models/258687?type=Model&format=SafeTensor, https://civitai.com/api/download/models/352053?type=Model&format=SafeTensor, https://civitai.com/api/download/models/129737, https://civitai.com/api/download/models/21214?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/191312?type=Model&format=SafeTensor, https://civitai.com/api/download/models/10029?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/282559?type=Model&format=SafeTensor, https://civitai.com/api/download/models/50103?type=Model&format=SafeTensor, https://civitai.com/api/download/models/228402?type=Model&format=SafeTensor, https://civitai.com/api/download/models/81031?type=Model&format=SafeTensor, https://civitai.com/api/download/models/7804?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/121410?type=Model&format=SafeTensor, https://civitai.com/api/download/models/227382?type=Model&format=SafeTensor, https://civitai.com/api/download/models/193488?type=Model&format=SafeTensor, https://civitai.com/api/download/models/55199?type=Model&format=SafeTensor, https://civitai.com/api/download/models/123309?type=Model&format=SafeTensor, https://civitai.com/api/download/models/92121?type=Model&format=SafeTensor, https://civitai.com/api/download/models/191312?type=Model&format=SafeTensor, https://civitai.com/api/download/models/134937?type=Model&format=SafeTensor, https://civitai.com/api/download/models/121127?type=Model&format=SafeTensor, https://civitai.com/api/download/models/249203?type=Model&format=SafeTensor, https://civitai.com/api/download/models/82778?type=Model&format=SafeTensor, https://civitai.com/api/download/models/65807?type=Model&format=SafeTensor, https://civitai.com/api/download/models/144008?type=Model&format=SafeTensor, https://civitai.com/api/download/models/250951?type=Model&format=SafeTensor, https://civitai.com/api/download/models/98626?type=Model&format=SafeTensor, https://civitai.com/api/download/models/191328?type=Model&format=SafeTensor, https://civitai.com/api/download/models/182715?type=Model&format=SafeTensor, https://civitai.com/api/download/models/10786?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/217270?type=Model&format=SafeTensor, https://civitai.com/api/download/models/163556?type=Model&format=SafeTensor, https://civitai.com/api/download/models/62252?type=Model&format=SafeTensor, https://civitai.com/api/download/models/185325?type=Model&format=SafeTensor, https://civitai.com/api/download/models/45982?type=Model&format=SafeTensor, https://civitai.com/api/download/models/61160?type=Model&format=SafeTensor, https://civitai.com/api/download/models/146600?type=Model&format=SafeTensor, https://civitai.com/api/download/models/182772?type=Model&format=SafeTensor, https://civitai.com/api/download/models/186168?type=Model&format=SafeTensor, https://civitai.com/api/download/models/182038?type=Model&format=SafeTensor, https://civitai.com/api/download/models/32066?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/55644?type=Model&format=SafeTensor, https://civitai.com/api/download/models/149622?type=Model&format=SafeTensor' # @param {'type': 'string'}\n",
410
+ "url_list = lora_url.split(\", \")\n",
411
+ "for url in url_list:\n",
412
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/lora {url}"
413
+ ]
414
+ },
415
+ {
416
+ "cell_type": "code",
417
+ "execution_count": null,
418
+ "metadata": {
419
+ "id": "VYZk_emF9dr-"
420
+ },
421
+ "outputs": [],
422
+ "source": [
423
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition -d /content/invokeai/models/sd-1/lora https://civitai.com/api/download/models/191312?type=Model&format=SafeTensor"
424
+ ]
425
+ },
426
+ {
427
+ "cell_type": "code",
428
+ "execution_count": null,
429
+ "metadata": {
430
+ "cellView": "form",
431
+ "id": "8P-UgO8Ysrlz"
432
+ },
433
+ "outputs": [],
434
+ "source": [
435
+ "#@markdown # Option 2: Starting the Web UI with ngrok\n",
436
+ "!pip install pyngrok\n",
437
+ "\n",
438
+ "from pyngrok import ngrok, conf\n",
439
+ "import fileinput\n",
440
+ "import sys\n",
441
+ "%env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
442
+ "Ngrok_token = \"2bXClxilN5LiwHbrsBhN6EbTuIm_2GN2bKh7fEQCbgqEbmtA4\" #@param {type:\"string\"}\n",
443
+ "#@markdown - Add ngrok token (obtainable from https://ngrok.com)\n",
444
+ "\n",
445
+ "#@markdown Only works with InvokeAI 3.0.2 and later\n",
446
+ "\n",
447
+ "share=''\n",
448
+ "if Ngrok_token!=\"\":\n",
449
+ " ngrok.kill()\n",
450
+ " srv=ngrok.connect(9090 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),\n",
451
+ " bind_tls=True).public_url\n",
452
+ " print(srv)\n",
453
+ " get_ipython().system(\"invokeai-web --root /content/invokeai/\")\n",
454
+ "else:\n",
455
+ " print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token field.')"
456
+ ]
457
+ },
458
+ {
459
+ "cell_type": "code",
460
+ "execution_count": null,
461
+ "metadata": {
462
+ "cellView": "form",
463
+ "id": "qN-IExD5XwOs"
464
+ },
465
+ "outputs": [],
466
+ "source": [
467
+ "#@markdown # Option 1: Starting the Web UI with Localtunnel\n",
468
+ "\n",
469
+ "%cd /content/invokeai/\n",
470
+ "!npm install -g localtunnel\n",
471
+ "\n",
472
+ "#@markdown Copy the IP address shown in the output above the line\n",
473
+ "#@markdown \"your url is: https://some-random-words.loca.lt\"\n",
474
+ "!wget -q -O - ipv4.icanhazip.com\n",
475
+ "\n",
476
+ "#@markdown Wait for the line that says \"Uvicorn running on http://127.0.0.1:9090 (Press CTRL+C to quit)\"\n",
477
+ "\n",
478
+ "#@markdown Click the localtunnel url and paste the IP you copied earlier to the \"Endpoint IP\" text field\n",
479
+ "!lt --port 9090 --local_https False & invokeai-web --root /content/invokeai/\n",
480
+ "\n",
481
+ "#@markdown If the UI shows a red dot that says 'disconnected' when hovered in the upper\n",
482
+ "#@markdown right corner and the Invoke button is disabled, change 'https' to 'http'\n",
483
+ "#@markdown in the browser's address bar and press enter.\n",
484
+ "#@markdown When the page reloads, the UI should work properly.\n"
485
+ ]
486
+ },
487
+ {
488
+ "cell_type": "code",
489
+ "execution_count": null,
490
+ "metadata": {
491
+ "id": "9OautS4SNHnq"
492
+ },
493
+ "outputs": [],
494
+ "source": [
495
+ "!aria2c https://civitai.com/api/download/models/106020?type=Model&format=PickleTensor"
496
+ ]
497
+ },
498
+ {
499
+ "cell_type": "code",
500
+ "execution_count": null,
501
+ "metadata": {
502
+ "id": "5VjqZknCOMFp"
503
+ },
504
+ "outputs": [],
505
+ "source": [
506
+ "!pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118\n",
507
+ "!pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118"
508
+ ]
509
+ },
510
+ {
511
+ "cell_type": "code",
512
+ "execution_count": null,
513
+ "metadata": {
514
+ "id": "PzPVKL5_JbWs"
515
+ },
516
+ "outputs": [],
517
+ "source": [
518
+ "!pip uninstall torchvision-0.17"
519
+ ]
520
+ },
521
+ {
522
+ "cell_type": "code",
523
+ "execution_count": null,
524
+ "metadata": {
525
+ "id": "OOY8fCojPuZ-"
526
+ },
527
+ "outputs": [],
528
+ "source": [
529
+ "!pip install xformers!=0.0.18 --extra-index-url https://download.pytorch.org/whl/cu118 --extra-index-url https://download.pytorch.org/whl/cu117"
530
+ ]
531
+ },
532
+ {
533
+ "cell_type": "code",
534
+ "execution_count": null,
535
+ "metadata": {
536
+ "id": "fToDInRmxwPd"
537
+ },
538
+ "outputs": [],
539
+ "source": [
540
+ "!pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118\n",
541
+ "!pip install -U -I --no-deps https://files.pythonhosted.org/packages/d6/f7/02662286419a2652c899e2b3d1913c47723fc164b4ac06a85f769c291013/xformers-0.0.17rc482-cp310-cp310-win_amd64.whl"
542
+ ]
543
+ },
544
+ {
545
+ "cell_type": "code",
546
+ "execution_count": null,
547
+ "metadata": {
548
+ "id": "N2yQXp0Mx_IU"
549
+ },
550
+ "outputs": [],
551
+ "source": [
552
+ "!pip3 install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu118"
553
+ ]
554
+ },
555
+ {
556
+ "cell_type": "code",
557
+ "execution_count": null,
558
+ "metadata": {
559
+ "id": "97wOc8165YzQ"
560
+ },
561
+ "outputs": [],
562
+ "source": []
563
+ }
564
+ ],
565
+ "metadata": {
566
+ "accelerator": "GPU",
567
+ "colab": {
568
+ "gpuType": "T4",
569
+ "provenance": []
570
+ },
571
+ "kernelspec": {
572
+ "display_name": "Python 3",
573
+ "name": "python3"
574
+ },
575
+ "language_info": {
576
+ "name": "python"
577
+ }
578
+ },
579
+ "nbformat": 4,
580
+ "nbformat_minor": 0
581
+ }
rooop.ipynb ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "G9BdiCppV6AS"
7
+ },
8
+ "source": [
9
+ "# Video tutorial link > https://youtu.be/OI1LEN-SgLM\n",
10
+ "# Testing video and images and more : https://www.patreon.com/posts/1-click-deepfake-83785289\n",
11
+ "## SECourses : https://www.youtube.com/SECourses\n",
12
+ "## GitHub instructions : https://github.com/FurkanGozukara/Stable-Diffusion/blob/main/Tutorials/1-Click-DeepFake-Tutorial.md\n",
13
+ "# RunPod Roop DeepFake Auto installer: https://www.patreon.com/posts/auto-installer-84511510"
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "markdown",
18
+ "metadata": {
19
+ "id": "ni6edG-8MUNg"
20
+ },
21
+ "source": [
22
+ "**If you want to use the latest version remove `!git checkout 312208a41102ba86d2454ae8efc9d3f0b786a6e7`**"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {
29
+ "id": "t1yPuhdySqCq"
30
+ },
31
+ "outputs": [],
32
+ "source": [
33
+ "!git clone https://github.com/Ysb321/vid_roooop roop\n",
34
+ "%cd roop\n",
35
+ "#Tested and updated 23 August 2023 commit\n",
36
+ "#!git checkout da1ef285f1d43bd0cc8b9cdb9a0f80f7ae793a97\n",
37
+ "!pip install onnxruntime-gpu && pip install -r requirements.txt"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {
43
+ "id": "Jul-_i9xMmV2"
44
+ },
45
+ "source": [
46
+ "**You will see processing message at the end of below printed messages e.g. Processing: 43% 136/318 00:38<00:24, 7.47frame/s**\n",
47
+ "\n",
48
+ "**Make sure to upload root roop folder not inside the sub roop folder and don't forget to change image and video file names**\n",
49
+ "\n",
50
+ "**1 is best quality big video size, 100 worst quality low video size**"
51
+ ]
52
+ },
53
+ {
54
+ "cell_type": "code",
55
+ "execution_count": null,
56
+ "metadata": {
57
+ "colab": {
58
+ "base_uri": "https://localhost:8080/"
59
+ },
60
+ "id": "Nh3RaH1iRKed",
61
+ "outputId": "4bace9cd-ddcb-4a3e-92d9-213a126f6cff"
62
+ },
63
+ "outputs": [
64
+ {
65
+ "output_type": "stream",
66
+ "name": "stdout",
67
+ "text": [
68
+ "Mounted at /content/drive\n"
69
+ ]
70
+ }
71
+ ],
72
+ "source": [
73
+ "from google.colab import drive\n",
74
+ "import os\n",
75
+ "from os import path\n",
76
+ "drive.mount('/content/drive')"
77
+ ]
78
+ },
79
+ {
80
+ "cell_type": "code",
81
+ "execution_count": null,
82
+ "metadata": {
83
+ "id": "Is6U2huqSzLE"
84
+ },
85
+ "outputs": [],
86
+ "source": [
87
+ "%cd \"/content/roop\"\n",
88
+ "!python run.py -s \"face2.png\" -t \"brad org.mp4\" -o \"face_changed_video_v2.mp4\" --keep-frames --keep-fps --temp-frame-quality 1 --output-video-quality 1 --execution-provider cuda"
89
+ ]
90
+ },
91
+ {
92
+ "cell_type": "markdown",
93
+ "metadata": {
94
+ "id": "VJpNWHq1qdjT"
95
+ },
96
+ "source": [
97
+ "**Below code will do also face restoration to improve quality significantly but it will take longer**"
98
+ ]
99
+ },
100
+ {
101
+ "cell_type": "code",
102
+ "execution_count": null,
103
+ "metadata": {
104
+ "id": "_j18G_uPqc37"
105
+ },
106
+ "outputs": [],
107
+ "source": [
108
+ "%cd \"/content/roop\"\n",
109
+ "!python run.py -s \"/content/sample_data/download.jpg\" -t \"/content/sample_data/5b88a002-34f8-4e9c-96b8-0747795ea129.png\" -o \"/content/drive/MyDrive/imgs/immgg/\" --keep-frames --keep-fps --temp-frame-quality 1 --output-video-quality 1 --execution-provider cuda --frame-processor face_swapper face_enhancer --reference-face-position 1"
110
+ ]
111
+ },
112
+ {
113
+ "cell_type": "markdown",
114
+ "metadata": {
115
+ "id": "jr-63BTn8UEs"
116
+ },
117
+ "source": [
118
+ "### All options are displayed below\n",
119
+ "Append any of them to the above commands before executing\n",
120
+ "```\n",
121
+ "python run.py [options]\n",
122
+ "\n",
123
+ "-h, --help show this help message and exit\n",
124
+ "-s SOURCE_PATH, --source SOURCE_PATH select an source image\n",
125
+ "-t TARGET_PATH, --target TARGET_PATH select an target image or video\n",
126
+ "-o OUTPUT_PATH, --output OUTPUT_PATH select output file or directory\n",
127
+ "--frame-processor FRAME_PROCESSOR [FRAME_PROCESSOR ...] frame processors (choices: face_swapper, face_enhancer, ...)\n",
128
+ "--keep-fps keep target fps\n",
129
+ "--keep-frames keep temporary frames\n",
130
+ "--skip-audio skip target audio\n",
131
+ "--many-faces process every face\n",
132
+ "--reference-face-position REFERENCE_FACE_POSITION position of the reference face\n",
133
+ "--reference-frame-number REFERENCE_FRAME_NUMBER number of the reference frame\n",
134
+ "--similar-face-distance SIMILAR_FACE_DISTANCE face distance used for recognition\n",
135
+ "--temp-frame-format {jpg,png} image format used for frame extraction\n",
136
+ "--temp-frame-quality [0-100] image quality used for frame extraction\n",
137
+ "--output-video-encoder {libx264,libx265,libvpx-vp9,h264_nvenc,hevc_nvenc} encoder used for the output video\n",
138
+ "--output-video-quality [0-100] quality used for the output video\n",
139
+ "--max-memory MAX_MEMORY maximum amount of RAM in GB\n",
140
+ "--execution-provider {cpu} [{cpu} ...] available execution provider (choices: cpu, ...)\n",
141
+ "--execution-threads EXECUTION_THREADS number of execution threads\n",
142
+ "-v, --version show program's version number and exit\n",
143
+ " ```"
144
+ ]
145
+ },
146
+ {
147
+ "cell_type": "markdown",
148
+ "metadata": {
149
+ "id": "UdQ1VHdI8lCf"
150
+ },
151
+ "source": [
152
+ "### Download generated images folder"
153
+ ]
154
+ },
155
+ {
156
+ "cell_type": "code",
157
+ "execution_count": null,
158
+ "metadata": {
159
+ "colab": {
160
+ "base_uri": "https://localhost:8080/",
161
+ "height": 17
162
+ },
163
+ "id": "oYjWveAmw10X",
164
+ "outputId": "a8b591fe-7c43-4a72-a7b9-f4111aa62e2a"
165
+ },
166
+ "outputs": [
167
+ {
168
+ "data": {
169
+ "application/javascript": [
170
+ "\n",
171
+ " async function download(id, filename, size) {\n",
172
+ " if (!google.colab.kernel.accessAllowed) {\n",
173
+ " return;\n",
174
+ " }\n",
175
+ " const div = document.createElement('div');\n",
176
+ " const label = document.createElement('label');\n",
177
+ " label.textContent = `Downloading \"${filename}\": `;\n",
178
+ " div.appendChild(label);\n",
179
+ " const progress = document.createElement('progress');\n",
180
+ " progress.max = size;\n",
181
+ " div.appendChild(progress);\n",
182
+ " document.body.appendChild(div);\n",
183
+ "\n",
184
+ " const buffers = [];\n",
185
+ " let downloaded = 0;\n",
186
+ "\n",
187
+ " const channel = await google.colab.kernel.comms.open(id);\n",
188
+ " // Send a message to notify the kernel that we're ready.\n",
189
+ " channel.send({})\n",
190
+ "\n",
191
+ " for await (const message of channel.messages) {\n",
192
+ " // Send a message to notify the kernel that we're ready.\n",
193
+ " channel.send({})\n",
194
+ " if (message.buffers) {\n",
195
+ " for (const buffer of message.buffers) {\n",
196
+ " buffers.push(buffer);\n",
197
+ " downloaded += buffer.byteLength;\n",
198
+ " progress.value = downloaded;\n",
199
+ " }\n",
200
+ " }\n",
201
+ " }\n",
202
+ " const blob = new Blob(buffers, {type: 'application/binary'});\n",
203
+ " const a = document.createElement('a');\n",
204
+ " a.href = window.URL.createObjectURL(blob);\n",
205
+ " a.download = filename;\n",
206
+ " div.appendChild(a);\n",
207
+ " a.click();\n",
208
+ " div.remove();\n",
209
+ " }\n",
210
+ " "
211
+ ],
212
+ "text/plain": [
213
+ "<IPython.core.display.Javascript object>"
214
+ ]
215
+ },
216
+ "metadata": {},
217
+ "output_type": "display_data"
218
+ },
219
+ {
220
+ "data": {
221
+ "application/javascript": [
222
+ "download(\"download_5b4ec731-e629-435c-9d30-4ddfb2b4fba7\", \"video3.zip.zip\", 863967701)"
223
+ ],
224
+ "text/plain": [
225
+ "<IPython.core.display.Javascript object>"
226
+ ]
227
+ },
228
+ "metadata": {},
229
+ "output_type": "display_data"
230
+ }
231
+ ],
232
+ "source": [
233
+ "import shutil\n",
234
+ "import os\n",
235
+ "from google.colab import files\n",
236
+ "\n",
237
+ "def zip_directory(directory_path, zip_path):\n",
238
+ " shutil.make_archive(zip_path, 'zip', directory_path)\n",
239
+ "\n",
240
+ "# Set the directory path you want to download\n",
241
+ "directory_path = '/content/roop/video3'\n",
242
+ "\n",
243
+ "# Set the zip file name\n",
244
+ "zip_filename = 'video3.zip'\n",
245
+ "\n",
246
+ "# Zip the directory\n",
247
+ "zip_directory(directory_path, zip_filename)\n",
248
+ "\n",
249
+ "# Download the zip file\n",
250
+ "files.download(zip_filename+'.zip')\n"
251
+ ]
252
+ }
253
+ ],
254
+ "metadata": {
255
+ "accelerator": "GPU",
256
+ "colab": {
257
+ "provenance": []
258
+ },
259
+ "kernelspec": {
260
+ "display_name": "Python 3",
261
+ "name": "python3"
262
+ },
263
+ "language_info": {
264
+ "name": "python"
265
+ }
266
+ },
267
+ "nbformat": 4,
268
+ "nbformat_minor": 0
269
+ }
simplezip_SD1.ipynb ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "gpuType": "T4"
8
+ },
9
+ "kernelspec": {
10
+ "name": "python3",
11
+ "display_name": "Python 3"
12
+ },
13
+ "language_info": {
14
+ "name": "python"
15
+ },
16
+ "accelerator": "GPU"
17
+ },
18
+ "cells": [
19
+ {
20
+ "cell_type": "markdown",
21
+ "source": [
22
+ "# **SD COLAB BY YASHRAJ 👇**"
23
+ ],
24
+ "metadata": {
25
+ "id": "eN0YbpHXF5ld"
26
+ }
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "source": [
31
+ "#@markdown **Mount your Drive if you Want Output Images in Drive**\n",
32
+ "from IPython.display import clear_output, display, HTML\n",
33
+ "from google.colab import drive\n",
34
+ "import os\n",
35
+ "import subprocess\n",
36
+ "import shutil\n",
37
+ "mount_drive = True # @param {type:\"boolean\"}\n",
38
+ "%cd /content\n",
39
+ "print('\u001b[1;92m')\n",
40
+ "if mount_drive == True:\n",
41
+ " drive.mount('/content/drive')\n",
42
+ "else:\n",
43
+ " print(\"No GDrive Found!!\")"
44
+ ],
45
+ "metadata": {
46
+ "cellView": "form",
47
+ "id": "_2b_FliL1kXz",
48
+ "colab": {
49
+ "base_uri": "https://localhost:8080/"
50
+ },
51
+ "outputId": "3cd6350f-8b7b-4564-843f-cd59d4205012"
52
+ },
53
+ "execution_count": null,
54
+ "outputs": [
55
+ {
56
+ "output_type": "stream",
57
+ "name": "stdout",
58
+ "text": [
59
+ "/content\n",
60
+ "\u001b[1;92m\n",
61
+ "Mounted at /content/drive\n"
62
+ ]
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "source": [
69
+ "from IPython.display import clear_output, display, HTML\n",
70
+ "import os\n",
71
+ "import subprocess\n",
72
+ "import shutil\n",
73
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\"]\n",
74
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
75
+ "theme = 'catppuccin' #@param [\"None\",\"lobe\", \"catppuccin\",\"kitchen-theme\"]\n",
76
+ "%cd /content\n",
77
+ "def exist():\n",
78
+ " if os.path.isdir('/content/Repo'):\n",
79
+ " shutil.rmtree('/content/Repo', ignore_errors=False, onerror=None)\n",
80
+ " else:\n",
81
+ " clear_output()\n",
82
+ "exist()\n",
83
+ "print('\u001b[1;92m')\n",
84
+ "if repo == 'AUTOMATIC1111':\n",
85
+ " !wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/a1111.py\n",
86
+ " !python3 a1111.py\n",
87
+ "elif repo == 'anapnoe':\n",
88
+ " !wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/anapnoe.py\n",
89
+ " !python3 anapnoe.py\n",
90
+ "elif repo == 'automatic':\n",
91
+ " !wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/automatic.py\n",
92
+ " !python3 automatic.py\n",
93
+ "clear_output()\n",
94
+ "\n",
95
+ "%cd /content/Repo/extensions\n",
96
+ "print('\u001b[1;92m')\n",
97
+ "!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/Extensions.py\n",
98
+ "!python3 Extensions.py\n",
99
+ "\n",
100
+ "def lobe():\n",
101
+ " print('\u001b[1;92m')\n",
102
+ " if repo == 'AUTOMATIC1111' and theme == 'lobe':\n",
103
+ " name_i = 'sd-webui'\n",
104
+ " !git clone https://github.com/lobehub/{name_i}-lobe-theme /content/Repo/extensions/lobe-theme\n",
105
+ " elif repo == 'AUTOMATIC1111' and theme == 'catppuccin':\n",
106
+ " %cd /content/Repo/extensions/\n",
107
+ " !wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/catppucin.py\n",
108
+ " !python3 catppucin.py\n",
109
+ " elif repo == 'AUTOMATIC1111' and theme == 'kitchen-theme':\n",
110
+ " name_i = 'sd-webui'\n",
111
+ " !git clone https://github.com/canisminor1990/{name_i}-kitchen-theme-legacy /content/Repo/extensions/kitchen-theme\n",
112
+ " else :\n",
113
+ " print(\"Default theme\")\n",
114
+ "lobe()\n",
115
+ "\n",
116
+ "%cd /content/Repo/models/\n",
117
+ "!pip install -qq pyunpack\n",
118
+ "!apt-get install aria2 -qq\n",
119
+ "!mkdir -p Stable-diffusion\n",
120
+ "print('\u001b[1;92m')\n",
121
+ "%cd /content/Repo/models/Stable-diffusion/\n",
122
+ "civitai_model_urls = \"https://civitai.com/api/download/models/138176?type=Model&format=SafeTensor&size=pruned&fp=fp32, https://civitai.com/api/download/models/44827?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {'type': 'string'}\n",
123
+ "url_list = civitai_model_urls.split(\", \")\n",
124
+ "for url in url_list:\n",
125
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition {url}\n",
126
+ "print('\u001b[1;92m')\n",
127
+ "%cd /content/Repo/models/Stable-diffusion/\n",
128
+ "huggface_model_urls = \"\" # @param {'type': 'string'}\n",
129
+ "url_list = huggface_model_urls.split(\", \")\n",
130
+ "for url in url_list:\n",
131
+ " !wget --content-disposition {url}\n",
132
+ "\n",
133
+ "clear_output()\n",
134
+ "print(\"Done Successfully!✌️\")"
135
+ ],
136
+ "metadata": {
137
+ "cellView": "form",
138
+ "id": "zetu2t73c0MP"
139
+ },
140
+ "execution_count": null,
141
+ "outputs": []
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "source": [
146
+ "from IPython.display import clear_output, display, HTML\n",
147
+ "import os\n",
148
+ "import subprocess\n",
149
+ "import shutil\n",
150
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\"]\n",
151
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
152
+ "theme = 'None' #@param [\"None\",\"lobe\", \"catppuccin\",\"kitchen-theme\"]\n",
153
+ "%cd /content\n",
154
+ "def exist():\n",
155
+ " if os.path.isdir('/content/Repo'):\n",
156
+ " shutil.rmtree('/content/Repo', ignore_errors=False, onerror=None)\n",
157
+ " else:\n",
158
+ " clear_output()\n",
159
+ "exist()\n",
160
+ "\n",
161
+ "!git clone https://github.com/Ysb321/a1111 Repo\n",
162
+ "\n",
163
+ "%cd /content/Repo/extensions/\n",
164
+ "!git clone https://github.com/Ysb321/sd-controlnet.git\n",
165
+ "!git clone https://github.com/Ysb321/roooop.git\n",
166
+ "!git clone https://github.com/Bing-su/adetailer\n",
167
+ "!git clone https://github.com/Ysb321/sd-infinite-image-browsing\n",
168
+ "!git clone https://github.com/Iyashinouta/sd-model-downloader\n",
169
+ "\n",
170
+ "def lobe():\n",
171
+ " print('\u001b[1;92m')\n",
172
+ " if repo == 'AUTOMATIC1111' and theme == 'lobe':\n",
173
+ " name_i = 'sd-webui'\n",
174
+ " !git clone https://github.com/lobehub/{name_i}-lobe-theme /content/Repo/extensions/lobe-theme\n",
175
+ " elif repo == 'AUTOMATIC1111' and theme == 'catppuccin':\n",
176
+ " %cd /content/Repo/extensions/\n",
177
+ " !wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/catppucin.py\n",
178
+ " !python3 catppucin.py\n",
179
+ " elif repo == 'AUTOMATIC1111' and theme == 'kitchen-theme':\n",
180
+ " name_i = 'sd-webui'\n",
181
+ " !git clone https://github.com/canisminor1990/{name_i}-kitchen-theme-legacy /content/Repo/extensions/kitchen-theme\n",
182
+ " else :\n",
183
+ " print(\"Default theme\")\n",
184
+ "lobe()\n",
185
+ "\n",
186
+ "%cd /content/Repo/models/\n",
187
+ "!pip install -qq pyunpack\n",
188
+ "!apt-get install aria2 -qq\n",
189
+ "!mkdir -p Stable-diffusion\n",
190
+ "print('\u001b[1;92m')\n",
191
+ "%cd /content/Repo/models/Stable-diffusion/\n",
192
+ "civitai_model_urls = \"https://civitai.com/api/download/models/138176?type=Model&format=SafeTensor&size=pruned&fp=fp32, https://civitai.com/api/download/models/44827?type=Model&format=SafeTensor&size=pruned&fp=fp16\" # @param {'type': 'string'}\n",
193
+ "url_list = civitai_model_urls.split(\", \")\n",
194
+ "for url in url_list:\n",
195
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition {url}\n",
196
+ "print('\u001b[1;92m')\n",
197
+ "%cd /content/Repo/models/Stable-diffusion/\n",
198
+ "huggface_model_urls = \"\" # @param {'type': 'string'}\n",
199
+ "url_list = huggface_model_urls.split(\", \")\n",
200
+ "for url in url_list:\n",
201
+ " !wget --content-disposition {url}\n",
202
+ "\n",
203
+ "clear_output()\n",
204
+ "print(\"Done Successfully!✌️\")"
205
+ ],
206
+ "metadata": {
207
+ "cellView": "form",
208
+ "id": "4esgMnLXS77M"
209
+ },
210
+ "execution_count": null,
211
+ "outputs": []
212
+ },
213
+ {
214
+ "cell_type": "code",
215
+ "source": [
216
+ "#@markdown **ControlNet**\n",
217
+ "def CN():\n",
218
+ " print('\u001b[1;92m')\n",
219
+ " Start_with_ControlNet = \"Download from urls\" # @param [\"No\", \"Download from urls\", \"Download All\"]\n",
220
+ " if os.path.exists(\"/content/Repo/config.json\"):\n",
221
+ " os.remove(\"/content/Repo/config.json\")\n",
222
+ "\n",
223
+ " if Start_with_ControlNet == \"No\":\n",
224
+ " name_i = 'sd-webui'\n",
225
+ " shutil.rmtree(f'/content/Repo/extensions/{name_i}-controlnet', ignore_errors=False, onerror=None)\n",
226
+ " print(\"No CN Models\")\n",
227
+ " elif Start_with_ControlNet == \"Download from urls\":\n",
228
+ " print('\u001b[1;92m')\n",
229
+ " name_i = 'sd-webui'\n",
230
+ " controlnet_url = 'https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors' # @param {'type': 'string'}\n",
231
+ " url_list = controlnet_url.split(\", \")\n",
232
+ " for url in url_list:\n",
233
+ " !wget --content-disposition -qq {url} -P /content/Repo/extensions/{name_i}-controlnet/models/\n",
234
+ " elif Start_with_ControlNet == \"Download All\":\n",
235
+ " name_i = 'sd-webui'\n",
236
+ " !wget --content-disposition -i /content/sd.net/DataFiles/CN.txt -P /content/Repo/extensions/{name_i}-controlnet/models/\n",
237
+ " else:\n",
238
+ " print(\"Invalid value for Start_with_ControlNet. Please choose either 'No' or 'Yes'.\")\n",
239
+ "CN()\n",
240
+ "clear_output()\n",
241
+ "print(\"Done Successfully!✌️\")"
242
+ ],
243
+ "metadata": {
244
+ "cellView": "form",
245
+ "id": "Ko4nV3nb6dqh"
246
+ },
247
+ "execution_count": null,
248
+ "outputs": []
249
+ },
250
+ {
251
+ "cell_type": "code",
252
+ "source": [
253
+ "#@markdown **LORA all in one zip**\n",
254
+ "import os\n",
255
+ "import subprocess\n",
256
+ "from pyunpack import zipfile\n",
257
+ "print('\u001b[1;92m')\n",
258
+ "%cd /content/Repo/models/\n",
259
+ "repo_url = 'https://huggingface.co/datasets/ysb123/yy'\n",
260
+ "dest_path = './Lora'\n",
261
+ "# Run the git clone command\n",
262
+ "try:\n",
263
+ " subprocess.run(['git', 'clone', '--depth=1', repo_url, dest_path], check=True)\n",
264
+ " print('Clone operation completed successfully!')\n",
265
+ "except subprocess.CalledProcessError:\n",
266
+ " print('Clone operation failed!')\n",
267
+ "%cd /content/Repo/models/Lora/\n",
268
+ "zip_directory = '/content/Repo/models/Lora/'\n",
269
+ "\n",
270
+ "# Loop through all the files in the zip directory\n",
271
+ "for filename in os.listdir(zip_directory):\n",
272
+ " if filename.endswith('.zip'):\n",
273
+ " # Construct the full path of the zip file\n",
274
+ " zip_path = os.path.join(zip_directory, filename)\n",
275
+ "\n",
276
+ " # Extract the zip file to the extract directory\n",
277
+ " shutil.unpack_archive(zip_path)\n",
278
+ "!rm /content/Repo/models/Lora/*.zip\n",
279
+ "clear_output()\n",
280
+ "print(\"Done Successfully!✌️\")"
281
+ ],
282
+ "metadata": {
283
+ "cellView": "form",
284
+ "id": "H3shHFIKRcDp"
285
+ },
286
+ "execution_count": null,
287
+ "outputs": []
288
+ },
289
+ {
290
+ "cell_type": "code",
291
+ "source": [
292
+ "#@markdown **VAE &**\n",
293
+ "#@markdown **LORA**\n",
294
+ "from IPython.display import clear_output, display, HTML\n",
295
+ "import os\n",
296
+ "import subprocess\n",
297
+ "import shutil\n",
298
+ "from pyunpack import zipfile\n",
299
+ "print('\u001b[1;92m')\n",
300
+ "%cd /content/Repo/models/\n",
301
+ "!mkdir -p VAE\n",
302
+ "%cd /content/Repo/models/VAE/\n",
303
+ "!wget --content-disposition -qq https://github.com/Ysb321/supper/releases/download/vae/vae-ft-mse-840000-ema-pruned.vae.pt\n",
304
+ "print('\u001b[1;92m')\n",
305
+ "\n",
306
+ "VAE_url = '' # @param {'type': 'string'}\n",
307
+ "url_list = VAE_url.split(\", \")\n",
308
+ "for url in url_list:\n",
309
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {url}\n",
310
+ "current_dir = os.getcwd()\n",
311
+ "for entry in os.scandir(current_dir):\n",
312
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
313
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
314
+ " zip_ref.extractall(current_dir)\n",
315
+ "!rm *.zip\n",
316
+ "%cd /content/Repo/models/\n",
317
+ "!mkdir Lora\n",
318
+ "%cd /content/Repo/models/Lora/\n",
319
+ "lora_url = 'https://civitai.com/api/download/models/156831?type=Model&format=SafeTensor, https://civitai.com/api/download/models/21910?type=Model&format=SafeTensor&size=full&fp=fp16, https://civitai.com/api/download/models/112103' # @param {'type': 'string'}\n",
320
+ "url_list = lora_url.split(\", \")\n",
321
+ "for url in url_list:\n",
322
+ " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M --content-disposition {url}\n",
323
+ "lora_zip_url = 'https://huggingface.co/datasets/ysb123/yy/resolve/main/Lora.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ppp.zip, https://huggingface.co/datasets/ysb123/yy/resolve/main/ddd.zip' # @param {'type': 'string'}\n",
324
+ "url_list = lora_zip_url.split(\", \")\n",
325
+ "for url in url_list:\n",
326
+ " !aria2c -c -x 16 -s 16 -k 1M {url}\n",
327
+ "directory = '/content/Repo/models/Lora'\n",
328
+ "for filename in os.listdir(directory):\n",
329
+ " if '.' not in filename:\n",
330
+ " old_filepath = os.path.join(directory, filename)\n",
331
+ " new_filepath = os.path.join(directory, filename + '.zip')\n",
332
+ " os.rename(old_filepath, new_filepath)\n",
333
+ "current_dir = os.getcwd()\n",
334
+ "for entry in os.scandir(current_dir):\n",
335
+ " if entry.is_file() and entry.name.endswith('.zip'):\n",
336
+ " with zipfile.ZipFile(entry, 'r') as zip_ref:\n",
337
+ " zip_ref.extractall(current_dir)\n",
338
+ "!rm *.zip\n",
339
+ "clear_output()\n",
340
+ "print(\"Done Successfully!✌️\")"
341
+ ],
342
+ "metadata": {
343
+ "cellView": "form",
344
+ "id": "QbHMAMwpqLjB"
345
+ },
346
+ "execution_count": null,
347
+ "outputs": []
348
+ },
349
+ {
350
+ "cell_type": "code",
351
+ "source": [
352
+ "#@markdown **Run SD & if you dont want to use gpu --skip-torch-cuda-test --no-half --no-half-vae paste in arrgu**\n",
353
+ "from IPython.display import clear_output, display, HTML\n",
354
+ "repo = 'AUTOMATIC1111' #@param [\"AUTOMATIC1111\", \"anapnoe\", \"automatic\"]\n",
355
+ "commit_hash = \"\" # @param {'type': 'string'}\n",
356
+ "%cd /content/Repo/\n",
357
+ "!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/config.json\n",
358
+ "!wget -qq https://huggingface.co/datasets/ysb123/repo/resolve/main/styles.csv\n",
359
+ "print('\u001b[1;92m')\n",
360
+ "def install_jemalloc():\n",
361
+ " !apt -y update -qq\n",
362
+ " !apt -y install libjemalloc-dev\n",
363
+ " %env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\n",
364
+ "install_jemalloc()\n",
365
+ "\n",
366
+ "def new():\n",
367
+ " !sed -i \"s@os.path.splitext(checkpoint_file)@os.path.splitext(checkpoint_file); map_location='cuda'@\" /content/Repo/modules/sd_models.py\n",
368
+ " !sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /content/Repo/webui.py\n",
369
+ " !sed -i \"s@map_location='cpu'@map_location='cuda'@\" /content/Repo/modules/extras.py\n",
370
+ " !cp /content/Repo/assets/blocks.py /usr/local/lib/python3.10/dist-packages/gradio/blocks.py\n",
371
+ " !apt -y update -qq\n",
372
+ " !wget https://github.com/camenduru/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4 -O /content/libtcmalloc_minimal.so.4\n",
373
+ " %env LD_PRELOAD=/content/libtcmalloc_minimal.so.4\n",
374
+ "new()\n",
375
+ "\n",
376
+ "clear_output()\n",
377
+ "arrgu = '--lowram ' # @param {'type': 'string'}\n",
378
+ "print('\u001b[1;92m')\n",
379
+ "if repo == 'automatic':\n",
380
+ " !git reset --hard {commit_hash}\n",
381
+ " !mkdir /content/automatic\n",
382
+ " shutil.copy2('/content/Repo/styles.csv' , '/content/automatic')\n",
383
+ " new_i = 'sd-webui'\n",
384
+ " !python launch.py --multiple --lyco-dir /content/Repo/models/Lora/ --controlnet-dir /content/Repo/extensions/{name_i}-controlnet/\n",
385
+ "else :\n",
386
+ " !git reset --hard {commit_hash}\n",
387
+ " !python launch.py {arrgu} --enable-insecure-extension-access --disable-console-progressbars --xformers --multiple --embeddings-dir /content/Repo/models/embeddings"
388
+ ],
389
+ "metadata": {
390
+ "cellView": "form",
391
+ "id": "k5grp_jrpCmD"
392
+ },
393
+ "execution_count": null,
394
+ "outputs": []
395
+ }
396
+ ]
397
+ }
workflow on openartai.json ADDED
@@ -0,0 +1,1510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 49,
3
+ "last_link_id": 94,
4
+ "nodes": [
5
+ {
6
+ "id": 34,
7
+ "type": "UpscaleModelLoader",
8
+ "pos": [
9
+ 715.3815238787734,
10
+ 2723.420032772362
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 58
15
+ },
16
+ "flags": {
17
+ "pinned": true
18
+ },
19
+ "order": 0,
20
+ "mode": 4,
21
+ "outputs": [
22
+ {
23
+ "name": "UPSCALE_MODEL",
24
+ "type": "UPSCALE_MODEL",
25
+ "links": [
26
+ 50
27
+ ],
28
+ "shape": 3,
29
+ "slot_index": 0
30
+ }
31
+ ],
32
+ "properties": {
33
+ "Node name for S&R": "UpscaleModelLoader"
34
+ },
35
+ "widgets_values": [
36
+ "4x-UltraSharp.pth"
37
+ ]
38
+ },
39
+ {
40
+ "id": 38,
41
+ "type": "SaveImage",
42
+ "pos": [
43
+ 1794.3815238787727,
44
+ 2772.4200327723624
45
+ ],
46
+ "size": {
47
+ "0": 896.6117553710938,
48
+ "1": 946.48486328125
49
+ },
50
+ "flags": {
51
+ "pinned": true
52
+ },
53
+ "order": 21,
54
+ "mode": 4,
55
+ "inputs": [
56
+ {
57
+ "name": "images",
58
+ "type": "IMAGE",
59
+ "link": 56
60
+ }
61
+ ],
62
+ "properties": {},
63
+ "widgets_values": [
64
+ "ComfyUI"
65
+ ]
66
+ },
67
+ {
68
+ "id": 30,
69
+ "type": "ImageUpscaleWithModel",
70
+ "pos": [
71
+ 3093,
72
+ 480
73
+ ],
74
+ "size": {
75
+ "0": 241.79998779296875,
76
+ "1": 46
77
+ },
78
+ "flags": {
79
+ "pinned": true
80
+ },
81
+ "order": 23,
82
+ "mode": 4,
83
+ "inputs": [
84
+ {
85
+ "name": "upscale_model",
86
+ "type": "UPSCALE_MODEL",
87
+ "link": 63
88
+ },
89
+ {
90
+ "name": "image",
91
+ "type": "IMAGE",
92
+ "link": 47
93
+ }
94
+ ],
95
+ "outputs": [
96
+ {
97
+ "name": "IMAGE",
98
+ "type": "IMAGE",
99
+ "links": [
100
+ 57
101
+ ],
102
+ "shape": 3,
103
+ "slot_index": 0
104
+ }
105
+ ],
106
+ "properties": {
107
+ "Node name for S&R": "ImageUpscaleWithModel"
108
+ }
109
+ },
110
+ {
111
+ "id": 11,
112
+ "type": "Note",
113
+ "pos": [
114
+ 457,
115
+ 224
116
+ ],
117
+ "size": {
118
+ "0": 260,
119
+ "1": 170
120
+ },
121
+ "flags": {
122
+ "pinned": true
123
+ },
124
+ "order": 1,
125
+ "mode": 4,
126
+ "properties": {
127
+ "text": ""
128
+ },
129
+ "widgets_values": [
130
+ "OpenPose ControlNet\n===================\n\nBasic workflow for OpenPose ControlNet.\n\nIt's always a good idea to lower slightly the STRENGTH to give the model a little leeway."
131
+ ],
132
+ "color": "#432",
133
+ "bgcolor": "#653"
134
+ },
135
+ {
136
+ "id": 18,
137
+ "type": "ControlNetApply",
138
+ "pos": [
139
+ 490,
140
+ 55
141
+ ],
142
+ "size": {
143
+ "0": 211.60000610351562,
144
+ "1": 98
145
+ },
146
+ "flags": {
147
+ "pinned": true
148
+ },
149
+ "order": 14,
150
+ "mode": 4,
151
+ "inputs": [
152
+ {
153
+ "name": "conditioning",
154
+ "type": "CONDITIONING",
155
+ "link": 14
156
+ },
157
+ {
158
+ "name": "control_net",
159
+ "type": "CONTROL_NET",
160
+ "link": 16,
161
+ "slot_index": 1
162
+ },
163
+ {
164
+ "name": "image",
165
+ "type": "IMAGE",
166
+ "link": 13
167
+ }
168
+ ],
169
+ "outputs": [
170
+ {
171
+ "name": "CONDITIONING",
172
+ "type": "CONDITIONING",
173
+ "links": [
174
+ 41
175
+ ],
176
+ "shape": 3,
177
+ "slot_index": 0
178
+ }
179
+ ],
180
+ "properties": {
181
+ "Node name for S&R": "ControlNetApply"
182
+ },
183
+ "widgets_values": [
184
+ 0.6
185
+ ]
186
+ },
187
+ {
188
+ "id": 8,
189
+ "type": "VAEDecode",
190
+ "pos": [
191
+ 1564,
192
+ 824
193
+ ],
194
+ "size": {
195
+ "0": 140,
196
+ "1": 60
197
+ },
198
+ "flags": {
199
+ "collapsed": true,
200
+ "pinned": true
201
+ },
202
+ "order": 16,
203
+ "mode": 0,
204
+ "inputs": [
205
+ {
206
+ "name": "samples",
207
+ "type": "LATENT",
208
+ "link": 7
209
+ },
210
+ {
211
+ "name": "vae",
212
+ "type": "VAE",
213
+ "link": 42
214
+ }
215
+ ],
216
+ "outputs": [
217
+ {
218
+ "name": "IMAGE",
219
+ "type": "IMAGE",
220
+ "links": [
221
+ 26,
222
+ 58
223
+ ],
224
+ "slot_index": 0
225
+ }
226
+ ],
227
+ "properties": {
228
+ "Node name for S&R": "VAEDecode"
229
+ }
230
+ },
231
+ {
232
+ "id": 5,
233
+ "type": "EmptyLatentImage",
234
+ "pos": [
235
+ 671,
236
+ 965
237
+ ],
238
+ "size": {
239
+ "0": 220,
240
+ "1": 106
241
+ },
242
+ "flags": {
243
+ "pinned": true
244
+ },
245
+ "order": 2,
246
+ "mode": 0,
247
+ "outputs": [
248
+ {
249
+ "name": "LATENT",
250
+ "type": "LATENT",
251
+ "links": [
252
+ 2
253
+ ],
254
+ "slot_index": 0
255
+ }
256
+ ],
257
+ "properties": {
258
+ "Node name for S&R": "EmptyLatentImage"
259
+ },
260
+ "widgets_values": [
261
+ 768,
262
+ 768,
263
+ 1
264
+ ]
265
+ },
266
+ {
267
+ "id": 44,
268
+ "type": "LoraLoader",
269
+ "pos": [
270
+ -43,
271
+ 1347
272
+ ],
273
+ "size": {
274
+ "0": 375.6583251953125,
275
+ "1": 142.3330535888672
276
+ },
277
+ "flags": {
278
+ "pinned": true
279
+ },
280
+ "order": 10,
281
+ "mode": 4,
282
+ "inputs": [
283
+ {
284
+ "name": "model",
285
+ "type": "MODEL",
286
+ "link": 68
287
+ },
288
+ {
289
+ "name": "clip",
290
+ "type": "CLIP",
291
+ "link": 69,
292
+ "slot_index": 1
293
+ }
294
+ ],
295
+ "outputs": [
296
+ {
297
+ "name": "MODEL",
298
+ "type": "MODEL",
299
+ "links": [],
300
+ "shape": 3,
301
+ "slot_index": 0
302
+ },
303
+ {
304
+ "name": "CLIP",
305
+ "type": "CLIP",
306
+ "links": [],
307
+ "shape": 3,
308
+ "slot_index": 1
309
+ }
310
+ ],
311
+ "properties": {
312
+ "Node name for S&R": "LoraLoader"
313
+ },
314
+ "widgets_values": [
315
+ "rinsu.safetensors",
316
+ -0.8,
317
+ 0.6
318
+ ]
319
+ },
320
+ {
321
+ "id": 36,
322
+ "type": "UltimateSDUpscale",
323
+ "pos": [
324
+ 1267.3815238787731,
325
+ 2587.420032772362
326
+ ],
327
+ "size": {
328
+ "0": 315,
329
+ "1": 826.0001220703125
330
+ },
331
+ "flags": {
332
+ "pinned": true
333
+ },
334
+ "order": 19,
335
+ "mode": 4,
336
+ "inputs": [
337
+ {
338
+ "name": "image",
339
+ "type": "IMAGE",
340
+ "link": 58
341
+ },
342
+ {
343
+ "name": "model",
344
+ "type": "MODEL",
345
+ "link": 59
346
+ },
347
+ {
348
+ "name": "positive",
349
+ "type": "CONDITIONING",
350
+ "link": 51
351
+ },
352
+ {
353
+ "name": "negative",
354
+ "type": "CONDITIONING",
355
+ "link": 52
356
+ },
357
+ {
358
+ "name": "vae",
359
+ "type": "VAE",
360
+ "link": 53
361
+ },
362
+ {
363
+ "name": "upscale_model",
364
+ "type": "UPSCALE_MODEL",
365
+ "link": 50
366
+ }
367
+ ],
368
+ "outputs": [
369
+ {
370
+ "name": "IMAGE",
371
+ "type": "IMAGE",
372
+ "links": [
373
+ 56
374
+ ],
375
+ "shape": 3,
376
+ "slot_index": 0
377
+ }
378
+ ],
379
+ "properties": {
380
+ "Node name for S&R": "UltimateSDUpscale"
381
+ },
382
+ "widgets_values": [
383
+ 2,
384
+ 126293332263669,
385
+ "randomize",
386
+ 20,
387
+ 8,
388
+ "dpmpp_3m_sde_gpu",
389
+ "simple",
390
+ 0.2,
391
+ "Linear",
392
+ 512,
393
+ 512,
394
+ 8,
395
+ 32,
396
+ "None",
397
+ 0.75,
398
+ 64,
399
+ 8,
400
+ 16,
401
+ true,
402
+ false
403
+ ]
404
+ },
405
+ {
406
+ "id": 21,
407
+ "type": "VAEDecode",
408
+ "pos": [
409
+ 2419,
410
+ 204
411
+ ],
412
+ "size": {
413
+ "0": 210,
414
+ "1": 46
415
+ },
416
+ "flags": {
417
+ "pinned": true,
418
+ "collapsed": true
419
+ },
420
+ "order": 22,
421
+ "mode": 0,
422
+ "inputs": [
423
+ {
424
+ "name": "samples",
425
+ "type": "LATENT",
426
+ "link": 84
427
+ },
428
+ {
429
+ "name": "vae",
430
+ "type": "VAE",
431
+ "link": 22
432
+ }
433
+ ],
434
+ "outputs": [
435
+ {
436
+ "name": "IMAGE",
437
+ "type": "IMAGE",
438
+ "links": [
439
+ 47,
440
+ 72
441
+ ],
442
+ "shape": 3,
443
+ "slot_index": 0
444
+ }
445
+ ],
446
+ "properties": {
447
+ "Node name for S&R": "VAEDecode"
448
+ }
449
+ },
450
+ {
451
+ "id": 42,
452
+ "type": "Upscale Model Loader",
453
+ "pos": [
454
+ 2946,
455
+ 223
456
+ ],
457
+ "size": {
458
+ "0": 315,
459
+ "1": 78
460
+ },
461
+ "flags": {
462
+ "pinned": true
463
+ },
464
+ "order": 3,
465
+ "mode": 4,
466
+ "outputs": [
467
+ {
468
+ "name": "UPSCALE_MODEL",
469
+ "type": "UPSCALE_MODEL",
470
+ "links": [
471
+ 63
472
+ ],
473
+ "shape": 3
474
+ },
475
+ {
476
+ "name": "MODEL_NAME_TEXT",
477
+ "type": "STRING",
478
+ "links": null,
479
+ "shape": 3
480
+ }
481
+ ],
482
+ "properties": {
483
+ "Node name for S&R": "Upscale Model Loader"
484
+ },
485
+ "widgets_values": [
486
+ "4x-UltraSharp.pth"
487
+ ]
488
+ },
489
+ {
490
+ "id": 17,
491
+ "type": "LoadImage",
492
+ "pos": [
493
+ 96,
494
+ 75
495
+ ],
496
+ "size": {
497
+ "0": 303.7067565917969,
498
+ "1": 314
499
+ },
500
+ "flags": {
501
+ "pinned": true
502
+ },
503
+ "order": 4,
504
+ "mode": 4,
505
+ "outputs": [
506
+ {
507
+ "name": "IMAGE",
508
+ "type": "IMAGE",
509
+ "links": [
510
+ 13
511
+ ],
512
+ "shape": 3,
513
+ "slot_index": 0
514
+ },
515
+ {
516
+ "name": "MASK",
517
+ "type": "MASK",
518
+ "links": null,
519
+ "shape": 3
520
+ }
521
+ ],
522
+ "properties": {
523
+ "Node name for S&R": "LoadImage"
524
+ },
525
+ "widgets_values": [
526
+ "b233e11c-1f75-4b85-95da-863d8acb31eb.png",
527
+ "image"
528
+ ]
529
+ },
530
+ {
531
+ "id": 19,
532
+ "type": "ControlNetLoader",
533
+ "pos": [
534
+ 78,
535
+ -34
536
+ ],
537
+ "size": {
538
+ "0": 383.4540100097656,
539
+ "1": 61.93418884277344
540
+ },
541
+ "flags": {
542
+ "pinned": true
543
+ },
544
+ "order": 5,
545
+ "mode": 4,
546
+ "outputs": [
547
+ {
548
+ "name": "CONTROL_NET",
549
+ "type": "CONTROL_NET",
550
+ "links": [
551
+ 16
552
+ ],
553
+ "shape": 3,
554
+ "slot_index": 0
555
+ }
556
+ ],
557
+ "properties": {
558
+ "Node name for S&R": "ControlNetLoader"
559
+ },
560
+ "widgets_values": [
561
+ "control_v11e_sd15_ip2p_fp16.safetensors"
562
+ ]
563
+ },
564
+ {
565
+ "id": 39,
566
+ "type": "SaveImage",
567
+ "pos": [
568
+ 3437,
569
+ 301
570
+ ],
571
+ "size": {
572
+ "0": 489.2552185058594,
573
+ "1": 557.1204223632812
574
+ },
575
+ "flags": {
576
+ "pinned": true
577
+ },
578
+ "order": 25,
579
+ "mode": 4,
580
+ "inputs": [
581
+ {
582
+ "name": "images",
583
+ "type": "IMAGE",
584
+ "link": 57
585
+ }
586
+ ],
587
+ "properties": {},
588
+ "widgets_values": [
589
+ "ComfyUI"
590
+ ]
591
+ },
592
+ {
593
+ "id": 49,
594
+ "type": "CLIPSetLastLayer",
595
+ "pos": [
596
+ 532,
597
+ 690
598
+ ],
599
+ "size": {
600
+ "0": 315,
601
+ "1": 58
602
+ },
603
+ "flags": {
604
+ "pinned": true
605
+ },
606
+ "order": 12,
607
+ "mode": 4,
608
+ "inputs": [
609
+ {
610
+ "name": "clip",
611
+ "type": "CLIP",
612
+ "link": 88
613
+ }
614
+ ],
615
+ "outputs": [
616
+ {
617
+ "name": "CLIP",
618
+ "type": "CLIP",
619
+ "links": [
620
+ 87
621
+ ],
622
+ "shape": 3,
623
+ "slot_index": 0
624
+ }
625
+ ],
626
+ "properties": {
627
+ "Node name for S&R": "CLIPSetLastLayer"
628
+ },
629
+ "widgets_values": [
630
+ -2
631
+ ]
632
+ },
633
+ {
634
+ "id": 26,
635
+ "type": "LoraLoader",
636
+ "pos": [
637
+ 106,
638
+ 1146
639
+ ],
640
+ "size": {
641
+ "0": 375.6583251953125,
642
+ "1": 142.3330535888672
643
+ },
644
+ "flags": {
645
+ "pinned": true
646
+ },
647
+ "order": 11,
648
+ "mode": 4,
649
+ "inputs": [
650
+ {
651
+ "name": "model",
652
+ "type": "MODEL",
653
+ "link": 81
654
+ },
655
+ {
656
+ "name": "clip",
657
+ "type": "CLIP",
658
+ "link": 80,
659
+ "slot_index": 1
660
+ }
661
+ ],
662
+ "outputs": [
663
+ {
664
+ "name": "MODEL",
665
+ "type": "MODEL",
666
+ "links": [],
667
+ "shape": 3,
668
+ "slot_index": 0
669
+ },
670
+ {
671
+ "name": "CLIP",
672
+ "type": "CLIP",
673
+ "links": [
674
+ 88
675
+ ],
676
+ "shape": 3,
677
+ "slot_index": 1
678
+ }
679
+ ],
680
+ "properties": {
681
+ "Node name for S&R": "LoraLoader"
682
+ },
683
+ "widgets_values": [
684
+ "rinsu.safetensors",
685
+ 0.4,
686
+ 1
687
+ ]
688
+ },
689
+ {
690
+ "id": 9,
691
+ "type": "SaveImage",
692
+ "pos": [
693
+ 3033,
694
+ 1041
695
+ ],
696
+ "size": {
697
+ "0": 1060.7767333984375,
698
+ "1": 1143.7291259765625
699
+ },
700
+ "flags": {
701
+ "pinned": true
702
+ },
703
+ "order": 24,
704
+ "mode": 0,
705
+ "inputs": [
706
+ {
707
+ "name": "images",
708
+ "type": "IMAGE",
709
+ "link": 72
710
+ }
711
+ ],
712
+ "properties": {},
713
+ "widgets_values": [
714
+ "Result"
715
+ ]
716
+ },
717
+ {
718
+ "id": 15,
719
+ "type": "VAELoader",
720
+ "pos": [
721
+ 931,
722
+ 1165
723
+ ],
724
+ "size": {
725
+ "0": 413.84197998046875,
726
+ "1": 74.43359375
727
+ },
728
+ "flags": {
729
+ "pinned": true
730
+ },
731
+ "order": 6,
732
+ "mode": 0,
733
+ "outputs": [
734
+ {
735
+ "name": "VAE",
736
+ "type": "VAE",
737
+ "links": [
738
+ 22,
739
+ 42,
740
+ 53
741
+ ],
742
+ "shape": 3,
743
+ "slot_index": 0
744
+ }
745
+ ],
746
+ "properties": {
747
+ "Node name for S&R": "VAELoader"
748
+ },
749
+ "widgets_values": [
750
+ "sdxl-vae-fp16-fix.safetensors"
751
+ ]
752
+ },
753
+ {
754
+ "id": 43,
755
+ "type": "LoraLoader",
756
+ "pos": [
757
+ -431,
758
+ 1170
759
+ ],
760
+ "size": {
761
+ "0": 375.6583251953125,
762
+ "1": 142.3330535888672
763
+ },
764
+ "flags": {
765
+ "pinned": true
766
+ },
767
+ "order": 8,
768
+ "mode": 4,
769
+ "inputs": [
770
+ {
771
+ "name": "model",
772
+ "type": "MODEL",
773
+ "link": 65
774
+ },
775
+ {
776
+ "name": "clip",
777
+ "type": "CLIP",
778
+ "link": 64,
779
+ "slot_index": 1
780
+ }
781
+ ],
782
+ "outputs": [
783
+ {
784
+ "name": "MODEL",
785
+ "type": "MODEL",
786
+ "links": [
787
+ 68,
788
+ 81
789
+ ],
790
+ "shape": 3,
791
+ "slot_index": 0
792
+ },
793
+ {
794
+ "name": "CLIP",
795
+ "type": "CLIP",
796
+ "links": [
797
+ 69,
798
+ 80
799
+ ],
800
+ "shape": 3,
801
+ "slot_index": 1
802
+ }
803
+ ],
804
+ "properties": {
805
+ "Node name for S&R": "LoraLoader"
806
+ },
807
+ "widgets_values": [
808
+ "Concept Art Eclipse Style LoRA_Pony XL v6.safetensors",
809
+ 0.8,
810
+ 1
811
+ ]
812
+ },
813
+ {
814
+ "id": 4,
815
+ "type": "CheckpointLoaderSimple",
816
+ "pos": [
817
+ -103,
818
+ 600
819
+ ],
820
+ "size": {
821
+ "0": 474.97015380859375,
822
+ "1": 106.655029296875
823
+ },
824
+ "flags": {
825
+ "pinned": true
826
+ },
827
+ "order": 7,
828
+ "mode": 0,
829
+ "outputs": [
830
+ {
831
+ "name": "MODEL",
832
+ "type": "MODEL",
833
+ "links": [
834
+ 59,
835
+ 65,
836
+ 91,
837
+ 92
838
+ ],
839
+ "slot_index": 0
840
+ },
841
+ {
842
+ "name": "CLIP",
843
+ "type": "CLIP",
844
+ "links": [
845
+ 64,
846
+ 94
847
+ ],
848
+ "slot_index": 1
849
+ },
850
+ {
851
+ "name": "VAE",
852
+ "type": "VAE",
853
+ "links": [],
854
+ "slot_index": 2
855
+ }
856
+ ],
857
+ "properties": {
858
+ "Node name for S&R": "CheckpointLoaderSimple"
859
+ },
860
+ "widgets_values": [
861
+ "ponyFaetality_v11.safetensors"
862
+ ]
863
+ },
864
+ {
865
+ "id": 20,
866
+ "type": "KSampler",
867
+ "pos": [
868
+ 2140,
869
+ 1494
870
+ ],
871
+ "size": {
872
+ "0": 581.1424560546875,
873
+ "1": 769.4693603515625
874
+ },
875
+ "flags": {
876
+ "pinned": true
877
+ },
878
+ "order": 20,
879
+ "mode": 0,
880
+ "inputs": [
881
+ {
882
+ "name": "model",
883
+ "type": "MODEL",
884
+ "link": 92
885
+ },
886
+ {
887
+ "name": "positive",
888
+ "type": "CONDITIONING",
889
+ "link": 19
890
+ },
891
+ {
892
+ "name": "negative",
893
+ "type": "CONDITIONING",
894
+ "link": 90,
895
+ "slot_index": 2
896
+ },
897
+ {
898
+ "name": "latent_image",
899
+ "type": "LATENT",
900
+ "link": 93
901
+ }
902
+ ],
903
+ "outputs": [
904
+ {
905
+ "name": "LATENT",
906
+ "type": "LATENT",
907
+ "links": [
908
+ 84
909
+ ],
910
+ "shape": 3,
911
+ "slot_index": 0
912
+ }
913
+ ],
914
+ "properties": {
915
+ "Node name for S&R": "KSampler"
916
+ },
917
+ "widgets_values": [
918
+ 564878790558952,
919
+ "randomize",
920
+ 25,
921
+ 12,
922
+ "dpmpp_2m",
923
+ "normal",
924
+ 0.7000000000000001
925
+ ]
926
+ },
927
+ {
928
+ "id": 3,
929
+ "type": "KSampler",
930
+ "pos": [
931
+ 1384,
932
+ 1506
933
+ ],
934
+ "size": {
935
+ "0": 705.0689086914062,
936
+ "1": 792.4580688476562
937
+ },
938
+ "flags": {
939
+ "pinned": true
940
+ },
941
+ "order": 15,
942
+ "mode": 0,
943
+ "inputs": [
944
+ {
945
+ "name": "model",
946
+ "type": "MODEL",
947
+ "link": 91
948
+ },
949
+ {
950
+ "name": "positive",
951
+ "type": "CONDITIONING",
952
+ "link": 41
953
+ },
954
+ {
955
+ "name": "negative",
956
+ "type": "CONDITIONING",
957
+ "link": 6
958
+ },
959
+ {
960
+ "name": "latent_image",
961
+ "type": "LATENT",
962
+ "link": 2
963
+ }
964
+ ],
965
+ "outputs": [
966
+ {
967
+ "name": "LATENT",
968
+ "type": "LATENT",
969
+ "links": [
970
+ 7,
971
+ 30
972
+ ],
973
+ "slot_index": 0
974
+ }
975
+ ],
976
+ "properties": {
977
+ "Node name for S&R": "KSampler"
978
+ },
979
+ "widgets_values": [
980
+ 614957992944534,
981
+ "randomize",
982
+ 30,
983
+ 10,
984
+ "dpmpp_2m",
985
+ "karras",
986
+ 1
987
+ ]
988
+ },
989
+ {
990
+ "id": 24,
991
+ "type": "Preview from image [Crystools]",
992
+ "pos": [
993
+ 780,
994
+ 1386
995
+ ],
996
+ "size": {
997
+ "0": 512.8680419921875,
998
+ "1": 296
999
+ },
1000
+ "flags": {
1001
+ "pinned": true
1002
+ },
1003
+ "order": 18,
1004
+ "mode": 0,
1005
+ "inputs": [
1006
+ {
1007
+ "name": "image",
1008
+ "type": "IMAGE",
1009
+ "link": 26
1010
+ }
1011
+ ],
1012
+ "outputs": [
1013
+ {
1014
+ "name": "Metadata RAW",
1015
+ "type": "METADATA_RAW",
1016
+ "links": [],
1017
+ "shape": 3,
1018
+ "slot_index": 0
1019
+ }
1020
+ ],
1021
+ "properties": {
1022
+ "Node name for S&R": "Preview from image [Crystools]"
1023
+ }
1024
+ },
1025
+ {
1026
+ "id": 22,
1027
+ "type": "LatentUpscaleBy",
1028
+ "pos": [
1029
+ 1660,
1030
+ 1342
1031
+ ],
1032
+ "size": {
1033
+ "0": 326.3993225097656,
1034
+ "1": 109.67085266113281
1035
+ },
1036
+ "flags": {
1037
+ "pinned": true
1038
+ },
1039
+ "order": 17,
1040
+ "mode": 0,
1041
+ "inputs": [
1042
+ {
1043
+ "name": "samples",
1044
+ "type": "LATENT",
1045
+ "link": 30
1046
+ }
1047
+ ],
1048
+ "outputs": [
1049
+ {
1050
+ "name": "LATENT",
1051
+ "type": "LATENT",
1052
+ "links": [
1053
+ 93
1054
+ ],
1055
+ "shape": 3,
1056
+ "slot_index": 0
1057
+ }
1058
+ ],
1059
+ "properties": {
1060
+ "Node name for S&R": "LatentUpscaleBy"
1061
+ },
1062
+ "widgets_values": [
1063
+ "bicubic",
1064
+ 2
1065
+ ]
1066
+ },
1067
+ {
1068
+ "id": 7,
1069
+ "type": "CLIPTextEncode",
1070
+ "pos": [
1071
+ 2128,
1072
+ 1147
1073
+ ],
1074
+ "size": {
1075
+ "0": 675.4071655273438,
1076
+ "1": 126.65140533447266
1077
+ },
1078
+ "flags": {
1079
+ "pinned": true
1080
+ },
1081
+ "order": 9,
1082
+ "mode": 0,
1083
+ "inputs": [
1084
+ {
1085
+ "name": "clip",
1086
+ "type": "CLIP",
1087
+ "link": 94
1088
+ }
1089
+ ],
1090
+ "outputs": [
1091
+ {
1092
+ "name": "CONDITIONING",
1093
+ "type": "CONDITIONING",
1094
+ "links": [
1095
+ 6,
1096
+ 52,
1097
+ 90
1098
+ ],
1099
+ "slot_index": 0
1100
+ }
1101
+ ],
1102
+ "title": "CLIP Text Encode (Negative)",
1103
+ "properties": {
1104
+ "Node name for S&R": "CLIPTextEncode"
1105
+ },
1106
+ "widgets_values": [
1107
+ "bad anatomy,bad hands,cropped,poorly drawn hands,out of focus,monochrome,symbol,text,logo,lowres,signature,(worst quality, low quality:1.6),(depth of field, blurry:1.2),negative_hand-neg,white background,white borders,cornertext,clone,futa,erect,torn,latex,tan,sticky,watermark,belly,(((pov))),areola,"
1108
+ ],
1109
+ "color": "#322",
1110
+ "bgcolor": "#533"
1111
+ },
1112
+ {
1113
+ "id": 6,
1114
+ "type": "CLIPTextEncode",
1115
+ "pos": [
1116
+ 2112,
1117
+ 733
1118
+ ],
1119
+ "size": {
1120
+ "0": 611.1375732421875,
1121
+ "1": 233.0787353515625
1122
+ },
1123
+ "flags": {
1124
+ "collapsed": false,
1125
+ "pinned": true
1126
+ },
1127
+ "order": 13,
1128
+ "mode": 0,
1129
+ "inputs": [
1130
+ {
1131
+ "name": "clip",
1132
+ "type": "CLIP",
1133
+ "link": 87
1134
+ }
1135
+ ],
1136
+ "outputs": [
1137
+ {
1138
+ "name": "CONDITIONING",
1139
+ "type": "CONDITIONING",
1140
+ "links": [
1141
+ 14,
1142
+ 19,
1143
+ 51
1144
+ ],
1145
+ "slot_index": 0
1146
+ }
1147
+ ],
1148
+ "title": "CLIP Text Encode (Positive)",
1149
+ "properties": {
1150
+ "Node name for S&R": "CLIPTextEncode"
1151
+ },
1152
+ "widgets_values": [
1153
+ "score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, digital painting, girl"
1154
+ ],
1155
+ "color": "#232",
1156
+ "bgcolor": "#353"
1157
+ }
1158
+ ],
1159
+ "links": [
1160
+ [
1161
+ 2,
1162
+ 5,
1163
+ 0,
1164
+ 3,
1165
+ 3,
1166
+ "LATENT"
1167
+ ],
1168
+ [
1169
+ 6,
1170
+ 7,
1171
+ 0,
1172
+ 3,
1173
+ 2,
1174
+ "CONDITIONING"
1175
+ ],
1176
+ [
1177
+ 7,
1178
+ 3,
1179
+ 0,
1180
+ 8,
1181
+ 0,
1182
+ "LATENT"
1183
+ ],
1184
+ [
1185
+ 13,
1186
+ 17,
1187
+ 0,
1188
+ 18,
1189
+ 2,
1190
+ "IMAGE"
1191
+ ],
1192
+ [
1193
+ 14,
1194
+ 6,
1195
+ 0,
1196
+ 18,
1197
+ 0,
1198
+ "CONDITIONING"
1199
+ ],
1200
+ [
1201
+ 16,
1202
+ 19,
1203
+ 0,
1204
+ 18,
1205
+ 1,
1206
+ "CONTROL_NET"
1207
+ ],
1208
+ [
1209
+ 19,
1210
+ 6,
1211
+ 0,
1212
+ 20,
1213
+ 1,
1214
+ "CONDITIONING"
1215
+ ],
1216
+ [
1217
+ 22,
1218
+ 15,
1219
+ 0,
1220
+ 21,
1221
+ 1,
1222
+ "VAE"
1223
+ ],
1224
+ [
1225
+ 26,
1226
+ 8,
1227
+ 0,
1228
+ 24,
1229
+ 0,
1230
+ "IMAGE"
1231
+ ],
1232
+ [
1233
+ 30,
1234
+ 3,
1235
+ 0,
1236
+ 22,
1237
+ 0,
1238
+ "LATENT"
1239
+ ],
1240
+ [
1241
+ 41,
1242
+ 18,
1243
+ 0,
1244
+ 3,
1245
+ 1,
1246
+ "CONDITIONING"
1247
+ ],
1248
+ [
1249
+ 42,
1250
+ 15,
1251
+ 0,
1252
+ 8,
1253
+ 1,
1254
+ "VAE"
1255
+ ],
1256
+ [
1257
+ 47,
1258
+ 21,
1259
+ 0,
1260
+ 30,
1261
+ 1,
1262
+ "IMAGE"
1263
+ ],
1264
+ [
1265
+ 50,
1266
+ 34,
1267
+ 0,
1268
+ 36,
1269
+ 5,
1270
+ "UPSCALE_MODEL"
1271
+ ],
1272
+ [
1273
+ 51,
1274
+ 6,
1275
+ 0,
1276
+ 36,
1277
+ 2,
1278
+ "CONDITIONING"
1279
+ ],
1280
+ [
1281
+ 52,
1282
+ 7,
1283
+ 0,
1284
+ 36,
1285
+ 3,
1286
+ "CONDITIONING"
1287
+ ],
1288
+ [
1289
+ 53,
1290
+ 15,
1291
+ 0,
1292
+ 36,
1293
+ 4,
1294
+ "VAE"
1295
+ ],
1296
+ [
1297
+ 56,
1298
+ 36,
1299
+ 0,
1300
+ 38,
1301
+ 0,
1302
+ "IMAGE"
1303
+ ],
1304
+ [
1305
+ 57,
1306
+ 30,
1307
+ 0,
1308
+ 39,
1309
+ 0,
1310
+ "IMAGE"
1311
+ ],
1312
+ [
1313
+ 58,
1314
+ 8,
1315
+ 0,
1316
+ 36,
1317
+ 0,
1318
+ "IMAGE"
1319
+ ],
1320
+ [
1321
+ 59,
1322
+ 4,
1323
+ 0,
1324
+ 36,
1325
+ 1,
1326
+ "MODEL"
1327
+ ],
1328
+ [
1329
+ 63,
1330
+ 42,
1331
+ 0,
1332
+ 30,
1333
+ 0,
1334
+ "UPSCALE_MODEL"
1335
+ ],
1336
+ [
1337
+ 64,
1338
+ 4,
1339
+ 1,
1340
+ 43,
1341
+ 1,
1342
+ "CLIP"
1343
+ ],
1344
+ [
1345
+ 65,
1346
+ 4,
1347
+ 0,
1348
+ 43,
1349
+ 0,
1350
+ "MODEL"
1351
+ ],
1352
+ [
1353
+ 68,
1354
+ 43,
1355
+ 0,
1356
+ 44,
1357
+ 0,
1358
+ "MODEL"
1359
+ ],
1360
+ [
1361
+ 69,
1362
+ 43,
1363
+ 1,
1364
+ 44,
1365
+ 1,
1366
+ "CLIP"
1367
+ ],
1368
+ [
1369
+ 72,
1370
+ 21,
1371
+ 0,
1372
+ 9,
1373
+ 0,
1374
+ "IMAGE"
1375
+ ],
1376
+ [
1377
+ 80,
1378
+ 43,
1379
+ 1,
1380
+ 26,
1381
+ 1,
1382
+ "CLIP"
1383
+ ],
1384
+ [
1385
+ 81,
1386
+ 43,
1387
+ 0,
1388
+ 26,
1389
+ 0,
1390
+ "MODEL"
1391
+ ],
1392
+ [
1393
+ 84,
1394
+ 20,
1395
+ 0,
1396
+ 21,
1397
+ 0,
1398
+ "LATENT"
1399
+ ],
1400
+ [
1401
+ 87,
1402
+ 49,
1403
+ 0,
1404
+ 6,
1405
+ 0,
1406
+ "CLIP"
1407
+ ],
1408
+ [
1409
+ 88,
1410
+ 26,
1411
+ 1,
1412
+ 49,
1413
+ 0,
1414
+ "CLIP"
1415
+ ],
1416
+ [
1417
+ 90,
1418
+ 7,
1419
+ 0,
1420
+ 20,
1421
+ 2,
1422
+ "CONDITIONING"
1423
+ ],
1424
+ [
1425
+ 91,
1426
+ 4,
1427
+ 0,
1428
+ 3,
1429
+ 0,
1430
+ "MODEL"
1431
+ ],
1432
+ [
1433
+ 92,
1434
+ 4,
1435
+ 0,
1436
+ 20,
1437
+ 0,
1438
+ "MODEL"
1439
+ ],
1440
+ [
1441
+ 93,
1442
+ 22,
1443
+ 0,
1444
+ 20,
1445
+ 3,
1446
+ "LATENT"
1447
+ ],
1448
+ [
1449
+ 94,
1450
+ 4,
1451
+ 1,
1452
+ 7,
1453
+ 0,
1454
+ "CLIP"
1455
+ ]
1456
+ ],
1457
+ "groups": [
1458
+ {
1459
+ "title": "Group",
1460
+ "bounding": [
1461
+ 2917,
1462
+ 19,
1463
+ 1045,
1464
+ 873
1465
+ ],
1466
+ "color": "#A88",
1467
+ "font_size": 24,
1468
+ "locked": false
1469
+ },
1470
+ {
1471
+ "title": "Group",
1472
+ "bounding": [
1473
+ -75,
1474
+ -148,
1475
+ 988,
1476
+ 598
1477
+ ],
1478
+ "color": "#3f789e",
1479
+ "font_size": 24,
1480
+ "locked": false
1481
+ },
1482
+ {
1483
+ "title": "Group",
1484
+ "bounding": [
1485
+ 1381,
1486
+ -49,
1487
+ 1237,
1488
+ 731
1489
+ ],
1490
+ "color": "#a1309b",
1491
+ "font_size": 24,
1492
+ "locked": false
1493
+ },
1494
+ {
1495
+ "title": "Group",
1496
+ "bounding": [
1497
+ 706,
1498
+ 2513,
1499
+ 1996,
1500
+ 1215
1501
+ ],
1502
+ "color": "#3f789e",
1503
+ "font_size": 24,
1504
+ "locked": false
1505
+ }
1506
+ ],
1507
+ "config": {},
1508
+ "extra": {},
1509
+ "version": 0.4
1510
+ }