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77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
{
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "pygments_lexer": "ipython3",
      "nbconvert_exporter": "python",
      "version": "3.6.4",
      "file_extension": ".py",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "name": "python",
      "mimetype": "text/x-python"
    },
    "colab": {
      "provenance": [],
      "gpuType": "T4"
    },
    "accelerator": "GPU"
  },
  "nbformat_minor": 0,
  "nbformat": 4,
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "before_downloading = '''# 这个列表仅加载一次 且会等待加载完成再开始安装sd\n",
        "[extensions] # 插件\n",
        "https://github.com/etherealxx/batchlinks-webui.git\n",
        "\n",
        "# 如果你有模型文件需要在启动前加载,可以写在这个下面对应位置\n",
        "\n",
        "[models/Stable-diffusion]                # 大模型列表\n",
        "\n",
        "[models/hypernetworks]                   # hypernetworks文件列表\n",
        "\n",
        "[models/embeddings]                      # embeddings文件列表\n",
        "\n",
        "[models/Lora]                            # Lora文件列表\n",
        "\n",
        "[models/VAE]                             # VAE文件列表\n",
        "https://huggingface.co/Norisuke193/kl-f8-anime2/resolve/main/kl-f8-anime2.vae.pt\n",
        "\n",
        "[extensions/sd-webui-controlnet/models] # controlnet插件的模型列表\n",
        "\n",
        "'''\n",
        "\n",
        "!wget https://huggingface.co/datasets/artdwn/sd1x/resolve/main/token.txt -O /content/ngrok.txt"
      ],
      "metadata": {
        "trusted": true,
        "id": "_HiWIrbtf_Bz"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "async_downloading='''# 这个列表仅加载一次 且不会等待加载完成\n",
        "[extensions] # 插件 如果你没有使用ngrok或者frpc,请不要把插件放在这里加载,因为这里的文件可能在webui启动后才加载完成\n",
        "\n",
        "[models/Stable-diffusion]                # 大模型列表\n",
        "\n",
        "[models/hypernetworks]                   # hypernetworks文件列表\n",
        "\n",
        "[models/embeddings]                      # embeddings文件列表\n",
        "\n",
        "[models/Lora]                            # Lora文件列表\n",
        "\n",
        "[models/VAE]                             # VAE文件列表\n",
        "\n",
        "\n",
        "[extensions/sd-webui-controlnet/models] # controlnet插件的模型列表\n",
        "\n",
        "'''\n"
      ],
      "metadata": {
        "trusted": true,
        "id": "RmEr5mX8f_CO"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "before_start_sync_downloading = '''\n",
        "\n",
        "[models/Stable-diffusion]\n",
        "epiC.safetensors:https://civitai.com/api/download/models/172306\n",
        "\n",
        "[models/hypernetworks]\n",
        "\n",
        "[models/embeddings]\n",
        "\n",
        "[models/Lora]\n",
        "yuukiAsuna_SAO.safetensors:https://civitai.com/api/download/models/157655\n",
        "genshinImpact_Pack.safetensors:https://civitai.com/api/download/models/173569\n",
        "\n",
        "[models/VAE]\n",
        "https://huggingface.co/Norisuke193/kl-f8-anime2/resolve/main/kl-f8-anime2.vae.pt\n",
        "\n",
        "[extensions/sd-webui-controlnet/models]\n",
        "\n",
        "'''"
      ],
      "metadata": {
        "trusted": true,
        "id": "M2NIwTUbf_Cc"
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "sd_start_args='''\n",
        "# --ckpt=mg-Tender.safetensors # 默认模型名称,路径不能包含空格\n",
        "--disable-safe-unpickle\n",
        "--deepdanbooru\n",
        "--no-hashing\n",
        "--no-download-sd-model\n",
        "--administrator\n",
        "--skip-torch-cuda-test\n",
        "--skip-version-check\n",
        "--disable-nan-check\n",
        "# --opt-sdp-attention\n",
        "--opt-sdp-no-mem-attention\n",
        "--xformers-flash-attention\n",
        "--xformers\n",
        "--api\n",
        "--listen\n",
        "--lowram\n",
        "--no-gradio-queue\n",
        "# --share # 默认的内网穿透在kaggle和colab都已经不可用,请考虑其他方案\n",
        "--disable-console-progressbars\n",
        "--no-half-vae\n",
        "# --no-half  #关闭半精度\n",
        "# --enable-console-prompts\n",
        "# --nowebui\n",
        "# --api-auth=2333:6666  # api密码\n",
        "# --gradio-auth=2333:6666 # webui密码\n",
        "'''"
      ],
      "metadata": {
        "trusted": true,
        "id": "tGV3VM-9f_Cm"
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "useGooglrDrive = False\n",
        "useNgrok=True\n",
        "useFrpc=False\n",
        "\n",
        "ngrok_config_or_file = '''\n",
        "/content/ngrok.txt\n",
        "'''\n",
        "frp_config_or_file = '''\n",
        "{input_path}/configs/frpc_litechat.ini\n",
        "'''\n",
        "frp_ssl_dir = '''\n",
        "{input_path}/configs/litechat_nginx\n",
        "'''\n",
        "\n",
        "server_port=7860\n",
        "\n"
      ],
      "metadata": {
        "trusted": true,
        "id": "JZPkEFrWf_Cq"
      },
      "execution_count": 5,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "link_instead_of_copy = True\n",
        "hidden_console_info = False"
      ],
      "metadata": {
        "trusted": true,
        "id": "jLdH8x5ef_Cu"
      },
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import os\n",
        "INIT_WORK_PATH = os.environ['HOME']\n",
        "if os.getenv('INIT_WORK_PATH',''):\n",
        "    INIT_WORK_PATH = os.getenv('INIT_WORK_PATH','')\n",
        "else:\n",
        "    os.environ['INIT_WORK_PATH'] = os.getcwd()\n",
        "%cd {INIT_WORK_PATH}"
      ],
      "metadata": {
        "trusted": true,
        "id": "Du4CCClrf_Cy",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "4b1104d3-b011-4981-c30d-dd8536fc86bb"
      },
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "/root\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "reLoad = True\n",
        "reLoad = False"
      ],
      "metadata": {
        "trusted": true,
        "id": "9uT4KkcUf_C0"
      },
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "if not os.path.exists('start-util.ipynb'):\n",
        "    !wget https://huggingface.co/vorstcavry/colab-force/resolve/main/start-util.ipynb -o log.log\n",
        "%run start-util.ipynb"
      ],
      "metadata": {
        "trusted": true,
        "id": "_cIFw0Ltf_C4"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "!pip install --upgrade ipython ipykernel\n",
        "!pip uninstall jupyter\n",
        "!pip install jupyter\n"
      ],
      "metadata": {
        "id": "3FSVu6gZ1EcX"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "!pip list\n",
        "!pip install packaging\n",
        "!python -m site --user-site\n",
        "!pip install --upgrade pip\n"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "a7Qa406y2GFe",
        "outputId": "37b423f8-b344-42b6-9219-b5c5f0166d9b"
      },
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Package                          Version\n",
            "-------------------------------- ---------------------\n",
            "absl-py                          1.4.0\n",
            "aiohttp                          3.8.5\n",
            "aiosignal                        1.3.1\n",
            "alabaster                        0.7.13\n",
            "albumentations                   1.3.1\n",
            "altair                           4.2.2\n",
            "anyio                            3.7.1\n",
            "appdirs                          1.4.4\n",
            "argon2-cffi                      23.1.0\n",
            "argon2-cffi-bindings             21.2.0\n",
            "array-record                     0.4.1\n",
            "arviz                            0.15.1\n",
            "astropy                          5.3.4\n",
            "asttokens                        2.4.0\n",
            "astunparse                       1.6.3\n",
            "async-timeout                    4.0.3\n",
            "attrs                            23.1.0\n",
            "audioread                        3.0.1\n",
            "autograd                         1.6.2\n",
            "Babel                            2.13.0\n",
            "backcall                         0.2.0\n",
            "beautifulsoup4                   4.11.2\n",
            "bleach                           6.0.0\n",
            "blinker                          1.4\n",
            "blis                             0.7.11\n",
            "blosc2                           2.0.0\n",
            "bokeh                            3.2.2\n",
            "bqplot                           0.12.40\n",
            "branca                           0.6.0\n",
            "build                            1.0.3\n",
            "CacheControl                     0.13.1\n",
            "cachetools                       5.3.1\n",
            "catalogue                        2.0.10\n",
            "certifi                          2023.7.22\n",
            "cffi                             1.16.0\n",
            "chardet                          5.2.0\n",
            "charset-normalizer               3.3.0\n",
            "chex                             0.1.7\n",
            "click                            8.1.7\n",
            "click-plugins                    1.1.1\n",
            "cligj                            0.7.2\n",
            "cloudpickle                      2.2.1\n",
            "cmake                            3.27.6\n",
            "cmdstanpy                        1.2.0\n",
            "colorcet                         3.0.1\n",
            "colorlover                       0.3.0\n",
            "colour                           0.1.5\n",
            "comm                             0.1.4\n",
            "community                        1.0.0b1\n",
            "confection                       0.1.3\n",
            "cons                             0.4.6\n",
            "contextlib2                      21.6.0\n",
            "contourpy                        1.1.1\n",
            "convertdate                      2.4.0\n",
            "cryptography                     41.0.4\n",
            "cufflinks                        0.17.3\n",
            "cupy-cuda11x                     11.0.0\n",
            "cvxopt                           1.3.2\n",
            "cvxpy                            1.3.2\n",
            "cycler                           0.12.0\n",
            "cymem                            2.0.8\n",
            "Cython                           3.0.3\n",
            "dask                             2023.8.1\n",
            "datascience                      0.17.6\n",
            "db-dtypes                        1.1.1\n",
            "dbus-python                      1.2.18\n",
            "debugpy                          1.6.6\n",
            "decorator                        4.4.2\n",
            "defusedxml                       0.7.1\n",
            "distributed                      2023.8.1\n",
            "distro                           1.7.0\n",
            "dlib                             19.24.2\n",
            "dm-tree                          0.1.8\n",
            "docutils                         0.18.1\n",
            "dopamine-rl                      4.0.6\n",
            "duckdb                           0.8.1\n",
            "earthengine-api                  0.1.373\n",
            "easydict                         1.10\n",
            "ecos                             2.0.12\n",
            "editdistance                     0.6.2\n",
            "eerepr                           0.0.4\n",
            "en-core-web-sm                   3.6.0\n",
            "entrypoints                      0.4\n",
            "ephem                            4.1.4\n",
            "et-xmlfile                       1.1.0\n",
            "etils                            1.5.0\n",
            "etuples                          0.3.9\n",
            "exceptiongroup                   1.1.3\n",
            "executing                        2.0.0\n",
            "fastai                           2.7.12\n",
            "fastcore                         1.5.29\n",
            "fastdownload                     0.0.7\n",
            "fastjsonschema                   2.18.1\n",
            "fastprogress                     1.0.3\n",
            "fastrlock                        0.8.2\n",
            "filelock                         3.12.4\n",
            "Fiona                            1.9.4.post1\n",
            "firebase-admin                   5.3.0\n",
            "Flask                            2.2.5\n",
            "flatbuffers                      23.5.26\n",
            "flax                             0.7.4\n",
            "folium                           0.14.0\n",
            "fonttools                        4.43.0\n",
            "frozendict                       2.3.8\n",
            "frozenlist                       1.4.0\n",
            "fsspec                           2023.6.0\n",
            "future                           0.18.3\n",
            "gast                             0.4.0\n",
            "gcsfs                            2023.6.0\n",
            "GDAL                             3.4.3\n",
            "gdown                            4.6.6\n",
            "geemap                           0.28.2\n",
            "gensim                           4.3.2\n",
            "geocoder                         1.38.1\n",
            "geographiclib                    2.0\n",
            "geopandas                        0.13.2\n",
            "geopy                            2.3.0\n",
            "gin-config                       0.5.0\n",
            "glob2                            0.7\n",
            "google                           2.0.3\n",
            "google-api-core                  2.11.1\n",
            "google-api-python-client         2.84.0\n",
            "google-auth                      2.17.3\n",
            "google-auth-httplib2             0.1.1\n",
            "google-auth-oauthlib             1.0.0\n",
            "google-cloud-bigquery            3.10.0\n",
            "google-cloud-bigquery-connection 1.12.1\n",
            "google-cloud-bigquery-storage    2.22.0\n",
            "google-cloud-core                2.3.3\n",
            "google-cloud-datastore           2.15.2\n",
            "google-cloud-firestore           2.11.1\n",
            "google-cloud-functions           1.13.3\n",
            "google-cloud-language            2.9.1\n",
            "google-cloud-storage             2.8.0\n",
            "google-cloud-translate           3.11.3\n",
            "google-colab                     1.0.0\n",
            "google-crc32c                    1.5.0\n",
            "google-pasta                     0.2.0\n",
            "google-resumable-media           2.6.0\n",
            "googleapis-common-protos         1.60.0\n",
            "googledrivedownloader            0.4\n",
            "graphviz                         0.20.1\n",
            "greenlet                         3.0.0\n",
            "grpc-google-iam-v1               0.12.6\n",
            "grpcio                           1.59.0\n",
            "grpcio-status                    1.48.2\n",
            "gspread                          3.4.2\n",
            "gspread-dataframe                3.3.1\n",
            "gym                              0.25.2\n",
            "gym-notices                      0.0.8\n",
            "h5netcdf                         1.2.0\n",
            "h5py                             3.9.0\n",
            "holidays                         0.34\n",
            "holoviews                        1.17.1\n",
            "html5lib                         1.1\n",
            "httpimport                       1.3.1\n",
            "httplib2                         0.22.0\n",
            "huggingface-hub                  0.17.3\n",
            "humanize                         4.7.0\n",
            "hyperopt                         0.2.7\n",
            "idna                             3.4\n",
            "imageio                          2.31.5\n",
            "imageio-ffmpeg                   0.4.9\n",
            "imagesize                        1.4.1\n",
            "imbalanced-learn                 0.10.1\n",
            "imgaug                           0.4.0\n",
            "importlib-metadata               6.8.0\n",
            "importlib-resources              6.1.0\n",
            "imutils                          0.5.4\n",
            "inflect                          7.0.0\n",
            "iniconfig                        2.0.0\n",
            "intel-openmp                     2023.2.0\n",
            "ipyevents                        2.0.2\n",
            "ipyfilechooser                   0.6.0\n",
            "ipykernel                        6.25.2\n",
            "ipyleaflet                       0.17.4\n",
            "ipython                          8.16.1\n",
            "ipython-genutils                 0.2.0\n",
            "ipython-sql                      0.5.0\n",
            "ipytree                          0.2.2\n",
            "ipywidgets                       7.7.1\n",
            "itsdangerous                     2.1.2\n",
            "jax                              0.4.16\n",
            "jaxlib                           0.4.16+cuda11.cudnn86\n",
            "jedi                             0.19.1\n",
            "jeepney                          0.7.1\n",
            "jieba                            0.42.1\n",
            "Jinja2                           3.1.2\n",
            "joblib                           1.3.2\n",
            "jsonpickle                       3.0.2\n",
            "jsonschema                       4.19.1\n",
            "jsonschema-specifications        2023.7.1\n",
            "jupyter                          1.0.0\n",
            "jupyter-client                   6.1.12\n",
            "jupyter-console                  6.1.0\n",
            "jupyter_core                     5.3.2\n",
            "jupyter-server                   1.24.0\n",
            "jupyterlab-pygments              0.2.2\n",
            "jupyterlab-widgets               3.0.9\n",
            "kaggle                           1.5.16\n",
            "keras                            2.13.1\n",
            "keyring                          23.5.0\n",
            "kiwisolver                       1.4.5\n",
            "langcodes                        3.3.0\n",
            "launchpadlib                     1.10.16\n",
            "lazr.restfulclient               0.14.4\n",
            "lazr.uri                         1.0.6\n",
            "lazy_loader                      0.3\n",
            "libclang                         16.0.6\n",
            "librosa                          0.10.1\n",
            "lightgbm                         4.0.0\n",
            "linkify-it-py                    2.0.2\n",
            "lit                              17.0.2\n",
            "llvmlite                         0.39.1\n",
            "locket                           1.0.0\n",
            "logical-unification              0.4.6\n",
            "LunarCalendar                    0.0.9\n",
            "lxml                             4.9.3\n",
            "Markdown                         3.4.4\n",
            "markdown-it-py                   3.0.0\n",
            "MarkupSafe                       2.1.3\n",
            "matplotlib                       3.7.1\n",
            "matplotlib-inline                0.1.6\n",
            "matplotlib-venn                  0.11.9\n",
            "mdit-py-plugins                  0.4.0\n",
            "mdurl                            0.1.2\n",
            "miniKanren                       1.0.3\n",
            "missingno                        0.5.2\n",
            "mistune                          0.8.4\n",
            "mizani                           0.9.3\n",
            "mkl                              2023.2.0\n",
            "ml-dtypes                        0.3.1\n",
            "mlxtend                          0.22.0\n",
            "more-itertools                   10.1.0\n",
            "moviepy                          1.0.3\n",
            "mpmath                           1.3.0\n",
            "msgpack                          1.0.7\n",
            "multidict                        6.0.4\n",
            "multipledispatch                 1.0.0\n",
            "multitasking                     0.0.11\n",
            "murmurhash                       1.0.10\n",
            "music21                          9.1.0\n",
            "natsort                          8.4.0\n",
            "nbclassic                        1.0.0\n",
            "nbclient                         0.8.0\n",
            "nbconvert                        6.5.4\n",
            "nbformat                         5.9.2\n",
            "nest-asyncio                     1.5.8\n",
            "networkx                         3.1\n",
            "nibabel                          4.0.2\n",
            "nltk                             3.8.1\n",
            "notebook                         6.5.5\n",
            "notebook_shim                    0.2.3\n",
            "numba                            0.56.4\n",
            "numexpr                          2.8.7\n",
            "numpy                            1.23.5\n",
            "oauth2client                     4.1.3\n",
            "oauthlib                         3.2.2\n",
            "opencv-contrib-python            4.8.0.76\n",
            "opencv-python                    4.8.0.76\n",
            "opencv-python-headless           4.8.1.78\n",
            "openpyxl                         3.1.2\n",
            "opt-einsum                       3.3.0\n",
            "optax                            0.1.7\n",
            "orbax-checkpoint                 0.4.1\n",
            "osqp                             0.6.2.post8\n",
            "packaging                        23.2\n",
            "pandas                           1.5.3\n",
            "pandas-datareader                0.10.0\n",
            "pandas-gbq                       0.17.9\n",
            "pandocfilters                    1.5.0\n",
            "panel                            1.2.3\n",
            "param                            1.13.0\n",
            "parso                            0.8.3\n",
            "partd                            1.4.1\n",
            "pathlib                          1.0.1\n",
            "pathy                            0.10.2\n",
            "patsy                            0.5.3\n",
            "peewee                           3.16.3\n",
            "pexpect                          4.8.0\n",
            "pickleshare                      0.7.5\n",
            "Pillow                           9.4.0\n",
            "pip                              23.2.1\n",
            "pip-tools                        6.13.0\n",
            "platformdirs                     3.11.0\n",
            "plotly                           5.15.0\n",
            "plotnine                         0.12.3\n",
            "pluggy                           1.3.0\n",
            "polars                           0.17.3\n",
            "pooch                            1.7.0\n",
            "portpicker                       1.5.2\n",
            "prefetch-generator               1.0.3\n",
            "preshed                          3.0.9\n",
            "prettytable                      3.9.0\n",
            "proglog                          0.1.10\n",
            "progressbar2                     4.2.0\n",
            "prometheus-client                0.17.1\n",
            "promise                          2.3\n",
            "prompt-toolkit                   3.0.39\n",
            "prophet                          1.1.4\n",
            "proto-plus                       1.22.3\n",
            "protobuf                         3.20.3\n",
            "psutil                           5.9.5\n",
            "psycopg2                         2.9.9\n",
            "ptyprocess                       0.7.0\n",
            "pure-eval                        0.2.2\n",
            "py-cpuinfo                       9.0.0\n",
            "py4j                             0.10.9.7\n",
            "pyarrow                          9.0.0\n",
            "pyasn1                           0.5.0\n",
            "pyasn1-modules                   0.3.0\n",
            "pycocotools                      2.0.7\n",
            "pycparser                        2.21\n",
            "pyct                             0.5.0\n",
            "pydantic                         1.10.13\n",
            "pydata-google-auth               1.8.2\n",
            "pydot                            1.4.2\n",
            "pydot-ng                         2.0.0\n",
            "pydotplus                        2.0.2\n",
            "PyDrive                          1.3.1\n",
            "PyDrive2                         1.6.3\n",
            "pyerfa                           2.0.0.3\n",
            "pygame                           2.5.2\n",
            "Pygments                         2.16.1\n",
            "PyGObject                        3.42.1\n",
            "PyJWT                            2.3.0\n",
            "pymc                             5.7.2\n",
            "PyMeeus                          0.5.12\n",
            "pymystem3                        0.2.0\n",
            "pyngrok                          7.0.0\n",
            "PyOpenGL                         3.1.7\n",
            "pyOpenSSL                        23.2.0\n",
            "pyparsing                        3.1.1\n",
            "pyperclip                        1.8.2\n",
            "pyproj                           3.6.1\n",
            "pyproject_hooks                  1.0.0\n",
            "pyshp                            2.3.1\n",
            "PySocks                          1.7.1\n",
            "pytensor                         2.14.2\n",
            "pytest                           7.4.2\n",
            "python-apt                       0.0.0\n",
            "python-box                       7.1.1\n",
            "python-dateutil                  2.8.2\n",
            "python-louvain                   0.16\n",
            "python-slugify                   8.0.1\n",
            "python-utils                     3.8.1\n",
            "pytz                             2023.3.post1\n",
            "pyviz_comms                      3.0.0\n",
            "PyWavelets                       1.4.1\n",
            "PyYAML                           6.0.1\n",
            "pyzmq                            23.2.1\n",
            "qdldl                            0.1.7.post0\n",
            "qtconsole                        5.4.4\n",
            "QtPy                             2.4.0\n",
            "qudida                           0.0.4\n",
            "ratelim                          0.1.6\n",
            "referencing                      0.30.2\n",
            "regex                            2023.6.3\n",
            "requests                         2.31.0\n",
            "requests-oauthlib                1.3.1\n",
            "requirements-parser              0.5.0\n",
            "rich                             13.6.0\n",
            "rpds-py                          0.10.4\n",
            "rpy2                             3.4.2\n",
            "rsa                              4.9\n",
            "scikit-image                     0.19.3\n",
            "scikit-learn                     1.2.2\n",
            "scipy                            1.11.3\n",
            "scooby                           0.7.4\n",
            "scs                              3.2.3\n",
            "seaborn                          0.12.2\n",
            "SecretStorage                    3.3.1\n",
            "Send2Trash                       1.8.2\n",
            "setuptools                       67.7.2\n",
            "shapely                          2.0.1\n",
            "six                              1.16.0\n",
            "sklearn-pandas                   2.2.0\n",
            "smart-open                       6.4.0\n",
            "sniffio                          1.3.0\n",
            "snowballstemmer                  2.2.0\n",
            "sortedcontainers                 2.4.0\n",
            "soundfile                        0.12.1\n",
            "soupsieve                        2.5\n",
            "soxr                             0.3.7\n",
            "spacy                            3.6.1\n",
            "spacy-legacy                     3.0.12\n",
            "spacy-loggers                    1.0.5\n",
            "Sphinx                           5.0.2\n",
            "sphinxcontrib-applehelp          1.0.7\n",
            "sphinxcontrib-devhelp            1.0.5\n",
            "sphinxcontrib-htmlhelp           2.0.4\n",
            "sphinxcontrib-jsmath             1.0.1\n",
            "sphinxcontrib-qthelp             1.0.6\n",
            "sphinxcontrib-serializinghtml    1.1.9\n",
            "SQLAlchemy                       2.0.21\n",
            "sqlparse                         0.4.4\n",
            "srsly                            2.4.8\n",
            "stack-data                       0.6.3\n",
            "stanio                           0.3.0\n",
            "statsmodels                      0.14.0\n",
            "sympy                            1.12\n",
            "tables                           3.8.0\n",
            "tabulate                         0.9.0\n",
            "tbb                              2021.10.0\n",
            "tblib                            2.0.0\n",
            "tenacity                         8.2.3\n",
            "tensorboard                      2.13.0\n",
            "tensorboard-data-server          0.7.1\n",
            "tensorflow                       2.13.0\n",
            "tensorflow-datasets              4.9.3\n",
            "tensorflow-estimator             2.13.0\n",
            "tensorflow-gcs-config            2.13.0\n",
            "tensorflow-hub                   0.14.0\n",
            "tensorflow-io-gcs-filesystem     0.34.0\n",
            "tensorflow-metadata              1.14.0\n",
            "tensorflow-probability           0.20.1\n",
            "tensorstore                      0.1.45\n",
            "termcolor                        2.3.0\n",
            "terminado                        0.17.1\n",
            "text-unidecode                   1.3\n",
            "textblob                         0.17.1\n",
            "tf-slim                          1.1.0\n",
            "thinc                            8.1.12\n",
            "threadpoolctl                    3.2.0\n",
            "tifffile                         2023.9.26\n",
            "tinycss2                         1.2.1\n",
            "toml                             0.10.2\n",
            "tomli                            2.0.1\n",
            "toolz                            0.12.0\n",
            "torch                            2.0.1+cu118\n",
            "torchaudio                       2.0.2+cu118\n",
            "torchdata                        0.6.1\n",
            "torchsummary                     1.5.1\n",
            "torchtext                        0.15.2\n",
            "torchvision                      0.15.2+cu118\n",
            "tornado                          6.3.2\n",
            "tqdm                             4.66.1\n",
            "traitlets                        5.7.1\n",
            "traittypes                       0.2.1\n",
            "triton                           2.0.0\n",
            "tweepy                           4.13.0\n",
            "typer                            0.9.0\n",
            "types-setuptools                 68.2.0.0\n",
            "typing_extensions                4.5.0\n",
            "tzlocal                          5.1\n",
            "uc-micro-py                      1.0.2\n",
            "uritemplate                      4.1.1\n",
            "urllib3                          2.0.6\n",
            "vega-datasets                    0.9.0\n",
            "wadllib                          1.3.6\n",
            "wasabi                           1.1.2\n",
            "watchdog                         3.0.0\n",
            "wcwidth                          0.2.8\n",
            "webcolors                        1.13\n",
            "webencodings                     0.5.1\n",
            "websocket-client                 1.6.3\n",
            "Werkzeug                         3.0.0\n",
            "wheel                            0.41.2\n",
            "widgetsnbextension               3.6.6\n",
            "wordcloud                        1.9.2\n",
            "wrapt                            1.15.0\n",
            "xarray                           2023.7.0\n",
            "xarray-einstats                  0.6.0\n",
            "xgboost                          2.0.0\n",
            "xlrd                             2.0.1\n",
            "xyzservices                      2023.10.0\n",
            "yarl                             1.9.2\n",
            "yellowbrick                      1.5\n",
            "yfinance                         0.2.31\n",
            "zict                             3.0.0\n",
            "zipp                             3.17.0\n",
            "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (23.2)\n",
            "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
            "\u001b[0m/root/.local/lib/python3.10/site-packages\n",
            "Requirement already satisfied: pip in /usr/local/lib/python3.10/dist-packages (23.2.1)\n",
            "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
            "\u001b[0m"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "try:\n",
        "    check_gpu()\n",
        "    main()\n",
        "except KeyboardInterrupt:\n",
        "    stop_solo_threads()"
      ],
      "metadata": {
        "execution": {
          "iopub.status.idle": "2023-09-23T13:57:33.428496Z",
          "shell.execute_reply.started": "2023-09-23T13:56:02.582974Z",
          "shell.execute_reply": "2023-09-23T13:57:33.427317Z"
        },
        "trusted": true,
        "id": "xTcOPh8Cf_C8",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "e37d6652-2ab1-46e6-a0d9-0854f7d55db5"
      },
      "execution_count": 12,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "启动 安装和运行环境\n",
            "安装\n",
            "安装 完成\n",
            "链接输出目录\n",
            "链接输出目录 完成\n",
            "当前无huggingface配置,可配置huggingface仓库和token将收藏的图片保存到huggingface仓库\n",
            "安装需要的python环境\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "解压环境\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "等待python环境安装...\n",
            "Python 3.10.12\n",
            "pip 23.1.2 from /root/sdwui/sd_main_dir/venv/lib/python3.10/site-packages/pip (python 3.10)\n",
            "安装需要的python环境 完成\n",
            "使用自定义配置 包括tag翻译 \n",
            "\n",
            "文件 kl-f8-anime2.vae.pt 已存在 /root/sdwui/sd_main_dir/models/VAE\n",
            "当前无huggingface配置,可配置huggingface仓库和token将收藏的图片保存到huggingface仓库\n",
            "加载耗时: 280.95712876319885 秒\n",
            "启动\n",
            "0 --port 7861\n",
            "fatal: No names found, cannot describe anything.\n",
            "Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]\n",
            "Version: 1.6.0\n",
            "Commit hash: fbf9cb020fa9a0615413bc1bb02fa42a8bf73d04\n",
            "Cloning Stable Diffusion into /root/sdwui/sd_main_dir/repositories/stable-diffusion-stability-ai...\n",
            "Cloning into '/root/sdwui/sd_main_dir/repositories/stable-diffusion-stability-ai'...\n",
            "remote: Enumerating objects: 577, done.\u001b[K\n",
            "remote: Counting objects: 100% (307/307), done.\u001b[K\n",
            "remote: Compressing objects: 100% (89/89), done.\u001b[K\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "WARNING:pyngrok.process.ngrok:t=2023-10-10T05:15:33+0000 lvl=warn msg=\"ngrok config file found at legacy location, move to XDG location\" xdg_path=/root/.config/ngrok/ngrok.yml legacy_path=/root/.ngrok2/ngrok.yml\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "ngrok 访问地址:https://2783-35-185-179-250.ngrok-free.app\n",
            "remote: Total 577 (delta 246), reused 219 (delta 218), pack-reused 270\u001b[K\n",
            "Receiving objects: 100% (577/577), 73.43 MiB | 14.76 MiB/s, done.\n",
            "Resolving deltas: 100% (278/278), done.\n",
            "Cloning Stable Diffusion XL into /root/sdwui/sd_main_dir/repositories/generative-models...\n",
            "Cloning into '/root/sdwui/sd_main_dir/repositories/generative-models'...\n",
            "remote: Enumerating objects: 740, done.\u001b[K\n",
            "remote: Counting objects: 100% (393/393), done.\u001b[K\n",
            "remote: Compressing objects: 100% (157/157), done.\u001b[K\n",
            "remote: Total 740 (delta 307), reused 236 (delta 236), pack-reused 347\u001b[K\n",
            "Receiving objects: 100% (740/740), 22.31 MiB | 14.72 MiB/s, done.\n",
            "Resolving deltas: 100% (378/378), done.\n",
            "Cloning K-diffusion into /root/sdwui/sd_main_dir/repositories/k-diffusion...\n",
            "Cloning into '/root/sdwui/sd_main_dir/repositories/k-diffusion'...\n",
            "remote: Enumerating objects: 1291, done.\u001b[K\n",
            "remote: Counting objects: 100% (617/617), done.\u001b[K\n",
            "remote: Compressing objects: 100% (118/118), done.\u001b[K\n",
            "remote: Total 1291 (delta 532), reused 557 (delta 499), pack-reused 674\u001b[K\n",
            "Receiving objects: 100% (1291/1291), 245.87 KiB | 14.46 MiB/s, done.\n",
            "Resolving deltas: 100% (893/893), done.\n",
            "Cloning CodeFormer into /root/sdwui/sd_main_dir/repositories/CodeFormer...\n",
            "Cloning into '/root/sdwui/sd_main_dir/repositories/CodeFormer'...\n",
            "remote: Enumerating objects: 594, done.\u001b[K\n",
            "remote: Counting objects: 100% (245/245), done.\u001b[K\n",
            "remote: Compressing objects: 100% (88/88), done.\u001b[K\n",
            "remote: Total 594 (delta 175), reused 173 (delta 157), pack-reused 349\u001b[K\n",
            "Receiving objects: 100% (594/594), 17.31 MiB | 16.73 MiB/s, done.\n",
            "Resolving deltas: 100% (286/286), done.\n",
            "Cloning BLIP into /root/sdwui/sd_main_dir/repositories/BLIP...\n",
            "Cloning into '/root/sdwui/sd_main_dir/repositories/BLIP'...\n",
            "remote: Enumerating objects: 277, done.\u001b[K\n",
            "remote: Counting objects: 100% (165/165), done.\u001b[K\n",
            "remote: Compressing objects: 100% (30/30), done.\u001b[K\n",
            "remote: Total 277 (delta 137), reused 136 (delta 135), pack-reused 112\u001b[K\n",
            "Receiving objects: 100% (277/277), 7.03 MiB | 4.63 MiB/s, done.\n",
            "Resolving deltas: 100% (152/152), done.\n",
            "Launching Web UI with arguments: --device-id=0 --port 7861 --ui-config-file=/root/sdwui/temp/sd-configs/dist/ui-config.json --ui-settings-file=/root/sdwui/temp/sd-configs/dist/config.json --disable-safe-unpickle --deepdanbooru --no-hashing --no-download-sd-model --administrator --skip-torch-cuda-test --skip-version-check --disable-nan-check --opt-sdp-no-mem-attention --xformers-flash-attention --xformers --api --listen --lowram --disable-console-progressbars --no-half-vae\n",
            "Checkpoint  not found; loading fallback epiC.safetensors\n",
            "Loading weights [None] from /root/sdwui/sd_main_dir/models/Stable-diffusion/epiC.safetensors\n",
            "Running on local URL:  http://0.0.0.0:7861\n",
            "\n",
            "To create a public link, set `share=True` in `launch()`.\n",
            "Startup time: 28.4s (prepare environment: 16.0s, import torch: 5.8s, import gradio: 2.0s, setup paths: 0.7s, initialize shared: 0.3s, other imports: 1.1s, setup codeformer: 0.2s, load scripts: 0.9s, create ui: 1.0s, gradio launch: 0.2s, add APIs: 0.2s).\n",
            "Creating model from config: /root/sdwui/sd_main_dir/configs/v1-inference.yaml\n",
            "Downloading (…)olve/main/vocab.json: 100% 961k/961k [00:00<00:00, 2.10MB/s]\n",
            "Downloading (…)olve/main/merges.txt: 100% 525k/525k [00:00<00:00, 44.3MB/s]\n",
            "Downloading (…)cial_tokens_map.json: 100% 389/389 [00:00<00:00, 2.39MB/s]\n",
            "Downloading (…)okenizer_config.json: 100% 905/905 [00:00<00:00, 3.99MB/s]\n",
            "Downloading (…)lve/main/config.json: 100% 4.52k/4.52k [00:00<00:00, 15.7MB/s]\n",
            "Couldn't find VAE named ; using None instead\n",
            "Applying attention optimization: xformers... done.\n",
            "Model loaded in 15.0s (load weights from disk: 6.9s, create model: 4.0s, apply weights to model: 0.4s, calculate empty prompt: 3.4s).\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# 打包收藏文件夹 如果需要可以取消下面两行的注释\n",
        "# zipPath('$install_path/sd_main_dir/log','log')\n",
        "# !mv {output_path}/log.tar {output_path}/log.tar.bak\n",
        "# createOrUpdateDataSet(f'{output_path}/log.tar.bak','sd-webui-log-bak')\n",
        "\n",
        "# 打包 这一行的结果是 压缩一个目录,并放在 output_path: /content/ 目录下 名字是训练输出.tar\n",
        "# zipPath('$install_path/sd_main_dir/textual_inversion','训练输出')\n",
        "# zipPath('$install_path/sd_main_dir/outputs','outputs')\n",
        "\n",
        "# 打包venv并上传到数据集\n",
        "# zipPath('$install_path/sd_main_dir/venv','venv')\n",
        "# !mv {output_path}/venv.tar /content/venv.tar.bak\n",
        "# createOrUpdateDataSet('/content/venv.tar.bak','sd-webui-venv')\n",
        "\n",
        "# 打包命令参考,--exclude 可以排除不需要打包的目录\n",
        "# !tar -cf $output_path/webui.tar.bak --exclude=venv --exclude=extensions -C /sd_main_dir/ ."
      ],
      "metadata": {
        "trusted": true,
        "id": "JneYrfP-f_C-"
      },
      "execution_count": 13,
      "outputs": []
    }
  ]
}