File size: 71,127 Bytes
bdcea11
1
2
{"cells":[{"cell_type":"markdown","metadata":{},"source":["- 这是一个sd webui启动笔记,启动快速、配置灵活简单,可以免费快速的使用AI绘画。 \n","- kaggle和colab都是AI学习平台,请勿浪费计算资源,如果有需求,可以考虑AutoDL这类租用显卡的平台或者colab付费使用。\n","- 在保持可以免配置直接启动的情况下也提供了很多可自定义的配置,在下方的配置项里,请自行查看。 \n","- 需要安装插件或者下载文件到指定目录,只需要在下方的文件下载列表内写上目标目录和下载链接即可。\n","- 同时安装了ComfyUI,与webui共用大部分模型,通过访问url后加 `/` 和 `/1/` 访问webui,通过加 `/cui/` 和 `/cui2/` 访问ComfyUI。\n","- 安装有文件管理器,通过访问url后加 `/fslist/` 来访问,默认账号`admin`密码`admin`。\n","- 同时也为新人提供了一份基础的帮助文档,包含了一些使用中可能遇到的问题,如果使用过程中有什么疑问,不妨先看看帮助文档。\n","- 如果你需要在此脚本上修改再发布,请随意,但请遵守相关法律法规,文明使用。\n","- 使用时如果遇到问题,尽可能通过帮助文档或者参考已有内容尝试自己解决。\n","- Q群 [816545732](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=OGQydingTPku9M_myV_cscWv6MVaCSde&authKey=RFadQ18FgReFkx7CRs8SNk4vHpxHz%2FD2ojHL3433MehuQOBlnG0hhWFIo8AX%2BFRU&noverify=0&group_code=816545732) ,如果有需要可以进群,其实很多时候多看一下说明文字尝试修改并启动试试比进群询问效率更高。\n","- 使用前可以看一下最后的更新日志,可能有功能更新需要注意,有些功能更新在启动后的输出里面可以看见\n","- 这里可以下载用于查看和解密加密后图片的软件 https://github.com/viyiviyi/encrypt_gallery/releases/\n","- 发布地址 [kaggle stable-diffusion-webui-novelai](https://www.kaggle.com/code/yiyiooo/stable-diffusion-webui-novelai)\n","- [stable-diffusion-webui 项目地址](https://github.com/AUTOMATIC1111/stable-diffusion-webui) \n","\n","## !!!!重要提示:如果要使用Comfyui,请一定要将 `use_comfyui` 配置改为True \n","\n","#### sd webui版本\n","\n","**version: v1.10.0  •  python: 3.10.13  •  torch: 2.3.0+cu121  •  xformers: 0.0.26  •  gradio: 3.41.2**\n"]},{"cell_type":"code","execution_count":1,"metadata":{},"outputs":[],"source":["# ... existing code ...\n","\n","# 注释 ComfyUI 相关配置\n","# _use_comfyui = locals().get('use_comfyui') or globals().get('use_comfyui') or False\n","# if _use_comfyui:\n","#     _sub_path = ['/webui/','/webui2/'] \n","#     _proxy_path['/'] = 'http://127.0.0.1:8188/'\n","#     _proxy_path['/cui/'] = 'http://127.0.0.1:8189/'\n","#     _proxy_path['/cui2/'] = 'http://127.0.0.1:8190/'\n","\n","# 注释 ComfyUI 启动函数\n","# def start_comfyui():\n","#     !rm -rf {install_path}/ComfyUI/models/checkpoints\n","#     !ln -s -r {_install_path}/{_ui_dir_name}/models/Stable-diffusion {install_path}/ComfyUI/models/checkpoints\n","#     !rm -rf {install_path}/ComfyUI/models/embeddings\n","#     !ln -s -r {_install_path}/{_ui_dir_name}/embeddings {install_path}/ComfyUI/models/embeddings\n","#     # ... 其他 ComfyUI 相关代码 ...\n","\n","def main():\n","    global envInstalled\n","    global huggingface_is_init\n","    global _runing\n","    stop_solo_threads()\n","    print('启动...')\n","    startTicks = time.time()\n","    time.sleep(5)\n","    _runing = True\n","    isInstall = True if os.getenv('IsInstall','False') == 'True' else False\n","    _proxy_path[_sub_path[0]] = f'http://127.0.0.1:{_server_port+1}/'\n","    _proxy_path[_sub_path[1]] = f'http://127.0.0.1:{_server_port+2}/'\n","    proxy_thread = threading.Thread(target = startProxy, daemon=True, name='solo_startProxy')\n","    proxy_thread.start()\n","    if isInstall is False or _reLoad:\n","        print('安装运行环境')\n","        install()\n","        link_dir()\n","        install_optimizing()\n","        if not _skip_webui:\n","            threading.Thread(target = install_dependencies,daemon=True,name='solo_install_dependencies').start()\n","        else:\n","            envInstalled = True\n","        link_or_download_flie(replace_path(_async_downloading), _link_instead_of_copy=_link_instead_of_copy,\n","                          base_path=f'{_install_path}/{_ui_dir_name}')\n","        \n","        link_or_download_flie(replace_path(_before_downloading), _link_instead_of_copy=_link_instead_of_copy,\n","                          base_path=f'{_install_path}/{_ui_dir_name}',is_await=True,sync=True)\n","        t = 0\n","        while _runing and not envInstalled:\n","            if t%10==0:\n","                print('等待python环境安装...')\n","            t = t+1\n","            time.sleep(1)\n","        use_config()\n","        os.environ['IsInstall'] = 'True'\n","    else:\n","        envInstalled = True\n","    localProxy()\n","    link_or_download_flie(replace_path(_before_start_sync_downloading), _link_instead_of_copy=_link_instead_of_copy,\n","                          base_path=f'{_install_path}/{_ui_dir_name}',sync=True)\n","    \n","    ticks = time.time()\n","    _on_before_start()\n","    print(\"加载耗时:\",(ticks - startTicks),\"\")\n","    if _skip_webui:\n","        print('跳过webui启动')\n","        proxy_thread.join()\n","    else:\n","        start()\n","\n","# 注释掉 on_before_start 中的 ComfyUI 启动\n","def _on_before_start():\n","    if locals().get('on_before_start'):\n","        on_before_start()\n","    # if _use_comfyui:\n","    #     threading.Thread(target = start_comfyui, daemon=True, name='solo_start_comfyui').start()\n","\n","# ... existing code ..."]},{"cell_type":"code","execution_count":2,"metadata":{},"outputs":[],"source":["class Config:\n","    \"\"\"统一管理配置项\"\"\"\n","    def __init__(self):\n","        self.server_port = 7860\n","        self.sub_path = ['/', '/1/']\n","        self.proxy_path = {}\n","        self.install_path = self._get_install_path()\n","        self.output_path = self._get_output_path()\n","        self.input_path = self._get_input_path()\n","        self.ui_dir_name = 'sd_main_dir'\n","        self.skip_webui = False\n","        self.link_instead_of_copy = True\n","        self.hidden_console_info = True\n","        \n","    def _get_install_path(self):\n","        return f\"/kaggle\" if os.path.exists('/kaggle/') else f\"{os.environ['HOME']}/sd_webui\"\n","        \n","    def _get_output_path(self):\n","        return '/kaggle/working' if os.path.exists('/kaggle/working/') else f\"{os.environ['HOME']}/.sdwui/Output\"\n","        \n","    def _get_input_path(self):\n","        return '/kaggle/input'"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[],"source":["class FileManager:\n","    \"\"\"管理文件下载和链接\"\"\"\n","    def __init__(self, config):\n","        self.config = config\n","        \n","    def link_or_download(self, file_list, base_path, is_await=False, sync=False):\n","        \"\"\"统一处理文件下载和链接\"\"\"\n","        if not file_list:\n","            return\n","            \n","        tasks = self._parse_file_list(file_list)\n","        \n","        if sync:\n","            for task in tasks:\n","                self._process_task(task, base_path)\n","        else:\n","            threads = []\n","            for task in tasks:\n","                thread = threading.Thread(\n","                    target=self._process_task,\n","                    args=(task, base_path),\n","                    daemon=True\n","                )\n","                threads.append(thread)\n","                thread.start()\n","                \n","            if is_await:\n","                for thread in threads:\n","                    thread.join()\n","                    \n","    def _parse_file_list(self, file_list):\n","        \"\"\"解析文件列表配置\"\"\"\n","        # 实现文件列表解析逻辑\n","        pass\n","        \n","    def _process_task(self, task, base_path):\n","        \"\"\"处理单个下载/链接任务\"\"\"\n","        # 实现具体的下载或链接逻辑\n","        pass"]},{"cell_type":"code","execution_count":4,"metadata":{},"outputs":[],"source":["class ProxyManager:\n","    \"\"\"管理代理服务\"\"\"\n","    def __init__(self, config):\n","        self.config = config\n","        self.proxy_thread = None\n","        \n","    def start_proxy(self):\n","        \"\"\"启动代理服务\"\"\"\n","        self.proxy_thread = threading.Thread(\n","            target=self._run_proxy,\n","            daemon=True,\n","            name='solo_startProxy'\n","        )\n","        self.proxy_thread.start()\n","        \n","    def _run_proxy(self):\n","        \"\"\"运行代理服务的具体实现\"\"\"\n","        # 实现代理服务逻辑\n","        pass"]},{"cell_type":"code","execution_count":5,"metadata":{},"outputs":[],"source":["class WebUILauncher:\n","    \"\"\"WebUI启动器\"\"\"\n","    def __init__(self):\n","        self.config = Config()\n","        self.file_manager = FileManager(self.config)\n","        self.proxy_manager = ProxyManager(self.config)\n","        self.running = False\n","        \n","    def start(self):\n","        \"\"\"启动主程序\"\"\"\n","        try:\n","            print('启动...')\n","            start_ticks = time.time()\n","            self.running = True\n","            \n","            # 启动代理\n","            self.proxy_manager.start_proxy()\n","            \n","            # 安装环境\n","            if self._need_install():\n","                self._install_environment()\n","                \n","            # 下载/链接文件\n","            self._handle_files()\n","            \n","            # 启动WebUI\n","            if not self.config.skip_webui:\n","                self._start_webui()\n","                \n","            print(f\"加载耗时: {time.time() - start_ticks} 秒\")\n","            \n","        except KeyboardInterrupt:\n","            self.stop()\n","            \n","    def stop(self):\n","        \"\"\"停止所有服务\"\"\"\n","        self.running = False\n","        stop_solo_threads()\n","        \n","    def _need_install(self):\n","        \"\"\"检查是否需要安装\"\"\"\n","        return os.getenv('IsInstall', 'False') != 'True' or globals().get('_reLoad')\n","        \n","    def _install_environment(self):\n","        \"\"\"安装环境\"\"\"\n","        print('安装运行环境')\n","        # 实现环境安装逻辑\n","        \n","    def _handle_files(self):\n","        \"\"\"处理文件下载和链接\"\"\"\n","        # 实现文件处理逻辑\n","        \n","    def _start_webui(self):\n","        \"\"\"启动WebUI\"\"\"\n","        # 实现WebUI启动逻辑"]},{"cell_type":"code","execution_count":6,"metadata":{},"outputs":[],"source":["class WebUIError(Exception):\n","    \"\"\"WebUI相关错误的基类\"\"\"\n","    pass\n","    \n","class InstallationError(WebUIError):\n","    \"\"\"安装过程中的错误\"\"\"\n","    pass\n","    \n","class FileProcessError(WebUIError):\n","    \"\"\"文件处理过程中的错误\"\"\"\n","    pass\n","\n","def error_handler(func):\n","    \"\"\"错误处理装饰器\"\"\"\n","    @functools.wraps(func)\n","    def wrapper(*args, **kwargs):\n","        try:\n","            return func(*args, **kwargs)\n","        except WebUIError as e:\n","            logging.error(f\"WebUI错误: {str(e)}\")\n","            raise\n","        except Exception as e:\n","            logging.error(f\"未预期的错误: {str(e)}\")\n","            raise WebUIError(f\"执行{func.__name__}时发生错误: {str(e)}\")\n","    return wrapper"]},{"cell_type":"markdown","metadata":{},"source":["## 重要文件列表\n","\n","- **这个列表仅加载一次 且会等待加载完成再开始安装其他环境,为减少故障,会按照顺序进行加载**\n","- ```[]```内的是下载文件的目标目录,可以是相对目录也可以是绝对路径\n","- ```[]```的下一行就是文件列表,可以是下载地址、git仓库、文件路径、文件夹路径,且支持通配符\n","- 如果需要对下载的文件重命名,可以在下载链接前面写上文件名后加一个```:```分开文件名和下载地址\n","- 如果需要下载到其他目录,可以使用同样的格式写其他目录"]},{"cell_type":"code","execution_count":1,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.367057Z","iopub.status.busy":"2024-10-22T14:40:05.366729Z","iopub.status.idle":"2024-10-22T14:40:05.380898Z","shell.execute_reply":"2024-10-22T14:40:05.379824Z","shell.execute_reply.started":"2024-10-22T14:40:05.367022Z"},"trusted":true},"outputs":[],"source":["before_downloading = '''# 这个列表仅加载一次 且会等待加载完成再开始安装其他环境\n","[extensions] # 插件 如果你需要增加插件,把插件地址写到这来就行,支持git仓库和文件夹路径\n","https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git\n","https://github.com/AlUlkesh/stable-diffusion-webui-images-browser.git\n","https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git\n","https://github.com/Mikubill/sd-webui-controlnet.git\n","https://github.com/ilian6806/stable-diffusion-webui-state.git\n","https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111.git\n","https://github.com/Bing-su/adetailer.git\n","https://github.com/zanllp/sd-webui-infinite-image-browsing.git\n","https://github.com/viyiviyi/stable-diffusion-webui-zoomimage.git\n","https://github.com/viyiviyi/sd-encrypt-image.git # 图片加密插件,解决涩图封号问题,需要在参数里设置你的密码开启\n","https://github.com/viyiviyi/Stable-Diffusion-Webui-Civitai-Helper.git # 修改过的c站助手,下载的缩略图可以被加密插件加密\n","https://github.com/viyiviyi/sd-civitai-browser-plus.git # 修改过的c站浏览器,下载的缩略图可以被加密插件加密\n","https://github.com/nonnonstop/sd-webui-3d-open-pose-editor.git\n","https://github.com/jexom/sd-webui-depth-lib.git\n","https://github.com/Elldreth/loopback_scaler.git\n","https://github.com/hnmr293/sd-webui-cutoff.git\n","https://github.com/hako-mikan/sd-webui-lora-block-weight.git\n","https://github.com/adieyal/sd-dynamic-prompts.git\n","https://github.com/hako-mikan/sd-webui-supermerger.git\n","# https://github.com/thisjam/sd-webui-oldsix-prompt.git # 这个插件启动时会报错,影响调试,如果需要自行启用\n","https://github.com/NoCrypt/sd-fast-pnginfo.git\n","https://github.com/ArtVentureX/sd-webui-agent-scheduler.git\n","https://github.com/mcmonkeyprojects/sd-dynamic-thresholding.git\n","# https://github.com/viyiviyi/prompts-filter.git z_prompts-filter # 这个插件可以解决一些tag异常\n","\n","# 如果你有模型文件需要在启动前加载,可以写在这个下面对应位置\n","\n","[models/Stable-diffusion]                # 大模型列表\n","\n","[models/hypernetworks]                   # hypernetworks文件列表\n","\n","[embeddings]                      # embeddings文件列表\n","\n","[models/Lora]                            # Lora文件列表\n","\n","[models/VAE]                             # VAE文件列表\n","\n","[extensions/sd-webui-controlnet/models] # controlnet插件的模型列表\n","\n","# 通过这个功能安装一个ComfyUI\n","[{install_path}]\n","https://github.com/comfyanonymous/ComfyUI.git ComfyUI -b v0.2.3  # confyui主分支不一定可以启动,当有新版本时请手动更换版本号(tag)\n","\n","[{install_path}/ComfyUI/custom_nodes]   # ComfyUI 节点模块\n","https://github.com/viyiviyi/comfyui-encrypt-image.git # 加密插件,安装后就会加密,默认密码123qwe,在utils下增加了一个预览和设置密码的节点\n","https://github.com/ltdrdata/ComfyUI-Manager.git\n","https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git\n","https://github.com/cubiq/ComfyUI_IPAdapter_plus.git\n","https://github.com/jags111/efficiency-nodes-comfyui.git\n","https://github.com/twri/sdxl_prompt_styler.git\n","https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive\n","https://github.com/ltdrdata/ComfyUI-Impact-Pack.git\n","https://github.com/ltdrdata/ComfyUI-Inspire-Pack.git\n","https://github.com/giriss/comfy-image-saver.git\n","# https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved.git AnimateDiff\n","https://github.com/SLAPaper/ComfyUI-Image-Selector.git\n","https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git\n","https://github.com/Fannovel16/comfyui_controlnet_aux.git\n","https://github.com/mav-rik/facerestore_cf.git\n","https://github.com/FizzleDorf/ComfyUI_FizzNodes.git\n","https://github.com/BadCafeCode/masquerade-nodes-comfyui.git\n","https://github.com/WASasquatch/was-node-suite-comfyui.git\n","https://github.com/YMC-GitHub/ymc-node-suite-comfyui.git\n","https://github.com/coreyryanhanson/ComfyQR.git\n","https://github.com/melMass/comfy_mtb.git\n","https://github.com/sipherxyz/comfyui-art-venture.git\n","\n","[{install_path}/ComfyUI/custom_nodes/ComfyUI-Impact-Pack]\n","https://github.com/ltdrdata/ComfyUI-Impact-Subpack impact_subpack\n","\n","[{install_path}/ComfyUI/web/extensions]   # ComfyUI web插件\n","https://github.com/viyiviyi/comfyui-mobile.git\n","https://github.com/viyiviyi/comfyui-popup-image-prevew.git\n","\n","'''"]},{"cell_type":"markdown","metadata":{},"source":["## 普通文件列表\n","\n","- **这个列表仅加载一次 且不会等待加载完成,并且不会按照顺序加载,如果是启动时就需要使用的文件,请加到前一个配置**\n","- 因为不会等待加载完成,所以排在后面的文件可能需要很久才开始下载\n","- ```[]```内的是下载文件的目标目录,可以是相对目录也可以是绝对路径\n","- ```[]```的下一行就是文件列表,可以是下载地址、git仓库、文件路径、文件夹路径,且支持通配符\n","- 如果需要对下载的文件重命名,可以在下载链接前面写上文件名后加一个```:```分开文件名和下载地址\n","- 如果需要下载到其他目录,可以使用同样的格式写其他目录\n","- **这些文件启动webui后可能还没下载完成,需要自行刷新列表查看是否下载完成,如果介意,就把需要下载的内容移动到下一个配置**"]},{"cell_type":"code","execution_count":2,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.383827Z","iopub.status.busy":"2024-10-22T14:40:05.383386Z","iopub.status.idle":"2024-10-22T14:40:05.397380Z","shell.execute_reply":"2024-10-22T14:40:05.396519Z","shell.execute_reply.started":"2024-10-22T14:40:05.383784Z"},"trusted":true},"outputs":[],"source":["async_downloading='''# 这个列表仅加载一次 且不会等待加载完成\n","[extensions] # 插件 建议不要把插件放在这里加载,因为这里的文件可能在webui启动后才加载完成\n","\n","[models/ESRGAN]\n","https://huggingface.co/lokCX/4x-Ultrasharp/resolve/main/4x-UltraSharp.pth?download=true\n","\n","[models/VAE]                             # VAE文件列表\n","{input_path}/vae-ft-ema-prunedsafetensors/vae-ft-ema-560000-ema-pruned.safetensors\n","{input_path}/vae-ft-ema-prunedsafetensors/vae-ft-mse-840000-ema-pruned.safetensors\n","https://huggingface.co/stabilityai/sd-vae-ft-ema-original/resolve/main/vae-ft-ema-008400-ema-pruned.safetensors?download=true\n","# https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt\n","sdxl_vae.safetensors:https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors?download=true # sdxl模型需要sdxl的vae\n","\n","[models/Stable-diffusion]                # 大模型列表\n","/kaggle/input/anime-xl/animagineXLV3_v30.safetensors # 动漫SDXL大模型 如果需要,把链接前面的#删掉\n","# https://civitai.com/api/download/models/176425\n","\n","[models/hypernetworks]                   # hypernetworks文件列表\n","\n","[embeddings]                      # embeddings文件列表\n","\n","[models/Lora]                            # Lora文件列表\n","# Genshin_Impact_all-in-one.safetensors:https://civitai.com/api/download/models/116970\n","https://civitai.com/api/download/models/117151 # Clothing +/- Adjuster 衣物增/减 LoRA\n","https://civitai.com/api/download/models/62833 # Detail Tweaker LoRA (细节调整LoRA)\n","\n","\n","[extensions/sd-webui-controlnet/models] # controlnet插件的模型列表 因为下载耗时,所以默认不下载大部分controlnet模型\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors?download=true\n","https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_canny_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_lineart_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_openpose_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_scribble_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_seg_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_softedge_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors?download=true\n","# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11u_sd15_tile_fp16.safetensors?download=true\n","\n","[extensions/animatediff/model] # animatediff 插件基本模型\n","# https://huggingface.co/guoyww/animatediff/resolve/cd71ae134a27ec6008b968d6419952b0c0494cf2/mm_sd_v15.ckpt?download=true\n","# https://huggingface.co/guoyww/animatediff/resolve/cd71ae134a27ec6008b968d6419952b0c0494cf2/mm_sd_v15_v2.ckpt?download=true\n","\n","[models/Lora/animatediff]  # animatediff lora模型\n","# https://huggingface.co/guoyww/animatediff/resolve/cd71ae134a27ec6008b968d6419952b0c0494cf2/v2_lora_PanLeft.ckpt?download=true\n","\n","\n","'''\n"]},{"cell_type":"markdown","metadata":{},"source":["## 按顺序加载的重要文件列表\n","\n","- **这个列表每次 run all 启动都会加载一次,且一定按照顺序加载后才启动webui**\n","- ```[]```内的是下载文件的目标目录,可以是相对目录也可以是绝对路径\n","- ```[]```的下一行就是文件列表,可以是下载地址、git仓库、文件路径、文件夹路径,且支持通配符\n","- 如果需要对下载的文件重命名,可以在下载链接前面写上文件名后加一个```:```分开文件名和下载地址\n","- 如果需要下载到其他目录,可以使用同样的格式写其他目录"]},{"cell_type":"code","execution_count":3,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.399370Z","iopub.status.busy":"2024-10-22T14:40:05.399004Z","iopub.status.idle":"2024-10-22T14:40:05.410786Z","shell.execute_reply":"2024-10-22T14:40:05.409999Z","shell.execute_reply.started":"2024-10-22T14:40:05.399328Z"},"trusted":true},"outputs":[],"source":["before_start_sync_downloading = ''' # 这个列表每次 run all 启动都会加载一次,且一定按照顺序加载\n","\n","# 如果你需要每次启动都加载一下文件,可以写在这。(比如测试路径是否正确的时候)\n","\n","[models/Stable-diffusion]                # 大模型列表\n","\n","[models/hypernetworks]                   # hypernetworks文件列表\n","\n","[embeddings]                      # embeddings文件列表\n","\n","[models/Lora]                            # Lora文件列表\n","\n","[models/VAE]                             # VAE文件列表\n","\n","[extensions/sd-webui-controlnet/models] # controlnet插件的模型列表\n","\n","'''\n","\n"]},{"cell_type":"markdown","metadata":{},"source":["### 重要配置,一般情况下不需要改"]},{"cell_type":"code","execution_count":4,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.521535Z","iopub.status.busy":"2024-10-22T14:40:05.521193Z","iopub.status.idle":"2024-10-22T14:40:05.529140Z","shell.execute_reply":"2024-10-22T14:40:05.528195Z","shell.execute_reply.started":"2024-10-22T14:40:05.521493Z"},"trusted":true},"outputs":[],"source":["useGooglrDrive = True # 连接到谷歌云盘 在google colab环境才会生效\n","#Ngrok\n","useNgrok=True # 非必填 是否使用ngrok作为公网访问地址\n","#frp内网穿透\n","useFrpc=True # 开启frp 如果ngrok和frp都不开,将不能访问webui\n","\n","#ngrok token 可以填写文件路径或直接填 token 内容  (替换一整行)\n","ngrok_config_or_file = '''\n","{input_path}/configs/ngrok_token.txt\n","'''\n","# frp配置 配置文件路径或者参数 或者配置内容 如果不填,将会使用免费的freefrp(不保证可用)\n","# 替换内容时请替换 {input_path}/configs/frpc_litechat.ini 这一整行\n","frp_config_or_file = '''\n","{input_path}/configs/frpc_litechat.ini3\n","'''\n","# frp用的域名证书所在目录\n","frp_ssl_dir = '''\n","{input_path}/configs/litechat_nginx\n","'''\n","\n","# 这个是字符串替换配置,可以将键值对的键替换成值,对以上的所有字符串内容生效\n","config_args = {}\n","\n","# 配置启动参数\n","server_port=7860 # webui 默认端口\n","\n","# 仓库地址 默认是是修改过界面布局顺序的webui,更适合手机使用,不定期同步到官方版本\n","# 如果要使用官方版本或其他版本,启用下面的或者自己该,正常情况下都是可以启动的\n","sd_git_repo='https://github.com/viyiviyi/stable-diffusion-webui.git -b local-1.9'  # 手机界面优化\n","# sd_git_repo='https://github.com/AUTOMATIC1111/stable-diffusion-webui.git'  # 官方原本\n","# sd_git_repo='https://github.com/lllyasviel/stable-diffusion-webui-forge.git'  # forge版本,据说出图更快\n","\n","# 配置文件,包括webui的设置和UI默认值,如果要自定义,fork这个仓库后修改并把地址替换这个地址\n","sd_config_git_repu = 'https://github.com/viyiviyi/sd-configs.git'\n","# 设置文件保存路径 当使用谷歌云盘时非常有用\n","setting_file = 'config.json'\n","ui_config_file = 'ui-config.json'\n","\n","# 这是配置文件夹同步的相关配置\n","# 需要在huggingface创建一个数据集(datasets) 然后把数据集的名称(在页面上有复制的按钮)填到 huggingface_repo \n","# 需要获取 token 填到 huggingface_token 获取的地址是: https://huggingface.co/settings/tokens\n","huggingface_token = '{input_path}/configs/huggingface_token.txt'\n","huggingface_repo = 'viyi/sdwui-imgs'\n","\n","link_instead_of_copy = True # 下载或加载Input的文件时是使用链接还是复制的方式加载到目标目录\n","hidden_console_info = True # 是否隐藏大部分的控制台内容\n","\n","# 跳过启动webui,会导致不再安装webui的环境,也不再启动webui,但是下载还是会正常下载,在需要使用comfyui的时候可以打开\n","skip_webui = False\n","\n","# 是否启用 comfyui ,如果需要使用 comfyui,请将这个配置的 Fals 额改为 True。 \n","# 如果只需要使用comfyui,强烈建议将上面的 skip_webui 配置的 False 改为 True\n","use_comfyui = False \n","\n","# 多卡模式,当选择T4X2的GPU时可以启动两个 webui\n","multi_case = False  # 将False改为True开启多卡"]},{"cell_type":"markdown","metadata":{},"source":["### 自定义脚本内容"]},{"cell_type":"code","execution_count":5,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.531385Z","iopub.status.busy":"2024-10-22T14:40:05.531101Z","iopub.status.idle":"2024-10-22T14:40:05.542138Z","shell.execute_reply":"2024-10-22T14:40:05.541168Z","shell.execute_reply.started":"2024-10-22T14:40:05.531342Z"},"trusted":true},"outputs":[],"source":["    \n","def get_folder_list(directory:str):  \n","    folder_list = []  \n","    for item in os.listdir(directory):  \n","        if os.path.isdir(os.path.join(directory, item)):  \n","            folder_list.append(item)  \n","    return folder_list \n","def read_text_file(file_path:str):\n","    if not Path(file_path).exists(): return ''\n","    with open(file_path,\"r\") as f:\n","        text = file.read()\n","        if text: return text.strip()\n","    return ''\n"]},{"cell_type":"code","execution_count":6,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.543566Z","iopub.status.busy":"2024-10-22T14:40:05.543267Z","iopub.status.idle":"2024-10-22T14:40:05.707423Z","shell.execute_reply":"2024-10-22T14:40:05.706502Z","shell.execute_reply.started":"2024-10-22T14:40:05.543535Z"},"trusted":true},"outputs":[],"source":["# 启动 ComfyUI\n","def start_comfyui():\n","    !rm -rf {install_path}/ComfyUI/models/checkpoints\n","    !ln -s -r {_install_path}/{_ui_dir_name}/models/Stable-diffusion {install_path}/ComfyUI/models/checkpoints\n","    !rm -rf {install_path}/ComfyUI/models/embeddings\n","    !ln -s -r {_install_path}/{_ui_dir_name}/embeddings {install_path}/ComfyUI/models/embeddings\n","    !rm -rf {install_path}/ComfyUI/models/loras\n","    !ln -s -r {_install_path}/{_ui_dir_name}/models/Lora {install_path}/ComfyUI/models/loras\n","    !rm -rf {install_path}/ComfyUI/models/vae\n","    !ln -s -r {_install_path}/{_ui_dir_name}/models/VAE {install_path}/ComfyUI/models/vae\n","    !rm -rf {install_path}/ComfyUI/models/hypernetworks\n","    !ln -s -r {_install_path}/{_ui_dir_name}/models/hypernetworks {install_path}/ComfyUI/models/hypernetworks\n","    !rm -rf {install_path}/ComfyUI/models/upscale_models\n","    !ln -s -r {_install_path}/{_ui_dir_name}/models/ESRGAN {install_path}/ComfyUI/models/upscale_models\n","    !rm -rf {install_path}/ComfyUI/models/controlnet\n","    !ln -s -r {_install_path}/{_ui_dir_name}/extensions/sd-webui-controlnet/models {install_path}/ComfyUI/models/controlnet\n","    if Path(f'{install_path}/ComfyUI/custom_nodes/AnimateDiff').exists():\n","        !rm -rf {install_path}/ComfyUI/custom_nodes/AnimateDiff/models\n","        !ln -s -r {_install_path}/{_ui_dir_name}/extensions/animatediff/model {install_path}/ComfyUI/custom_nodes/AnimateDiff/models\n","        !rm -rf {install_path}/ComfyUI/custom_nodes/AnimateDiff/motion_lora\n","        !ln -s -r {_install_path}/{_ui_dir_name}/models/Lora/animatediff {install_path}/ComfyUI/custom_nodes/AnimateDiff/motion_lora\n","    \n","    if os.getenv('INIT_COMFYUI',''):\n","        pass\n","    else:\n","        print(f'下载 comfyui 依赖 预计需要5分钟以上')\n","        !python3.10 -m venv {install_path}/ComfyUI/venv\n","        if Path(f'/kaggle/input/comfyui-venv/cui-venv.tar.bak').exists():\n","            run(f'tar -xf /kaggle/input/comfyui-venv/cui-venv.tar.bak -C ./venv',cwd=f'{install_path}/ComfyUI')\n","        !python3.10 -m venv {install_path}/ComfyUI/venv\n","        run(f'{install_path}/ComfyUI/venv/bin/python3 -s -m pip install -r requirements.txt',cwd=f'{install_path}/ComfyUI')\n","        \n","#         run(f'{install_path}/ComfyUI/venv/bin/python -m pip install torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121')\n","#         run(f'{install_path}/ComfyUI/venv/bin/python -m pip install xformers==0.0.26.post1')\n","\n","#         print(f'下载 comfyui 各节点的依赖')\n","        for node in get_folder_list(f'{install_path}/ComfyUI/custom_nodes'):\n","            print(os.path.join(f'{install_path}/ComfyUI/custom_nodes',node))\n","            if Path(os.path.join(f'{install_path}/ComfyUI/custom_nodes',node,'requirements.txt')).exists():\n","                run(f'{install_path}/ComfyUI/venv/bin/python3 -s -m pip install -r requirements.txt',cwd=os.path.join(f'{install_path}/ComfyUI/custom_nodes',node))\n","    \n","        os.environ['INIT_COMFYUI'] = \"DONE\"\n","        \n","        \n","    def start(device:int):\n","        print(f'启动 comfyui {device}')\n","        %cd {install_path}/ComfyUI \n","        \n","        !venv/bin/python3 main.py --force-fp16 --cuda-device={device} --port={8188+device}\n","        \n","    print(f'启动 comfyui')\n","    for device in range(torch.cuda.device_count() if multi_case else 1):\n","        threading.Thread(target = start, daemon=True,args=([device]), name=f'solo_start_comfyui_{device}').start()\n","        \n"]},{"cell_type":"code","execution_count":7,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.709738Z","iopub.status.busy":"2024-10-22T14:40:05.709396Z","iopub.status.idle":"2024-10-22T14:40:05.721107Z","shell.execute_reply":"2024-10-22T14:40:05.720224Z","shell.execute_reply.started":"2024-10-22T14:40:05.709705Z"},"trusted":true},"outputs":[],"source":["# 安装一个文件浏览器 通过在访问地址后加 /fslist/ 访问\n","def start_filebrower():\n","    !curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash\n","    !filebrowser -p 8012 --username admin -b /fslist -r {install_path}\n"]},{"cell_type":"code","execution_count":8,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.724011Z","iopub.status.busy":"2024-10-22T14:40:05.723716Z","iopub.status.idle":"2024-10-22T14:40:05.735756Z","shell.execute_reply":"2024-10-22T14:40:05.734851Z","shell.execute_reply.started":"2024-10-22T14:40:05.723979Z"},"trusted":true},"outputs":[],"source":["\n","# 这个方法内的函数会在所有文件加载完成,准备启动webui前执行,可以放一些自定义的逻辑功能\n","def on_before_start():\n","    if use_comfyui:\n","        threading.Thread(target = start_comfyui, daemon=True, name='solo_start_comfyui').start()\n","    threading.Thread(target = start_filebrower, daemon=True, name='solo_start_filebrower').start()\n","    ## 下面可以写更多自定义逻辑\n","    pass\n","    "]},{"cell_type":"markdown","metadata":{},"source":["## webui 启动参数\n","- 所有的参数都会在启动时传入\n","- 可以在前面加```#```来屏蔽某个参数\n","- 端口参数需要在下一个代码块的```webuiPort```处修改"]},{"cell_type":"code","execution_count":9,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.737659Z","iopub.status.busy":"2024-10-22T14:40:05.736987Z","iopub.status.idle":"2024-10-22T14:40:05.746957Z","shell.execute_reply":"2024-10-22T14:40:05.745963Z","shell.execute_reply.started":"2024-10-22T14:40:05.737614Z"},"trusted":true},"outputs":[],"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","--encrypt-pass=123qwe # 图片加密插件的密码,如果要启用图片加密插件,删除这一行前面的#和将123qwe改成你的密码,也可以不改\n","# --share # 默认的内网穿透在kaggle和colab都已经不可用,请考虑其他方案\n","--disable-console-progressbars\n","--no-half-vae \n","# --no-half  #关闭半精度\n","# --enable-console-prompts\n","# --nowebui # 如果只需要api服务,可以开启这个\n","# --api-auth=2333:6666  # api密码\n","# --gradio-auth=2333:6666 # webui密码\n","'''"]},{"cell_type":"code","execution_count":10,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.748625Z","iopub.status.busy":"2024-10-22T14:40:05.748176Z","iopub.status.idle":"2024-10-22T14:40:05.758062Z","shell.execute_reply":"2024-10-22T14:40:05.757299Z","shell.execute_reply.started":"2024-10-22T14:40:05.748584Z"},"trusted":true},"outputs":[],"source":["# 自定义本地反向代理 这些配置将会成为nginx的反向代理配置,用于实现一个穿透访问多个实例\n","# 默认情况下 / 被代理到了webui;/1/ 被代理到了第二个webui\n","proxy_path={\n","    '/fslist/':'http://127.0.0.1:8012/',\n","}\n","if use_comfyui:\n","    sub_path=['/webui/','/webui2/'] # 当启用comfyui时,webui需要变更到新目录,因为comfyui当前不支持被代理到二级目录\n","    proxy_path['/'] = 'http://127.0.0.1:8188/'"]},{"cell_type":"code","execution_count":11,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.759242Z","iopub.status.busy":"2024-10-22T14:40:05.758999Z","iopub.status.idle":"2024-10-22T14:40:05.773582Z","shell.execute_reply":"2024-10-22T14:40:05.772677Z","shell.execute_reply.started":"2024-10-22T14:40:05.759215Z"},"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["/root\n"]}],"source":["# 保存当前目录和启动时cd到之前保存的目录,可以减少sdwui-start-new.ipynb文件下载次数\n","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}"]},{"cell_type":"code","execution_count":12,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:05.774874Z","iopub.status.busy":"2024-10-22T14:40:05.774612Z","iopub.status.idle":"2024-10-22T14:40:12.022614Z","shell.execute_reply":"2024-10-22T14:40:12.021445Z","shell.execute_reply.started":"2024-10-22T14:40:05.774845Z"},"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["\n","\n","\n","\n","当前sd的安装路径是:/kaggle/sd_main_dir\n","当前图片保存路径是:/kaggle/working\n","当前数据集路径是:/kaggle/input\n","\n","欢迎使用 stable-diffusion-webui 便捷启动工具\n","\n","此脚本理论上可以在任何jupyter环境运行,但仅在 google colab 和 kaggle 测试。 已经无法在 google colab 免费实例上运行。\n","此脚本的【前置脚本】发布地址 https://www.kaggle.com/code/yiyiooo/stable-diffusion-webui-novelai-sdxl。\n","此脚本需配合 【前置脚本】 的脚本附带的配置项才能正常启动。\n","此脚本的内容会自动更新,你无需更新【前置脚本】就能获取到最新的功能。\n","增加一个说明:为解决加密图片的解密和浏览的问题,开发了一个独立应用,可以在这里下载 https://github.com/viyiviyi/encrypt_gallery/releases/\n","加密插件可解决生成nsfw图片后被平台封号问题\n","\n","路径说明\n","*  为了解决平台差异,所有的安装目录和文件输出目录都被重新指定,如果你需要在配置中访问这些目录,请查看以下说明\n","*\n","*  可以使用 $install_path 或 {install_path} 来访问安装目录,写在字符串内也会生效\n","*  $output_path 或 {output_path} 可以访问输出目录\n","*  如果你需要安装在自定义目录,也可以设置这些值 如: install_path = '新的路径'\n","*  可自定义方法 on_before_start 并在方法内写上启动前需要的逻辑来实现在webui启动前执行自定义逻辑\n","*  可以增加配置 multi_case = True 来控制是否使用多卡\n","*  如果需要显示更多控制台输出 需配置 hidden_console_info = False\n","\n","********* 特别提示 *********\n","*  huggingface 的下载链接需要增加 ?download=true 参数才能正确下载到文件,如果你需要的文件里的下载链接没有这个参数,请自行增加。\n","\n","已跳过自动启动,可手动执行 main() 进行启动。\n","推荐的启动代码:\n","try:\n","    check_gpu() # 检查是否存在gpu\n","    main()\n","except KeyboardInterrupt:\n","    stop_solo_threads() # 中断后自动停止后台线程 (有部分功能在后台线程中运行)\n","    \n"]}],"source":["if not os.path.exists('sdwui-start-util.ipynb'):\n","    !wget https://huggingface.co/viyi/sdwui/resolve/main/sdwui-start-util.ipynb -o log.log\n","%run sdwui-start-util.ipynb"]},{"cell_type":"code","execution_count":13,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:12.024341Z","iopub.status.busy":"2024-10-22T14:40:12.023876Z","iopub.status.idle":"2024-10-22T14:40:12.028631Z","shell.execute_reply":"2024-10-22T14:40:12.027684Z","shell.execute_reply.started":"2024-10-22T14:40:12.024306Z"},"trusted":true},"outputs":[],"source":["reLoad = True\n","# 如果需要重新安装,请注释下面这一行\n","reLoad = False"]},{"cell_type":"code","execution_count":14,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:12.030336Z","iopub.status.busy":"2024-10-22T14:40:12.029924Z","iopub.status.idle":"2024-10-22T14:40:12.043553Z","shell.execute_reply":"2024-10-22T14:40:12.042640Z","shell.execute_reply.started":"2024-10-22T14:40:12.030287Z"},"trusted":true},"outputs":[{"data":{"text/plain":["0"]},"execution_count":14,"metadata":{},"output_type":"execute_result"}],"source":["import signal  \n","import sys\n","\n","def auto_exit(signum,frame):\n","    print('自动结束运行')\n","    signal.alarm(0)\n","    sys.exit(0)\n","\n","signal.signal(signal.SIGALRM, auto_exit)\n","signal.alarm(12*60*60-60) # 定时关机时间,12小时 x 60分钟 x 60秒 当需要提前关机时可以修改数值"]},{"cell_type":"code","execution_count":15,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:40:12.045107Z","iopub.status.busy":"2024-10-22T14:40:12.044751Z","iopub.status.idle":"2024-10-22T14:40:12.053106Z","shell.execute_reply":"2024-10-22T14:40:12.052161Z","shell.execute_reply.started":"2024-10-22T14:40:12.045064Z"},"trusted":true},"outputs":[],"source":["stop_solo_threads()"]},{"cell_type":"markdown","metadata":{},"source":["## 启动"]},{"cell_type":"code","execution_count":36,"metadata":{"execution":{"iopub.execute_input":"2024-10-22T14:54:15.116365Z","iopub.status.busy":"2024-10-22T14:54:15.115971Z","iopub.status.idle":"2024-10-22T14:54:50.450523Z","shell.execute_reply":"2024-10-22T14:54:50.449384Z","shell.execute_reply.started":"2024-10-22T14:54:15.116332Z"},"scrolled":true,"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":["结束线程:solo_directory_to_watch\n","结束线程:solo_directory_to_watch\n","结束线程:solo_directory_to_watch\n","启动...\n","Token is valid (permission: write).\n","Your token has been saved in your configured git credential helpers (store).\n","Your token has been saved to /root/.cache/huggingface/token\n","Login successful\n","huggingface token 已经加载,可以下载私有仓库或文件\n","启动收藏图片文件夹监听,并自动同步到 huggingface dataset : viyi/sdwui-imgs\n","加载耗时: 5.20603609085083 秒\n","跳过webui启动\n","ngrok 访问地址:https://7da6-108-59-81-6.ngrok-free.app\n","ngrok 访问地址:https://7da6-108-59-81-6.ngrok-free.app\n","ngrok 本地服务:http://127.0.0.1:7862/  访问地址:https://7da6-108-59-81-6.ngrok-free.app/webui2/\n","ngrok 本地服务:http://127.0.0.1:8012/  访问地址:https://7da6-108-59-81-6.ngrok-free.app/fslist/\n","ngrok 本地服务:http://127.0.0.1:7861/  访问地址:https://7da6-108-59-81-6.ngrok-free.app/webui/\n","ngrok 本地服务:http://127.0.0.1:8188/  访问地址:https://7da6-108-59-81-6.ngrok-free.app/\n","freefrp 访问地址:http://8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com\n","freefrp 本地服务:http://127.0.0.1:7862/  访问地址:http://8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com/webui2/\n","freefrp 本地服务:http://127.0.0.1:8012/  访问地址:http://8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com/fslist/\n","freefrp 本地服务:http://127.0.0.1:7861/  访问地址:http://8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com/webui/\n","freefrp 本地服务:http://127.0.0.1:8188/  访问地址:http://8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com/\n","Downloading File Browser for linux/amd64...\n","https://github.com/filebrowser/filebrowser/releases/download/v2.31.2/linux-amd64-filebrowser.tar.gz\n","2024/10/22 14:54:21 \u001b[1;34m[I] 检查更新中...\u001b[0m\n","2024/10/22 14:54:21 \u001b[1;34m[I] 出现错误, 请打开 https://doc.natfrp.com 查看帮助文档\u001b[0m\n","2024/10/22 14:54:21 \u001b[1;33m[W] 更新检查失败: API is not initialized\u001b[0m\n","2024/10/22 14:54:21 \u001b[1;34m[I] frpc version: 0.51.0-sakura-6 (built: 2024-06-25 20:30)\u001b[0m\n","2024/10/22 14:54:21 \u001b[1;34m[I] 正在连接节点 [frp.freefrp.net, tcp]\u001b[0m\n","Extracting...\n","Putting filemanager in /usr/local/bin (may require password)\n","Successfully installed\n","2024/10/22 14:54:22 \u001b[1;34m[I] [b473fe9a] 连接节点成功, 运行 ID [b473fe9a]\u001b[0m\n","2024/10/22 14:54:22 \u001b[1;34m[I] [b473fe9a] 隧道启动中: [8aad0b44-9083-11ef-925e-0242ac130202_http, http -> 127.0.0.1:7860]\u001b[0m\n","HTTP 隧道启动成功\n","使用 >>8aad0b44-9083-11ef-925e-0242ac130202.frp.eaias.com<< 连接你的隧道\n","请记得为您的自有域名添加 CNAME/A 记录\n","记录值为: >>frp.freefrp.net<<\n","2024/10/22 14:54:22 \u001b[1;34m[I] [b473fe9a] [8aad0b44-9083-11ef-925e-0242ac130202_http] 隧道启动成功\u001b[0m\n","2024/10/22 14:54:23 Using database: /kaggle/ComfyUI/filebrowser.db\n","2024/10/22 14:54:23 No config file used\n","2024/10/22 14:54:23 Listening on 127.0.0.1:8012\n","启动 comfyui\n","启动 comfyui 0\n","/kaggle/ComfyUI\n","[START] Security scan\n","[DONE] Security scan\n","## ComfyUI-Manager: installing dependencies done.\n","** ComfyUI startup time: 2024-10-22 14:54:36.977447\n","** Platform: Linux\n","** Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]\n","** Python executable: /kaggle/ComfyUI/venv/bin/python3\n","** ComfyUI Path: /kaggle/ComfyUI\n","** Log path: /kaggle/ComfyUI/comfyui.log\n","\n","Prestartup times for custom nodes:\n","   1.1 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-Manager\n","\n","Set cuda device to: 0\n","Total VRAM 15095 MB, total RAM 32110 MB\n","pytorch version: 2.3.0+cu121\n","xformers version: 0.0.26.post1\n","Forcing FP16.\n","Set vram state to: NORMAL_VRAM\n","Device: cuda:0 Tesla T4 : cudaMallocAsync\n","Using xformers cross attention\n","[Prompt Server] web root: /kaggle/ComfyUI/web\n","[VideoHelperSuite] - \u001b[0;33mWARNING\u001b[0m - Failed to import imageio_ffmpeg\n","\u001b[36;20m[comfyui_controlnet_aux] | INFO -> Using ckpts path: /kaggle/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts\u001b[0m\n","\u001b[36;20m[comfyui_controlnet_aux] | INFO -> Using symlinks: False\u001b[0m\n","\u001b[36;20m[comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider']\u001b[0m\n","/kaggle/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/dwpose.py:26: UserWarning: DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly\n","  warnings.warn(\"DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly\")\n","### Loading: ComfyUI-Inspire-Pack (V1.6)\n","图片加密插件加载成功\n","Adding /kaggle/ComfyUI/custom_nodes to sys.path\n","\u001b[36mEfficiency Nodes:\u001b[0m Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...\u001b[92mSuccess!\u001b[0m\n","\u001b[93mEfficiency Nodes Warning:\u001b[0m Failed to import python package 'simpleeval'; related nodes disabled.\n","\n","Loaded Efficiency nodes from /kaggle/ComfyUI/custom_nodes/efficiency-nodes-comfyui\n","Loaded ControlNetPreprocessors nodes from /kaggle/ComfyUI/custom_nodes/comfyui_controlnet_aux\n","Could not find AdvancedControlNet nodes\n","Could not find AnimateDiff nodes\n","Loaded IPAdapter nodes from /kaggle/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus\n","Loaded VideoHelperSuite from /kaggle/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite\n","### Loading: ComfyUI-Impact-Pack (V7.10.5)\n","### Loading: ComfyUI-Impact-Pack (Subpack: V0.7)\n","### Loading: ComfyUI-Impact-Pack (V7.10.5)\n","Loaded ImpactPack nodes from /kaggle/ComfyUI/custom_nodes/ComfyUI-Impact-Pack\n","[Impact Pack] Wildcards loading done.\n","[Impact Pack] Wildcards loading done.\n","### Loading: ComfyUI-Impact-Pack (V7.10.5)\n","[Impact Pack] Wildcards loading done.\n","\u001b[36;20m[comfy_mtb] | INFO -> loaded \u001b[96m81\u001b[0m nodes successfuly\u001b[0m\n","\u001b[36;20m[comfy_mtb] | INFO -> Some nodes (7) could not be loaded. This can be ignored, but go to http://127.0.0.1:8188/mtb if you want more information.\u001b[0m\n","### Loading: ComfyUI-Manager (V2.51.8)\n","### ComfyUI Revision: 2753 [5f9d5a24] *DETACHED | Released on '2024-10-09'\n","[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json\n","[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json\n","[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json\n","[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json\n","[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json\n","\u001b[34mWAS Node Suite: \u001b[0mOpenCV Python FFMPEG support is enabled\u001b[0m\n","\u001b[34mWAS Node Suite \u001b[93mWarning: \u001b[0m`ffmpeg_bin_path` is not set in `/kaggle/ComfyUI/custom_nodes/was-node-suite-comfyui/was_suite_config.json` config file. Will attempt to use system ffmpeg binaries if available.\u001b[0m\n","\u001b[34mWAS Node Suite: \u001b[0mFinished.\u001b[0m \u001b[32mLoaded\u001b[0m \u001b[0m218\u001b[0m \u001b[32mnodes successfully.\u001b[0m\n","\n","\t\u001b[3m\u001b[93m\"Art is the most beautiful of all lies.\"\u001b[0m\u001b[3m - Claude Debussy\u001b[0m\n","\n","\u001b[34mFizzleDorf Custom Nodes: \u001b[92mLoaded\u001b[0m\n","Total VRAM 15095 MB, total RAM 32110 MB\n","pytorch version: 2.3.0+cu121\n","xformers version: 0.0.26.post1\n","Forcing FP16.\n","Set vram state to: NORMAL_VRAM\n","Device: cuda:0 Tesla T4 : cudaMallocAsync\n","------------------------------------------\n","\u001b[34mComfyroll Studio v1.76 : \u001b[92m 175 Nodes Loaded\u001b[0m\n","------------------------------------------\n","** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md\n","** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki\n","------------------------------------------\n","\n","Import times for custom nodes:\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/websocket_image_save.py\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/efficiency-nodes-comfyui\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/sdxl_prompt_styler\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-Image-Selector\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/comfyui-encrypt-image\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/masquerade-nodes-comfyui\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyQR\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-Impact-Pack\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/comfy-image-saver\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ymc-node-suite-comfyui\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus\n","   0.0 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-Manager\n","   0.1 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite\n","   0.1 seconds: /kaggle/ComfyUI/custom_nodes/comfy_mtb\n","   0.1 seconds: /kaggle/ComfyUI/custom_nodes/facerestore_cf\n","   0.1 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack\n","   0.4 seconds: /kaggle/ComfyUI/custom_nodes/ComfyUI_FizzNodes\n","   0.5 seconds: /kaggle/ComfyUI/custom_nodes/comfyui_controlnet_aux\n","   0.5 seconds: /kaggle/ComfyUI/custom_nodes/comfyui-art-venture\n","   1.6 seconds: /kaggle/ComfyUI/custom_nodes/was-node-suite-comfyui\n","\n","Starting server\n","\n","To see the GUI go to: http://127.0.0.1:8188\n","结束线程:solo_directory_to_watch\n","结束线程:solo_directory_to_watch\n","结束线程:solo_directory_to_watch\n","结束线程:solo_startProxy\n","结束线程:solo_directory_to_watch\n","结束线程:solo_start_filebrower\n","结束线程:solo_start_comfyui_0\n"]}],"source":["try:\n","    check_gpu() # 检查是否存在gpu\n","    main()\n","    signal.alarm(0)\n","except KeyboardInterrupt:\n","    stop_solo_threads() # 中断后自动停止后台线程 (有部分功能在后台线程中运行)\n","    signal.alarm(0)"]},{"cell_type":"markdown","metadata":{},"source":["## 一些示例代码"]},{"cell_type":"code","execution_count":null,"metadata":{"scrolled":true,"trusted":true},"outputs":[],"source":["# %cd {install_path}/{ui_dir_name}\n","# !venv/bin/python -m pip install torch==2.3.0 --index-url https://download.pytorch.org/whl/cu121\n","# !venv/bin/python -m pip install torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121\n","# !venv/bin/python -m pip install xformers==0.0.26.post1\n","# !venv/bin/python -m pip install -r requirements_versions.txt\n","# !venv/bin/python -m pip install spandrel==0.3.0\n","# !venv/bin/python -m pip install opencv-python\n","# !venv/bin/python -m pip install pydantic==1.10.15\n","# !venv/bin/python -m pip install transformers -U\n","# !venv/bin/python -m pip install llama-cpp-python\n","# !venv/bin/python -m pip install pytorch_lightning==2.3.3 torchsde==0.2.6 spandrel==0.3.4\n","\n","# !{install_path}/{ui_dir_name}/venv/bin/python3 -m pip install open-clip-torch -U\n","# !{install_path}/{ui_dir_name}/venv/bin/python3 -m pip install protobuf==4.25.3\n","# !{install_path}/{ui_dir_name}/venv/bin/python3 -m pip install blendmodes==2022\n","# !{install_path}/{ui_dir_name}/venv/bin/python3 -m pip install Pillow==9.5.0\n","\n","# !{install_path}/ComfyUI/venv/bin/python3 -m pip install qrcode==7.4.2\n","# !{install_path}/ComfyUI/venv/bin/python3 -m pip install -r /kaggle/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/requirements.txt\n","# !{install_path}/ComfyUI/venv/bin/python3 -m pip install opencv-python numba numexpr piexif scikit-image webcolors pydantic lpips qrcode pandas Pillow==9.5.0"]},{"cell_type":"code","execution_count":null,"metadata":{"trusted":true},"outputs":[],"source":["# 打包收藏文件夹 如果需要可以取消下面两行的注释\n","# zipPath(f'{install_path}/{ui_dir_name} /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: /kaggle/working/ 目录下 名字是训练输出.tar\n","# zipPath(f'{install_path}/{ui_dir_name}/textual_inversion','训练输出') \n","# zipPath(f'{install_path}/{ui_dir_name}/outputs','outputs')\n","\n","# 打包venv并上传到数据集\n","# !rm -rf /kaggle/working/venv.tar.bak\n","# !rm -rf {output_path}/venv.tar\n","# zipPath(f'{install_path}/{ui_dir_name}/venv','venv')\n","# !mv {output_path}/venv.tar /kaggle/working/venv.tar.bak\n","# createOrUpdateDataSet('/kaggle/working/venv.tar.bak','sd-webui-venv')\n","# comfyui\n","# !rm -rf /kaggle/working/cui-venv.tar.bak\n","# !rm -rf {output_path}/cui-venv.tar\n","# zipPath(f'{install_path}/ComfyUI/venv','cui-venv')\n","# !mv {output_path}/cui-venv.tar /kaggle/working/cui-venv.tar.bak\n","# createOrUpdateDataSet('/kaggle/working/cui-venv.tar.bak','comfyui-venv')\n","# 打包命令参考,--exclude 可以排除不需要打包的目录\n","# !tar -cf $output_path/webui.tar.bak --exclude=venv --exclude=extensions -C /sd_main_dir/ ."]},{"cell_type":"markdown","metadata":{},"source":["# 使用帮助\n","---\n","**代码块不能删除也不能调换顺序,如果出现变量未定义,请检查是否按顺序执行了代码块**\n","\n","**请注意查看启动后最开始的那一段输出,里面会包含更新的内容和一些特别的设置,可能对文件访问有帮助**\n","\n","---\n","\n","## kaggle账号\n","- 注册账号需要手机号,国内手机号也行,如果点击注册后没反应,估计是需要梯子,用于人机验证\n","- 注册后点此笔记的 **Copy & Edit** 按钮就进到编辑界面\n","\n","## 准备工作\n","1. 右侧面板 **Notebook options/ACCELERATOR** 需要选择GPU **T4x2**出图更快\n","2. 右侧面板 **Notebook options/LANGUAGE** 需要选择Python\n","2. 右侧面板 **Notebook options/PERSISTENCE** 建议选择 Files only **作用是保存Outpot目录内的文件,当前这个功能并没有任何作用**\n","3. 右侧面板 **Notebook options/ENVIRONMENT** 建议不改这个配置,使用当前默认值就行\n","4. 右侧面板 **Notebook options/INTERNET** 需要打开 用于联网\n","\n","## 启动\n","#### 启动方式一  **直接点击页面上边的 RunAll**\n","- 手机端可能会出现页面上边的工具栏不显示的情况,左侧菜单按钮里也有相关的操作\n","- 长时间不操作页面会导致脚本停止 (应该是40分钟吧)\n","\n","#### 启动方式二  **使用页面上边的 Save Version 后台运行**\n","- 后台运行不用担心长时间不操作脚本停止\n","- Version Type 选择 **Save & Run All**\n","- 在Save Version弹窗里需要选择使用**GPU**环境 (Advanced Settings 里最后一个选项)\n","\n","## 访问\n","- 如果你使用了ngrok或者frpc,可以访问你这两对应的地址\n","- 如果你不知道你的ngrok或者frpc的地址可以在控制台(页面最下方Console)的输出里面查看\n","- ~使用Run All方式启动,控制台在启动完成后会输出访问网址,网址内容包含**gradio.live**,可以在页面中搜索快速找到~\n","- 如果使用Save Verson的方式启动,点击左下角的**View Active Events**点击刚刚启动的脚步,在**Log**里找访问网址\n","- 一般情况下第一次启动此脚本需要等待kaggle下载模型文件,进度在页面上方\n","- 第二次及以后(不增加新的文件)需要3到5分钟\n","\n","## 增加模型\n","- 可以直接写模型的下载链接,省去下面这些步骤\n","1. 先创建数据集,也就是dataset\n","2. 创建时需要添加文件,选择自己的模型文件就行\n","3. 同类型文件放相同的数据集里面,一个数据集也不要太大\n","4. 可以在dataset搜索其他人上传的模型\n","5. 通过右侧的 **Add Data** 按钮选择已经上传的模型文件或者别人上传的模型文件\n","    - input 下面的列表就是模型文件,可以点击名称后面的复制按钮复制路径\n","6. 将模型路径放在配置里的对应配置里即可,支持文件夹和文件路径,参考 **modelDirs**\n","    - 如果目录里还有子目录也是需要加载的,可以用*表示子目录 例子:比如Loras目录下还有角色、画风、涩涩的文件夹,那路径里写成 '/kaggle/input/Loras/*'就可以加载子目录里面的文件了\n","    - 模型加载使用的文件链接方式,如果你融模型的时候新模型名字和原有模型名字一样,会出现不能修改只读文件的错误\n","    - 同理,直接对模型做编辑的工具可能也会出现相同的错误\n","    \n"," \n","- **受到kaggle内存大小的影响,切换多个模型后大概率爆内存导致停止运行**\n","    \n","**下边的配置项都写了对应配置的作用和使用说明,不理解的话也不用改,用默认的就好**\n","\n","## 下载文件\n","#### 方式一\n","- 在浏览器直接下 比如你需要下载的文件路径在 /kaggle/stable-diffusion-webui/models/Lora/dow_a.safetensors\n","    - 比如你需要下载的文件路径在 /kaggle/stable-diffusion-webui/models/Lora/dow_a.safetensors\n","    - 你的访问地址是 https://123123123.gradio.live\n","    - 则可以在浏览器输入 https://123123123.gradio.live/file=/kaggle/stable-diffusion-webui/models/Lora/dow_a.safetensors 下载你的文件\n","    \n","#### 方式二\n","- 复制到Output目录下载 仅支持使用Run All方式运行的\n","    - 比如你需要下载的文件路径在 /kaggle/stable-diffusion-webui/models/Lora/dow_a.safetensors\n","    - 先停止笔记本(不是关机,是停止)\n","    - 然后新建一个代码块,在里面输入 !cp -f /kaggle/stable-diffusion-webui/models/Lora/dow_a.safetensors       /kaggle/working/\n","    - 或者 新建一个代码块,在里面输入 !cp -f \\$install_path/stable-diffusion-webui/models/Lora/dow_a.safetensors       /kaggle/working/\n","    - 你可能需要拼接路径 如果是在webui里面看到的路径,且路径里面没有带**stable-diffusion-webui**\n","        - 拼接方式是 **\\$install_path/stable-diffusion-webui** + **文件路径** 拼成类似前一条的样子\n","    - 就可以在右侧列表的Output目录看见复制出来的文件,点击下载即可\n","- **注意! 以上对文件的访问路径仅做示例,真实的安装位置需要通过 {install_path}/{ui_dir_name} 来访问**\n","\n","## **一些可能没用的说明**\n","- 配置说明 **True或者False**表示布尔值 **True**表示“**是**” **False**表示“**否**” 只有这两个值\n","- 配置说明 **[]** 表示数组,里面可以存放内容,每个内容需要用**英语(半角)逗号**隔开\n","- 配置说明 **''或者\"\"** 英语(半角)的双引号或者单引号包裹的内容是**字符串**,比如放在数组里面的路径就需要是一个字符串\n","- 配置说明 **#** **#** 后面的内容是**注释**,是帮助性内容,对整个代码的执行不会有影响\n"]},{"cell_type":"markdown","metadata":{},"source":["# 更新记录\n","#### 2401022 v222\n","- 增加打包的 Comfyui 运行环境,将 Comfyui 的启动时间减少到5分钟作用\n","\n","#### 2401019 v221\n","- 修复 Comfyui 启动失败的问题\n","\n","#### 2400817 v220\n","- 修复 Comfyui 白屏的问题。(因为当前Comfyui不再能代理到二级目录,所以在启用comfyui的情况下将会导致webui的访问路径变更为`/webui/`和`/webui2/`,且comfyui只能使用到一张卡)\n","\n","#### 2400803 v218\n","- 增加跳过启动webui的功能(同时也会跳过安装webui的pyhton环境)\n","\n","#### 240717 v216\n","- 给 huggingface 的下载链接增加 download=true 参数,解决下载的文件不正确的问题\n","\n","#### 240622 v215\n","- 默认只启动一个webui,降低内存占用,使用SDXL模型时降低卡死的概率\n","- 修复定时结束功能导致笔记状态为异常退出的问题\n","- 安装目录更新到/kaggle默认,使用文件浏览器管理文件时更方便\n","\n","#### 240619 v212\n","- 更新环境包\n","- 分离Comfyui与Webui的环境(Comfyui的环境在启动时下载)\n","\n","#### 240526 v211\n","- 更新到sd1.9 (没有适配最新的环境,依然使用旧环境)\n","\n","# 更新记录\n","#### 2400317 v209\n","- 更新到新的环境包\n","\n","#### 2401026 v202\n","- 增加了一个文件浏览器,通过在访问地址后加 ``` /fslist/ ``` 来访问 登录用户 admin 密码 admin\n","\n","#### 2401024 v201\n","- 增加一个定时停止的功能,用于在有些时候仅需要启动来使用几个小时的情况\n","\n","#### 240104 v200\n","- 双开ComfyUI\n","\n","#### 240101 v198\n","- 增加了更多ComfyUI节点,让ComfyUI安装后变得可用,而不是示例\n","\n","#### 231226 v195\n","- 修复代理配置错误导致cui无法访问的问题\n","- 增加了一个ComfyUI插件,可以优化移动端使用体验 ComfyUI 可以在代理地址后面加 ``` /cui/ ``` 来访问\n","\n","#### 231221 v193\n","- 增加安装了一个ComfyUI,同时也作为一个文件加载配置的示例\n","\n","#### 231201 v190\n","- 当存在huggingface token的情况下,将会使用token下载huggingface文件,可以下载私有仓库或文件\n","- 增加了一个修改后支持加密插件的C站浏览器插件,方便在运行时搜索和下载C站模型。\n","\n","#### 231112 v188\n","- 新增了两个插件和一个超分辨模型\n","\n","#### 231111 v187\n","- 修改了一些说明文字\n","\n","#### 231110 v186\n","- 增加了一些默认插件\n","\n","#### 231109 v184\n","- 增加了一个可在启动前执行自定义逻辑的功能,将需要执行的逻辑写在 on_before_start 方法里面即可\n","\n","#### 231011 v183\n","- 移除了两个默认插件\n","- 更新了env环境 \n","\n","#### 231011 v180\n","- 增加了图片加密插件,默认不启用,请查看启动参数部分设置密码启动,批量解密图片可以查看插件的发布地址\n","\n","#### 230920 v177\n","- 默认不再开启gradio这个内网穿透\n","- 更新了一些文档和说明\n","\n","#### 230910 v175\n","- 增加了默认的sdxl模型\n","- 修改了不合适的使用说明\n","\n","#### 230901 v173\n","- 更新了依赖版本,可以加载sdxl模型了\n","- 增加代码块内容说明,希望有用\n","\n","#### 230812 v171\n","- 把关闭半精度的参数注释了,这是之前写错的,注释后不容易爆内存\n","- 增加默认模型的参数,用于指定模型启动时默认的模型\n","\n","#### 230726 v170\n","- 更新了整个配置,可以更加自由的下载和加载文件\n","- 删除了大部分参数\n","\n","#### 230726 v169\n","- 增加了一个文件加载配置,可以自定义把文件或下载地址加载到指定目录,配置方式见 [ 其他文件列表 ]\n","- 增加了一个配置,可以隐藏部分控制台输出,但隐藏不完全,没啥用\n","\n","#### 230719 v168\n","- 增加了同步收藏文件夹到 huggingface 数据集的功能,仅同步收藏文件夹,如果同步所有图片也太浪费资源了\n","\n","#### 230716 v167\n","- 账号解封了\n","- 已经更新为精简自动更新版,主要逻辑分离存放到 [huggingface](https://huggingface.co/viyi/sdwui),这边基本上不再需要更新\n","- 如果增加了新功能需要新的配置,可以在输出内容的最前面查看到(暂定)\n","\n","#### 230302 v165\n","- 可以修改disableShared=True来使用pm2启动,做到爆内存自动重启(需要使用frpc或者ngrok代理,否则无法访问界面)\n","\n","#### 230228 v156\n","- 移除了koishi的相关功能 如需使用,可查看 [sd-webui-koishi](https://www.kaggle.com/code/yiyiooo/sd-webui-koishi)\n","\n","#### 230227 v147\n","- 增加了nginx做反向代理,现在可以使用一个ngrok地址访问多个服务了 功能在版本156移除\n","\n","#### 230225 v139\n","- 可以加载ssl证书,启动https的隧道了\n","\n","#### 230224 v134\n","- 可以自动修改frp的本地端口\n","\n","#### 230224 v128\n","- 修复默认模型文件不存在时不能启动的问题\n","- 修复了多线程导致依赖等内容安装位置错乱的问题\n","- 修复了第一次启动会更新koishi数据对应的数据集问题\n","- 增加了配置检查功能,对一些配置项做了提示\n","- 增加了可配置webui端口功能,现在可以配置webui、froc、ngrok的端口了\n","\n","#### 230223 v126\n","- 修复了仅适用koishi数据目录无法启动koishi的问题\n","- 修改了部分文档\n","\n","#### 230223 v124\n","- 修复使用多线程后出现的文件安装下载目录失败的问题\n","- 修复使用多线程后文件目录错乱问题\n","\n","#### 230222 v123\n","- 使用多线程进行安装,节省安装时间\n","\n","#### 230222 v122\n","- 更改了默认配置,现在训练的输出可以在Output下面查看了\n","\n","#### 230222 v118\n","- 增加了自动上传koishi的数据到数据集且能自动下载的功能\n","    - 自动上传的数据集优先级高于手动上传的\n","    - 上一个版本的数据集与当前版本的目录结构有差异,如果更新后需要修改配置\n","    \n","#### 230121 v111\n","- 增加了koishi的部署相关功能  功能在版本156移除\n","\n","#### 230220 v110\n","- 增加了ControlNet插件的一些说明\n","\n","#### 230220 v109\n","- 修复第二次Run all时不能切换到新的frpc配置问题\n","- 增加更新记录,用于记录每次更新 "]}],"metadata":{"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"datasetId":2716934,"sourceId":6167400,"sourceType":"datasetVersion"},{"datasetId":3654544,"sourceId":6346544,"sourceType":"datasetVersion"},{"datasetId":4364744,"sourceId":7496040,"sourceType":"datasetVersion"},{"datasetId":2962375,"sourceId":8927260,"sourceType":"datasetVersion"},{"datasetId":3074484,"sourceId":8972237,"sourceType":"datasetVersion"},{"datasetId":5926543,"sourceId":9693949,"sourceType":"datasetVersion"}],"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.12.4"}},"nbformat":4,"nbformat_minor":4}