Upload Kaggle-Stable-Diffusion V1.4.ipynb
Browse files
Kaggle-Stable-Diffusion V1.4.ipynb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"## NovelAi stable-diffusion-webui+api 修复版(Kaggle云端部署项目,完全免费,无需任何配置!)\n**torch: 1.13.1+cu117 • xformers: 0.0.16rc425**\n","metadata":{}},{"cell_type":"markdown","source":"<a href=\"https://sm.ms/image/fnCzAYw1FksqZEW\" target=\"_blank\"><img src=\"https://s2.loli.net/2023/02/06/fnCzAYw1FksqZEW.png\" /></a>\nKaggle在线部署NovelAi(Webui)的生成演示效果,与本地部署效果几乎一致。模型:AbyssOrange_mix2_nsfw","metadata":{}},{"cell_type":"markdown","source":"<div class=\"alert alert-block alert-info\" style=\"font-size:14px; font-family:verdana;\">\n 📌 2023年3月5日更新:现在支持通过下载链接上传模型了,省去了下载模型后再上传后的麻烦.()\n</div>","metadata":{}},{"cell_type":"markdown","source":"# 注意事项/WARNING:\n- ### 1.将设置中的PERSISTENCE改为Files Only方便下次打开提高启动速度,第一次启动后下载Python环境包就不用下载第二次了\n- ### 2.检测到出现涩图会容易导致封号现象,建议到webui设置里把'始终保存所有生成的图像'和‘始终保存所有生成的宫格图’关了!!\n# **DO NOT GENGRATE <span style=\"color:crimson;\">NSFW</span> IMAGE**\n# <span style=\"color:crimson;\">**请勿生成违规图片!**</span>","metadata":{}},{"cell_type":"markdown","source":"<center style=\"font-family:cursive; font-size:18px; color:#159364;\">以下是代码区域</center>","metadata":{}},{"cell_type":"markdown","source":"---\n# **第一个代码单元格:**\n ### 重要区域,换模型,装扩展都在此处,可以根据自己需求改","metadata":{}},{"cell_type":"code","source":"\n#第一个代码单元格,可以根据自己的需求进行更改\n\n#通过下载链接下载模型,支持C站和Huggingface上面的模型,不能带空格\nmodelurl = 'https://huggingface.co/ckpt/anything-v4.5-vae-swapped/resolve/main/anything-v4.5-vae-swapped.safetensors'\nname = 'Anything-V4.5.safetensors'#你所下载模型的名称,必填,不能带空格,记得带上模型的后缀(safetensors/ckpt)\n\nuseNgrok=False # 非必填 是否使用ngrok作为公网访问地址\nngrokTokenFile='/kaggle/input/configs/ngrok_token.txt' # 非必填 存放ngrokToken的文件的路径\nuseFrpc=False\nfrpcConfigFile='/kaggle/input/frpcfile/frpc_7860.ini' # 非必填 frp 配置文件\ndisableShared=False # 关闭默认的gradio.live穿透,如果没有配置ngrok或frp不要开启这个选项\n\n# 模型目录 \n# Stable Diffusion模型请放在这里(不用填模型的文件名,只填模型的目录即可)\nmodelDirs = []\n# Hypernetworks超网络模型路径请放在这里:\nhypernetworksModelDirs = []\n# embeddings(pt文件)请放在这里:\nembeddingsModelDirs = [] \n# Lora模型的数据集路径请写在这里:\nloraModelDirs = [] \n# 此配置内的目录下所有文件将加载到wildcards文件夹\nwildcardsFileDirs = [] \n\n# ControlNet模型请放在这里:\nControlnet = []\n\n# 将Lora模型放在可选附加网络扩展(占用内存高,拖慢启动速度。请注意!!)\nAdditionalNetworks = []\n\n# 插件列表: git仓库地址\n# 开启公网访问后将不能在webui界面安装插件,如果有需要安装的插件,把地址加入到下面\n# 不需要的插件在前面加 # ,插件地址之间需要用英语逗号隔开\nextensions = [\n # krita 绘图软件插件\n #'https://github.com/Interpause/auto-sd-paint-ext',\n # 汉化 对新功能没有完全覆盖\n 'https://github.com/2575044704/stable-diffusion-webui-localization-zh_CN', \n # 图片浏览器 不安装不能在webui界面查看图片\n 'https://github.com/yfszzx/stable-diffusion-webui-images-browser', \n # 自动tag补全插件 tag翻译文件在webui_settings这个配置里\n 'https://github.com/DominikDoom/a1111-sd-webui-tagcomplete', \n # 此插件会过滤重复标签和空标签、会将中文的逗号和括号替换成英文的逗号或括号,可能影响tag权重\n 'https://github.com/viyiviyi/filter-empty-prompts.git', \n # 可以使用__加文件名的方式从文件中随机读取一行加入到tag\n #'https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards', \n # 提示词变迁插件 没用过 -_-\n #'https://github.com/Kahsolt/stable-diffusion-webui-prompt-travel.git' ,\n #美术风格\n 'https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients.git',\n # Lora的扩展(占内存,慎用)\n #'https://github.com/kohya-ss/sd-webui-additional-networks',\n # ControlNet\n 'https://github.com/Mikubill/sd-webui-controlnet',\n # OpenPose\n 'https://github.com/fkunn1326/openpose-editor',\n #Lora分层控制\n 'https://github.com/hako-mikan/sd-webui-lora-block-weight',\n #AI动画!!神器\n 'https://github.com/Scholar01/sd-webui-mov2mov.git',\n #supermerger\n 'https://github.com/hako-mikan/sd-webui-supermerger'\n]\n\n# webui的配置文件 因为有比较多的人在用了,而个人喜好又不一样,所以这里可以使用自己的配置文件\n# 需要使用git仓库 需要将对应的文件放在仓库的 dist目录下,dist目录下的全部文件都会被复制到webui的根目录\nwebui_settings = 'https://github.com/2575044704/sd-configs2.git'\n# 设置文件路径 默认使用 webui_settings 里面的config.json 和 ui-config.json文件\nsetting_file = '/kaggle/input/configs/config.json'\nui_config_file = '/kaggle/input/configs/ui-config.json'\notherArgs = '' # '--api-auth=2333:6666 --gradio-auth=2333:6666' # 其他需要加载的webui启动参数\n#VAE相关,一般不用改,这个vae色彩度很高\nzheshiVAEwenjian = 'https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt'\naddress = 'orangemix.vae.pt'\n# koishi相关\nuseKoishi = False # 是否开启Koishi机器人\nkoishiPort = 5140 # 使用7860将会占用webui的默认端口\n# 如果这个配置文件与上面的配置文件相同,可能会出问题\nkoishiFrpcConfig = '/kaggle/input/frpcfile/frpc_5140.ini'\n# 可以将输出目录的文件下载后上传到数据集,下次启动就不用再配置一次\nkoishiPath = '/kaggle/input/koishirepair/kaggle/koishi'\n#机器人登不上的时候可以用这个转移account文件\naccount = '/kaggle/input/2302594520'","metadata":{"execution":{"iopub.status.busy":"2023-04-16T15:24:19.493595Z","iopub.execute_input":"2023-04-16T15:24:19.493980Z","iopub.status.idle":"2023-04-16T15:24:19.533609Z","shell.execute_reply.started":"2023-04-16T15:24:19.493940Z","shell.execute_reply":"2023-04-16T15:24:19.532584Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"markdown","source":"---\n# **第二个代码单元格:**\n ### 不常用设置,一般不用改","metadata":{}},{"cell_type":"code","source":"#第二个代码单元格,此处的设置一般不用动\n\n# 手机端界面优化 使用了修改过界面布局顺序的webui,不定期同步到官方版本\nmobileOptimize=False\n# 安装目录 如果安装目录在输出目录(/kaggle/working)下,建议不要开启 Save Version 功能,因为每次结束运行都需要等待上传全部文件\ninstall_path=\"/kaggle/working\" \n# 输出目录 默认将 图片输出目录和图片收藏目录连接到此目录下 可以在下方 【配置文件链接】 处开启链接其他文件夹(完全没有必要)\noutput_path=\"/kaggle/working\"\n\n# 配置启动参数\nquickStart=False # 快速启动 使用下载好的python环境 开启后启动到可用需要4分钟,不开启需要8分钟\nvaeHalf=False # vae开启半精度,关闭效果更好,对速度没啥影响\nmodelHalf=True # 模型开启半精度,关闭效果更好,但生成速度减半\nconsoleProgressbars=False # 控制台显示进度条,关闭可以减少一些输出内容,查看日志时更快一点\nconsolePrompts=False # 同上 \nenableLoadByCopy=False # 是否使用copy的方式加载文件 启动变慢,且测试后没有提高模型切换速度\n\n# 配置文件链接\nlinkHypernetworksDir=False # 链接 hypernetworks 目录到输出目录 如果需要训练 hypernetworks 时建议开启\nlinkEmbeddingsDir=False # 链接 embeddings 目录到输出目录 如果需要训练 embeddings 时建议开启\nlinkTextual_inversionDir=False # 链接 textual_inversion 目录到输出目录 如果需要保存训练过程的产出文件时建议开启\n\n# 这下面的是用于初始化一些值或者环境变量的,轻易别改\nfrom pathlib import Path\nimport os\nimport time\nimport re\nif not Path(frpcConfigFile).exists(): useFrpc = False\nos.environ['install_path'] = install_path\nos.environ['output_path'] = output_path\nos.environ['webui_settings'] = webui_settings\nos.environ['frpcConfig'] = frpcConfigFile\n\nngrokToken=''\nif Path(ngrokTokenFile).exists():\n with open(ngrokTokenFile,encoding = \"utf-8\") as nkfile:\n ngrokToken = nkfile.readline()","metadata":{"execution":{"iopub.status.busy":"2023-04-16T15:24:19.535837Z","iopub.execute_input":"2023-04-16T15:24:19.536398Z","iopub.status.idle":"2023-04-16T15:24:19.546280Z","shell.execute_reply.started":"2023-04-16T15:24:19.536360Z","shell.execute_reply":"2023-04-16T15:24:19.545160Z"},"trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"code","source":"# 重置变量 用于修改参数后重新安装\nreLoad = True\n# 如果需要重新安装,请注释这一行\nreLoad = False","metadata":{"execution":{"iopub.status.busy":"2023-04-16T15:24:19.547667Z","iopub.execute_input":"2023-04-16T15:24:19.548381Z","iopub.status.idle":"2023-04-16T15:24:19.561955Z","shell.execute_reply.started":"2023-04-16T15:24:19.548342Z","shell.execute_reply":"2023-04-16T15:24:19.558610Z"},"trusted":true},"execution_count":3,"outputs":[]},{"cell_type":"markdown","source":"---\n# **第三个代码单元格:**\n ### Koishi机器人项目(已修复!能用了!)","metadata":{}},{"cell_type":"code","source":"# Koishi https://koishi.chat/\ndef installKoishi():\n !echo '安装koishi和相关依赖'\n %cd $install_path\n !mkdir -p koishi\n %cd koishi\n !apt-get update\n !apt-get install chromium-browser -y\n if Path(koishiPath).exists():\n os.system('cp -rf -n '+koishiPath+'/* ./')\n !cp -rf {account} $install_path/koishi/accounts\n else:\n !npm init -y\n !npm i koishi -D\n !npx koishi init\n !npm i @koishijs/plugin-logger @koishijs/plugin-market @koishijs/plugin-console -D\n !npm i @koishijs/plugin-auth @koishijs/plugin-status @koishijs/plugin-insight -D\n !npm i\ndef startKoishi():\n %cd $install_path/koishi\n if Path('koishi.config.yml').exists():\n !pm2 del koishi\n !pm2 start npx -n koishi -- koishi start koishi.config.yml\n return\n content = f'''\n# 全局设置\nhost: localhost\n# 端口\nport: {koishiPort}\n# 插件列表\nplugins:\n # group 表示这是一个插件组\n group:console:\n # 波浪线前缀表示一个不启用的插件\n auth: \n console:\n logger:\n status:\n insight:\n market:\n'''\n !mkdir -p $install_path/koishi/\n with open('koishi.config.yml','w') as sh:\n sh.write(content)\n !pm2 del koishi\n !pm2 start npx -n koishi -- koishi start koishi.config.yml\n\ndef startKoishFrpc():\n !pm2 del frpc_koishi\n os.system('pm2 start $install_path/frpc/frpc -n frpc_koishi -- -c '+koishiFrpcConfig)\n \ndef saveKoishi():\n %cd /kaggle/working/\n !tar -cvf koishi.tar --exclude=koishi/node_modules --exclude=koishi/logs $install_path/koishi \n\n# 每10分钟保存一次koishi的数据\ndef autoZipKoishiData():\n %cd $install_path\n content = '''\nsetInterval(() => {\n try {\n const { exec } = require('child_process');\n exec('tar -cvf /kaggle/working/koishi.tar --exclude=koishi/node_modules --exclude=koishi/logs $install_path/koishi');\n console.log('每10分钟保存一次数据');\n } catch (error) {\n console.error('保存数据失败');\n }\n}, 1000 * 60 * 10);\n '''\n with open('autoZipKoishiData.js','w') as sh:\n sh.write(content)\n !pm2 del autoZipKoishiData\n !pm2 start autoZipKoishiData.js -n autoZipKoishiData","metadata":{"execution":{"iopub.status.busy":"2023-04-16T15:24:19.649236Z","iopub.execute_input":"2023-04-16T15:24:19.649504Z","iopub.status.idle":"2023-04-16T15:24:19.772051Z","shell.execute_reply.started":"2023-04-16T15:24:19.649479Z","shell.execute_reply":"2023-04-16T15:24:19.770972Z"},"trusted":true},"execution_count":4,"outputs":[]},{"cell_type":"markdown","source":"---\n# **第四个代码单元格:**\n ### Webui安装","metadata":{}},{"cell_type":"code","source":"# 功能函数\n# 绕过 os.systen 的限制执行命令\ndef run(shell:str):\n with open('run_cache.sh','w') as sh:\n sh.write(shell)\n !bash run_cache.sh\n\n# 连接多个路径字符串 让路径在shell命令中能正常的执行\ndef pathJoin(*paths:str):\n pathStr = ''\n for p in paths:\n pathStr += '\"'+p+'\"'\n pathStr = '\"*\"'.join(pathStr.split('*'))\n pathStr = '\"$\"'.join(pathStr.split('$'))\n pathStr = '\"(\"'.join(pathStr.split('('))\n pathStr = '\")\"'.join(pathStr.split(')'))\n pathStr = '\"{\"'.join(pathStr.split('{'))\n pathStr = '\"}\"'.join(pathStr.split('}'))\n pathStr = re.sub(r'\"\"','',pathStr)\n pathStr = re.sub(r'\\*{2,}','\"',pathStr)\n pathStr = re.sub(r'/{2,}','/',pathStr)\n pathStr = re.sub(r'/\\./','/',pathStr)\n return pathStr\n\n# 判断路径是不是一个文件或者可能指向一些文件\ndef pathIsFile(path):\n if Path(path).is_file():\n return True\n if re.search(r'\\.(ckpt|safetensors|png|jpg|txt|pt|pth|json|yaml|\\*)$',path):\n return True\n return False\n\ndef installEnv():\n !npm i -g pm2\n\n#安装webui\ndef install():\n %cd $install_path\n if reLoad:\n !rm -rf stable-diffusion-webui\n if Path(\"stable-diffusion-webui\").exists():\n %cd $install_path/stable-diffusion-webui/\n !git checkout .\n !git pull\n else:\n if mobileOptimize:\n !git clone https://github.com/viyiviyi/stable-diffusion-webui.git -b local # 修改了前端界面,手机使用更方便\n else:\n !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui \n %cd $install_path/stable-diffusion-webui/\n !add-apt-repository ppa:deadsnakes/ppa -y\n !apt update\n !apt install python3.10 -y\n !python3.10 -V\n !python3.10 -m venv venv --without-pip --clear\n !curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py\n !venv/bin/python3.10 get-pip.py\n !venv/bin/python3 -V\n !venv/bin/python3 -m pip -V\n if quickStart:\n !echo \"解压Python环境... unzip venv\"\n !tar -xf /kaggle/working/venv/venv.tar.bak -C ./\n\n# 链接输出目录\ndef link_dir():\n # 链接输出目录 因为sd被部署在了stable-diffusion-webui目录,运行结束后为了方便下载就只有outputs目录放在output_path/目录下\n !mkdir -p $output_path/outputs\n !rm -rf $install_path/stable-diffusion-webui/outputs\n !ln -s -r $output_path/outputs $install_path/stable-diffusion-webui/ # 输出目录\n !mkdir -p $output_path/log\n !rm -rf $install_path/stable-diffusion-webui/log\n !ln -s -r $output_path/log $install_path/stable-diffusion-webui/\n # 链接 hypernetworks 目录\n if linkHypernetworksDir:\n !rm -rf $install_path/stable-diffusion-webui/models/hypernetworks\n !mkdir -p $output_path/hypernetworks\n !ln -s -r $output_path/hypernetworks $install_path/stable-diffusion-webui/models/\n # 链接 embeddings 目录\n if linkEmbeddingsDir:\n !rm -rf $install_path/stable-diffusion-webui/embeddings\n !mkdir -p $output_path/embeddings\n !ln -s -r $output_path/embeddings $install_path/stable-diffusion-webui/\n # 链接训练输出目录 文件夹链接会导致功能不能用\n if linkTextual_inversionDir:\n !rm -rf $install_path/stable-diffusion-webui/textual_inversion\n !mkdir -p $output_path/textual_inversion/\n !ln -s -r $output_path/textual_inversion $install_path/stable-diffusion-webui/\n \n \ndef venvdownload():\n if os.access(\"/kaggle/working/venv/venv.tar.bak\", os.F_OK) or quickStart is False:\n print (\"正在安装Webui\")\n else:\n print(\"\\033[1;31m 首次启动需要一点时间,请耐心等待\\033[0m\")\n print(\"\\033[1;31m 自动下载Python环境包...,可能有点慢\\033[0m\")\n !apt -y update -qq\n !apt -y install -qq aria2\n !echo '正在自动下载Python环境包'\n !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/ACCA225/vene/resolve/main/venv.tar.bak -d /kaggle/working/venv -o venv.tar.bak\n !echo '下载成功'\n \n# 链接模型文件\n# link models files\ndef link_models():\n print(('复制' if enableLoadByCopy else '链接') + '模型文件')\n if enableLoadByCopy:\n print('如果出现 No such file or directory 错误,可以忽略')\n !mkdir -p $install_path/stable-diffusion-webui/models/Stable-diffusion # 模型和文件目录\n !mkdir -p $install_path/stable-diffusion-webui/models/hypernetworks # 超网络模型目录\n !mkdir -p $install_path/stable-diffusion-webui/embeddings # 画风模型目录\n !mkdir -p $install_path/stable-diffusion-webui/models/Lora # lora 文件目录\n !mkdir -p $install_path/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards # wildcards 文件目录\n !mkdir -p $install_path/stable-diffusion-webui/extensions/sd-webui-controlnet/models/ \n !mkdir -p $install_path/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora\n !mkdir -p $install_path/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora # lora 文件目录\n \n for path in modelDirs:\n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/models/Stable-diffusion')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.ckpt') +' $install_path/stable-diffusion-webui/models/Stable-diffusion/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.safetensors') +' $install_path/stable-diffusion-webui/models/Stable-diffusion/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.png') +' $install_path/stable-diffusion-webui/models/Stable-diffusion/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.jpg') +' $install_path/stable-diffusion-webui/models/Stable-diffusion/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.pt') +' $install_path/stable-diffusion-webui/models/Stable-diffusion/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/hypernetworks*/*.*') +' $install_path/stable-diffusion-webui/models/hypernetworks/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/embeddings*/*.*') +' $install_path/stable-diffusion-webui/embeddings/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/lora*/*.*') +' $install_path/stable-diffusion-webui/models/Lora/')\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/wildcards*/*.*') +' $install_path/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards/')\n for path in wildcardsFileDirs:\n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards/')\n for path in loraModelDirs: \n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/models/Lora/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/models/Lora/')\n for path in embeddingsModelDirs: \n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/embeddings/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/embeddings/')\n for path in hypernetworksModelDirs: \n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/models/hypernetworks/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/models/hypernetworks/')\n if Path(install_path+'/stable-diffusion-webui/extensions/sd-webui-controlnet').exists():\n for path in Controlnet: \n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/extensions/sd-webui-controlnet/models/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f ' + pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/extensions/sd-webui-controlnet/models/')\n if Path(install_path+'/stable-diffusion-webui/extensions/sd-webui-additional-networks').exists():\n for path in AdditionalNetworks: \n if pathIsFile(path):\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f '+ pathJoin(path) +' $install_path/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/')\n continue\n os.system(('cp -n' if enableLoadByCopy else 'ln -s')+' -f ' + pathJoin(path,'/*.*') +' $install_path/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/')\n \n \n %cd $install_path/stable-diffusion-webui/extensions/sd-webui-controlnet/models/\n !rm -f \\*.* # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo controlnetModel文件列表\n !ls\n\n %cd $install_path/stable-diffusion-webui/models/Stable-diffusion\n !rm -f \\*.* & rm -f \\*.ckpt & rm -f \\*.safetensors & rm -f \\*.png & rm -f \\*.pt & rm -f \\*.jpg # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo 模型文件列表\n !ls\n %cd $install_path/stable-diffusion-webui/models/hypernetworks\n !rm -f \\*.* # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo hypernetworks超网络模型文件列表\n !ls\n %cd $install_path/stable-diffusion-webui/embeddings\n !rm -f \\*.* # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo embedding文件列表\n !ls\n %cd $install_path/stable-diffusion-webui/models/Lora\n !rm -f \\*.* # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo lora文件列表\n !ls\n %cd $install_path/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards\n !rm -f \\*.* # 删除因为文件夹没有对应文件导致复制了一个'*.*'的文件\n !echo wildcards文件列表\n !ls\n\n#下载模型\ndef modelsdownload():\n !apt -y update -qq\n !apt -y install -qq aria2\n !echo '正在下载模型...'\n !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {modelurl} -d $install_path/stable-diffusion-webui/models/Stable-diffusion -o {name}\n !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/EasyNegative/resolve/main/EasyNegative.safetensors -d $install_path/stable-diffusion-webui/embeddings/ -o EasyNegative.safetensors\n#下载VAE\ndef vaedownload():\n !echo '正在下载VAE...'\n !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {zheshiVAEwenjian} -d $install_path/stable-diffusion-webui/models/Stable-diffusion -o {address}\n \n#安装依赖\ndef install_dependencies():\n %cd $install_path/stable-diffusion-webui\n !python3 -m venv venv\n !source venv/bin/activate\n !COMMANDLINE_ARGS=\"--exit\" REQS_FILE=\"requirements.txt\" venv/bin/python3 launch.py\n\n# 安装插件\ndef install_extensions():\n print('安装插件,此处出现红条是正常的')\n %cd $install_path/stable-diffusion-webui\n !mkdir -p extensions\n %cd extensions\n for ex in extensions:\n os.system('git clone '+ex)\n #Tag选择器\n !cp -r /kaggle/input/tagextensions/maple-from-fall-and-flower $install_path/stable-diffusion-webui/extensions/maple-from-fall-and-flower\n \n# 个性化配置 \ndef use_config():\n %cd $install_path/stable-diffusion-webui\n !mkdir -p tmp\n %cd tmp\n !git clone $webui_settings sd-configs\n !cp -rf sd-configs/dist/* $install_path/stable-diffusion-webui\n \n# ngrok\ndef ngrok_start():\n if useNgrok == True and ngrokToken != '':\n print('use nrgok')\n !pip install pyngrok\n from pyngrok import conf, ngrok\n conf.get_default().auth_token = ngrokToken\n conf.get_default().monitor_thread = False\n ssh_tunnels = ngrok.get_tunnels(conf.get_default())\n if len(ssh_tunnels) == 0:\n ssh_tunnel = ngrok.connect(7860)\n print('address:'+ssh_tunnel.public_url)\n else:\n print('address:'+ssh_tunnels[0].public_url)\n else:\n print('skip start ngrok')\n \ndef installFrpc():\n !apt -y update -qq\n !apt -y install -qq aria2\n !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/ACCA225/Frp/resolve/main/frpc -d $install_path/stable-diffusion-webui/ -o frpc\n %cd $install_path\n !mkdir -p frpc\n %cd frpc\n !cp -f -n $install_path/stable-diffusion-webui/frpc ./frpc\n !chmod +x ./frpc\n !./frpc -v\n \ndef startFrpc():\n if useFrpc:\n !pm2 del frpc_webui\n !pm2 start $install_path/frpc/frpc -n frpc_webui -- -c $frpcConfig\n \ndef installBore():\n %cd $install_path\n !mkdir -p bore\n %cd bore\n !cp -f -n /kaggle/input/net-tools/bore ./bore\n !chmod +x ./bore\n\ndef startBore():\n !pm2 del bore\n !pm2 start $install_path/bore/bore -n bore -- local 5140 --to bore.pub\n \n# 打包输出图片到$output_path/outputs.tar文件\ndef zip_output():\n !echo \"打包输出图片到$output_path/outputs.tar文件\"\n %cd $install_path/stable-diffusion-webui/\n !tar -cf outputs.tar ./outputs\n !mv ./outputs.tar $output_path/\n \n# 启动\ndef start():\n %cd $install_path/stable-diffusion-webui\n !python3 -m venv venv\n !source venv/bin/activate\n args = '--disable-safe-unpickle --deepdanbooru'\n if not disableShared:\n args += ' --share'\n args += ' --skip-torch-cuda-test'\n args += ' --xformers' # 已经可用\n args += ' --api --listen' # 开放 api\n args += ' --lowram'# 降低爆内存几率\n if ui_config_file is not None and ui_config_file != '' and Path(ui_config_file).exists(): # ui配置文件\n args += ' --ui-config-file=' + pathJoin(ui_config_file)\n if setting_file is not None and setting_file != '' and Path(setting_file).exists(): # 设置配置文件\n args += ' --ui-settings-file=' + pathJoin(setting_file)\n if name is not None and name != '': # 设置启动时默认加载的模型\n if '.' in name:\n if '/' in name:\n args += ' --ckpt='+ pathJoin(name)\n else:\n args += ' --ckpt='+ pathJoin(install_path, '/stable-diffusion-webui/models/Stable-diffusion/', name)\n else:\n for x in ['.ckpt','.safetensors']:\n if Path(install_path+'/stable-diffusion-webui/models/Stable-diffusion/' + name+x).exists():\n args += ' --ckpt='+ pathJoin(install_path, '/stable-diffusion-webui/models/Stable-diffusion/', name, x)\n break\n if vaeHalf is False: \n args += ' --no-half-vae'\n if modelHalf is False:\n args += ' --no-half'\n if consoleProgressbars is False:\n args += ' --disable-console-progressbars'\n if consolePrompts is True:\n args += ' --enable-console-prompts'\n args += ' ' + otherArgs\n os.environ['COMMANDLINE_ARGS']=args\n !echo COMMANDLINE_ARGS=$COMMANDLINE_ARGS\n %env REQS_FILE=requirements.txt\n !pm2 log & venv/bin/python3 launch.py\n \ndef autosave():\n !tar -cvf /kaggle/working/输出内容.tar /kaggle/working/outputs\n !echo \"图片已保存至输出目录\"\n\ndef main2():\n modelsdownload()\n vaedownload()\n link_models()\n ngrok_start()\n startFrpc()\n if useKoishi:\n startKoishFrpc()\n startKoishi()\n autoZipKoishiData()\n start()\n\ndef main():\n startTicks = time.time()\n isInstall = True if os.getenv('IsInstall','False') == 'True' else False\n if isInstall is False or reLoad:\n venvdownload()\n install()\n install_extensions()\n installEnv()\n use_config()\n link_dir()\n installFrpc()\n if useKoishi:\n installKoishi()\n isInstall = True\n os.environ['IsInstall'] = 'True'\n modelsdownload()\n vaedownload()\n link_models()\n ticks = time.time()\n print(\"加载耗时:\",(ticks - startTicks),\"s\")\n ngrok_start()\n startFrpc()\n if useKoishi:\n startKoishFrpc()\n startKoishi()\n autoZipKoishiData()\n start()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-16T15:24:19.774486Z","iopub.execute_input":"2023-04-16T15:24:19.774857Z","iopub.status.idle":"2023-04-16T15:24:25.001057Z","shell.execute_reply.started":"2023-04-16T15:24:19.774821Z","shell.execute_reply":"2023-04-16T15:24:24.999871Z"},"trusted":true},"execution_count":5,"outputs":[]},{"cell_type":"markdown","source":"---\n# **第五个代码单元格:**\n ### 输出日志","metadata":{}},{"cell_type":"code","source":"# 启动的输出日志,等待约5分钟,最终会得到一个gradio.live的链接,但如果出现Error这个词,说明出错了。请联系管理员解决该问题\n# start\nif Path(\"/kaggle/working/stable-diffusion-webui\").exists():\n main2()\nelse:\n main()\n\nif useKoishi:\n saveKoishi()","metadata":{"_kg_hide-input":true,"_kg_hide-output":false,"execution":{"iopub.status.busy":"2023-04-16T15:24:25.002618Z","iopub.execute_input":"2023-04-16T15:24:25.003042Z"},"trusted":true},"execution_count":null,"outputs":[{"name":"stdout","text":"正在安装Webui\n/kaggle/working\nCloning into 'stable-diffusion-webui'...\nremote: Enumerating objects: 17850, done.\u001b[K\nremote: Total 17850 (delta 0), reused 0 (delta 0), pack-reused 17850\u001b[K\nReceiving objects: 100% (17850/17850), 28.27 MiB | 28.89 MiB/s, done.\nResolving deltas: 100% (12491/12491), done.\n/kaggle/working/stable-diffusion-webui\nGet:1 http://packages.cloud.google.com/apt gcsfuse-focal InRelease [5002 B]\nGet:2 https://packages.cloud.google.com/apt cloud-sdk InRelease [6361 B] \nGet:3 https://packages.cloud.google.com/apt google-fast-socket InRelease [5015 B]\nGet:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] \nGet:5 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease [1581 B]\nHit:6 http://archive.ubuntu.com/ubuntu focal InRelease \nGet:7 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease [18.1 kB]\nGet:8 http://packages.cloud.google.com/apt gcsfuse-focal/main amd64 Packages [2149 B]\nGet:9 https://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages [423 kB]\nGet:10 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] \nGet:11 https://packages.cloud.google.com/apt google-fast-socket/main amd64 Packages [449 B]\nGet:12 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages [975 kB]\nGet:13 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]\nGet:14 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [2593 kB]\nGet:15 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [2065 kB]\nGet:16 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [28.5 kB]\nGet:17 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [1029 kB]\nGet:18 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 Packages [29.5 kB]\nGet:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3075 kB]\nGet:20 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [31.2 kB]\nGet:21 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [2203 kB]\nGet:22 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1325 kB]\nGet:23 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]\nGet:24 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]\nFetched 14.2 MB in 2s (6114 kB/s) \nReading package lists... Done\nHit:1 http://packages.cloud.google.com/apt gcsfuse-focal InRelease\nGet:2 https://packages.cloud.google.com/apt cloud-sdk InRelease [6361 B] \u001b[0m\nHit:3 https://packages.cloud.google.com/apt google-fast-socket InRelease \u001b[0m\nHit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease\nHit:5 http://archive.ubuntu.com/ubuntu focal InRelease \u001b[0m \u001b[0m\u001b[33m\nHit:6 http://security.ubuntu.com/ubuntu focal-security InRelease \u001b[0m\nHit:7 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease\nHit:8 http://archive.ubuntu.com/ubuntu focal-updates InRelease\nHit:9 http://archive.ubuntu.com/ubuntu focal-backports InRelease\nFetched 6361 B in 1s (5161 B/s)33m\u001b[33m\u001b[33m\u001b[33m\u001b[33m\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\n84 packages can be upgraded. Run 'apt list --upgradable' to see them.\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\nThe following additional packages will be installed:\n libpython3.10-minimal libpython3.10-stdlib python3.10-minimal\nSuggested packages:\n python3.10-venv binfmt-support\nThe following NEW packages will be installed:\n libpython3.10-minimal libpython3.10-stdlib python3.10 python3.10-minimal\n0 upgraded, 4 newly installed, 0 to remove and 84 not upgraded.\nNeed to get 5215 kB of archives.\nAfter this operation, 20.2 MB of additional disk space will be used.\nGet:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.10-minimal amd64 3.10.11-1+focal1 [822 kB]\nGet:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.10-minimal amd64 3.10.11-1+focal1 [2079 kB]\nGet:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.10-stdlib amd64 3.10.11-1+focal1 [1760 kB]\nGet:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.10 amd64 3.10.11-1+focal1 [553 kB]\nFetched 5215 kB in 4s (1471 kB/s) \u001b[0m\u001b[33m\u001b[33m\n\n\u001b7\u001b[0;23r\u001b8\u001b[1ASelecting previously unselected package libpython3.10-minimal:amd64.\n(Reading database ... 111522 files and directories currently installed.)\nPreparing to unpack .../libpython3.10-minimal_3.10.11-1+focal1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 0%]\u001b[49m\u001b[39m [..........................................................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 6%]\u001b[49m\u001b[39m [###.......................................................] \u001b8Unpacking libpython3.10-minimal:amd64 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 12%]\u001b[49m\u001b[39m [######....................................................] \u001b8Selecting previously unselected package python3.10-minimal.\nPreparing to unpack .../python3.10-minimal_3.10.11-1+focal1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 18%]\u001b[49m\u001b[39m [##########................................................] \u001b8Unpacking python3.10-minimal (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 24%]\u001b[49m\u001b[39m [#############.............................................] \u001b8Selecting previously unselected package libpython3.10-stdlib:amd64.\nPreparing to unpack .../libpython3.10-stdlib_3.10.11-1+focal1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 29%]\u001b[49m\u001b[39m [#################.........................................] \u001b8Unpacking libpython3.10-stdlib:amd64 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 35%]\u001b[49m\u001b[39m [####################......................................] \u001b8Selecting previously unselected package python3.10.\nPreparing to unpack .../python3.10_3.10.11-1+focal1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 41%]\u001b[49m\u001b[39m [#######################...................................] \u001b8Unpacking python3.10 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 47%]\u001b[49m\u001b[39m [###########################...............................] \u001b8Setting up libpython3.10-minimal:amd64 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 53%]\u001b[49m\u001b[39m [##############################............................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 59%]\u001b[49m\u001b[39m [##################################........................] \u001b8Setting up python3.10-minimal (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 65%]\u001b[49m\u001b[39m [#####################################.....................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 71%]\u001b[49m\u001b[39m [########################################..................] \u001b8Setting up libpython3.10-stdlib:amd64 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 76%]\u001b[49m\u001b[39m [############################################..............] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 82%]\u001b[49m\u001b[39m [###############################################...........] \u001b8Setting up python3.10 (3.10.11-1+focal1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 88%]\u001b[49m\u001b[39m [###################################################.......] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 94%]\u001b[49m\u001b[39m [######################################################....] \u001b8Processing triggers for mime-support (3.64ubuntu1) ...\nProcessing triggers for man-db (2.9.1-1) ...\n\n\u001b7\u001b[0;24r\u001b8\u001b[1A\u001b[JPython 3.10.11\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 2518k 100 2518k 0 0 5254k 0 --:--:-- --:--:-- --:--:-- 5256k\nCollecting pip\n Downloading pip-23.1-py3-none-any.whl (2.1 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m26.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[?25hCollecting setuptools\n Downloading setuptools-67.6.1-py3-none-any.whl (1.1 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m51.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting wheel\n Downloading wheel-0.40.0-py3-none-any.whl (64 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.5/64.5 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hInstalling collected packages: wheel, setuptools, pip\nSuccessfully installed pip-23.1 setuptools-67.6.1 wheel-0.40.0\nPython 3.10.11\npip 23.1 from /kaggle/working/stable-diffusion-webui/venv/lib/python3.10/site-packages/pip (python 3.10)\n安装插件,此处出现红条是正常的\n/kaggle/working/stable-diffusion-webui\n/kaggle/working/stable-diffusion-webui/extensions\n","output_type":"stream"},{"name":"stderr","text":"Cloning into 'stable-diffusion-webui-localization-zh_CN'...\nCloning into 'stable-diffusion-webui-images-browser'...\nCloning into 'a1111-sd-webui-tagcomplete'...\nCloning into 'filter-empty-prompts'...\nCloning into 'stable-diffusion-webui-aesthetic-gradients'...\nCloning into 'sd-webui-controlnet'...\nCloning into 'openpose-editor'...\nCloning into 'sd-webui-lora-block-weight'...\nCloning into 'sd-webui-mov2mov'...\nCloning into 'sd-webui-supermerger'...\n","output_type":"stream"},{"name":"stdout","text":"cp: cannot stat '/kaggle/input/tagextensions/maple-from-fall-and-flower': No such file or directory\n\u001b[K\u001b[?25h\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[30;43mWARN\u001b[0m \u001b[0m\u001b[35mdeprecated\u001b[0m [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\n\u001b[K\u001b[?25hm##################\u001b[0m) ⠴ reify:dayjs: \u001b[32;40mhttp\u001b[0m \u001b[35mfetch\u001b[0m GET 200 https://registry.npmjs.o\u001b[0m\u001b[Knpmjs.\u001b[0m\u001b[K[0m\u001b[K\nadded 184 packages, and audited 185 packages in 7s\n\n12 packages are looking for funding\n run `npm fund` for details\n\nfound \u001b[32m\u001b[1m0\u001b[22m\u001b[39m vulnerabilities\n\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[36;40mnotice\u001b[0m\u001b[35m\u001b[0m \n\u001b[0m\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[36;40mnotice\u001b[0m\u001b[35m\u001b[0m New \u001b[31mmajor\u001b[39m version of npm available! \u001b[31m8.19.2\u001b[39m -> \u001b[32m9.6.4\u001b[39m\n\u001b[0m\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[36;40mnotice\u001b[0m\u001b[35m\u001b[0m Changelog: \u001b[36mhttps://github.com/npm/cli/releases/tag/v9.6.4\u001b[39m\n\u001b[0m\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[36;40mnotice\u001b[0m\u001b[35m\u001b[0m Run \u001b[32mnpm install -g [email protected]\u001b[39m to update!\n\u001b[0m\u001b[37;40mnpm\u001b[0m \u001b[0m\u001b[36;40mnotice\u001b[0m\u001b[35m\u001b[0m \n\u001b[0m/kaggle/working/stable-diffusion-webui\n/kaggle/working/stable-diffusion-webui/tmp\nCloning into 'sd-configs'...\nremote: Enumerating objects: 31, done.\u001b[K\nremote: Counting objects: 100% (31/31), done.\u001b[K\nremote: Compressing objects: 100% (24/24), done.\u001b[K\nremote: Total 31 (delta 7), reused 1 (delta 0), pack-reused 0\u001b[K\nReceiving objects: 100% (31/31), 1.13 MiB | 8.99 MiB/s, done.\nResolving deltas: 100% (7/7), done.\n84 packages can be upgraded. Run 'apt list --upgradable' to see them.\nThe following additional packages will be installed:\n libaria2-0 libc-ares2 libssh2-1\nThe following NEW packages will be installed:\n aria2 libaria2-0 libc-ares2 libssh2-1\n0 upgraded, 4 newly installed, 0 to remove and 84 not upgraded.\nNeed to get 1550 kB of archives.\nAfter this operation, 6235 kB of additional disk space will be used.\n\n\u001b7\u001b[0;23r\u001b8\u001b[1ASelecting previously unselected package libc-ares2:amd64.\n(Reading database ... 112175 files and directories currently installed.)\nPreparing to unpack .../libc-ares2_1.15.0-1ubuntu0.2_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 0%]\u001b[49m\u001b[39m [..........................................................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 6%]\u001b[49m\u001b[39m [###.......................................................] \u001b8Unpacking libc-ares2:amd64 (1.15.0-1ubuntu0.2) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 12%]\u001b[49m\u001b[39m [######....................................................] \u001b8Selecting previously unselected package libssh2-1:amd64.\nPreparing to unpack .../libssh2-1_1.8.0-2.1build1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 18%]\u001b[49m\u001b[39m [##########................................................] \u001b8Unpacking libssh2-1:amd64 (1.8.0-2.1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 24%]\u001b[49m\u001b[39m [#############.............................................] \u001b8Selecting previously unselected package libaria2-0:amd64.\nPreparing to unpack .../libaria2-0_1.35.0-1build1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 29%]\u001b[49m\u001b[39m [#################.........................................] \u001b8Unpacking libaria2-0:amd64 (1.35.0-1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 35%]\u001b[49m\u001b[39m [####################......................................] \u001b8Selecting previously unselected package aria2.\nPreparing to unpack .../aria2_1.35.0-1build1_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 41%]\u001b[49m\u001b[39m [#######################...................................] \u001b8Unpacking aria2 (1.35.0-1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 47%]\u001b[49m\u001b[39m [###########################...............................] \u001b8Setting up libc-ares2:amd64 (1.15.0-1ubuntu0.2) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 53%]\u001b[49m\u001b[39m [##############################............................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 59%]\u001b[49m\u001b[39m [##################################........................] \u001b8Setting up libssh2-1:amd64 (1.8.0-2.1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 65%]\u001b[49m\u001b[39m [#####################################.....................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 71%]\u001b[49m\u001b[39m [########################################..................] \u001b8Setting up libaria2-0:amd64 (1.35.0-1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 76%]\u001b[49m\u001b[39m [############################################..............] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 82%]\u001b[49m\u001b[39m [###############################################...........] \u001b8Setting up aria2 (1.35.0-1build1) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 88%]\u001b[49m\u001b[39m [###################################################.......] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 94%]\u001b[49m\u001b[39m [######################################################....] \u001b8Processing triggers for man-db (2.9.1-1) ...\nProcessing triggers for libc-bin (2.31-0ubuntu9.9) ...\n\n\u001b7\u001b[0;24r\u001b8\u001b[1A\u001b[J\nDownload Results:\ngid |stat|avg speed |path/URI\n======+====+===========+=======================================================\n6cead4|\u001b[1;32mOK\u001b[0m | 37MiB/s|/kaggle/working/stable-diffusion-webui//frpc\n\nStatus Legend:\n(OK):download completed.\n/kaggle/working\n/kaggle/working/frpc\n0.45.0-sakura-2.3\n84 packages can be upgraded. Run 'apt list --upgradable' to see them.\naria2 is already the newest version (1.35.0-1build1).\n0 upgraded, 0 newly installed, 0 to remove and 84 not upgraded.\n正在下载模型...\n\u001b[35m[\u001b[0m#284da6 3.7GiB/3.9GiB\u001b[36m(93%)\u001b[0m CN:16 DL:\u001b[32m259MiB\u001b[0m\u001b[35m]\u001b[0m\u001b[0m0m\u001b[35m]\u001b[0m\u001b[0mm\nDownload Results:\ngid |stat|avg speed |path/URI\n======+====+===========+=======================================================\n284da6|\u001b[1;32mOK\u001b[0m | 260MiB/s|/kaggle/working/stable-diffusion-webui/models/Stable-diffusion/Anything-V4.5.safetensors\n\nStatus Legend:\n(OK):download completed.\n\u001b[35m[\u001b[0m#d1097f 0B/24KiB\u001b[36m(0%)\u001b[0m CN:1 DL:\u001b[32m0B\u001b[0m\u001b[35m]\u001b[0m\u001b[0m \nDownload Results:\ngid |stat|avg speed |path/URI\n======+====+===========+=======================================================\nd1097f|\u001b[1;32mOK\u001b[0m | 5.0KiB/s|/kaggle/working/stable-diffusion-webui/embeddings//EasyNegative.safetensors\n\nStatus Legend:\n(OK):download completed.\n正在下载VAE...\n\u001b[35m[\u001b[0m#b53b09 620MiB/784MiB\u001b[36m(79%)\u001b[0m CN:16 DL:\u001b[32m221MiB\u001b[0m\u001b[35m]\u001b[0m\u001b[0m0m\u001b[35m]\u001b[0m\u001b[0m\nDownload Results:\ngid |stat|avg speed |path/URI\n======+====+===========+=======================================================\nb53b09|\u001b[1;32mOK\u001b[0m | 242MiB/s|/kaggle/working/stable-diffusion-webui/models/Stable-diffusion/orangemix.vae.pt\n\nStatus Legend:\n(OK):download completed.\n链接模型文件\n/kaggle/working/stable-diffusion-webui/extensions/sd-webui-controlnet/models\ncontrolnetModel文件列表\ncldm_v15.yaml\t\t\t control_v11p_sd15s2_lineart_anime.yaml\ncldm_v21.yaml\t\t\t control_v11u_sd15_tile.yaml\ncontrol_v11e_sd15_ip2p.yaml\t t2iadapter_canny_sd14v1.yaml\ncontrol_v11e_sd15_shuffle.yaml\t t2iadapter_canny_sd15v2.yaml\ncontrol_v11f1p_sd15_depth.yaml\t t2iadapter_color_sd14v1.yaml\ncontrol_v11p_sd15_canny.yaml\t t2iadapter_depth_sd14v1.yaml\ncontrol_v11p_sd15_inpaint.yaml\t t2iadapter_depth_sd15v2.yaml\ncontrol_v11p_sd15_lineart.yaml\t t2iadapter_keypose_sd14v1.yaml\ncontrol_v11p_sd15_mlsd.yaml\t t2iadapter_openpose_sd14v1.yaml\ncontrol_v11p_sd15_normalbae.yaml t2iadapter_seg_sd14v1.yaml\ncontrol_v11p_sd15_openpose.yaml t2iadapter_sketch_sd14v1.yaml\ncontrol_v11p_sd15_scribble.yaml t2iadapter_sketch_sd15v2.yaml\ncontrol_v11p_sd15_seg.yaml\t t2iadapter_style_sd14v1.yaml\ncontrol_v11p_sd15_softedge.yaml t2iadapter_zoedepth_sd15v1.yaml\n/kaggle/working/stable-diffusion-webui/models/Stable-diffusion\n模型文件列表\n Anything-V4.5.safetensors\t\t orangemix.vae.pt\n'Put Stable Diffusion checkpoints here.txt'\n/kaggle/working/stable-diffusion-webui/models/hypernetworks\nhypernetworks超网络模型文件列表\n/kaggle/working/stable-diffusion-webui/embeddings\nembedding文件列表\n EasyNegative.safetensors 'Place Textual Inversion embeddings here.txt'\n/kaggle/working/stable-diffusion-webui/models/Lora\nlora文件列表\n/kaggle/working/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/wildcards\nwildcards文件列表\n加载耗时: 139.77381896972656 s\nskip start ngrok\n/kaggle/working/stable-diffusion-webui\nError: Command '['/kaggle/working/stable-diffusion-webui/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.\nCOMMANDLINE_ARGS=--disable-safe-unpickle --deepdanbooru --share --skip-torch-cuda-test --xformers --api --listen --lowram --ckpt=\"/kaggle/working/stable-diffusion-webui/models/Stable-diffusion/Anything-V4.5.safetensors\" --no-half-vae --disable-console-progressbars\nenv: REQS_FILE=requirements.txt\nPython 3.10.11 (main, Apr 5 2023, 14:15:10) [GCC 9.4.0]\nCommit hash: 22bcc7be428c94e9408f589966c2040187245d81\nInstalling torch and torchvision\n\n -------------\n\n__/\\\\\\\\\\\\\\\\\\\\\\\\\\____/\\\\\\\\____________/\\\\\\\\____/\\\\\\\\\\\\\\\\\\_____\n _\\/\\\\\\/////////\\\\\\_\\/\\\\\\\\\\\\________/\\\\\\\\\\\\__/\\\\\\///////\\\\\\___\n _\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\//\\\\\\____/\\\\\\//\\\\\\_\\///______\\//\\\\\\__\n _\\/\\\\\\\\\\\\\\\\\\\\\\\\\\/__\\/\\\\\\\\///\\\\\\/\\\\\\/_\\/\\\\\\___________/\\\\\\/___\n _\\/\\\\\\/////////____\\/\\\\\\__\\///\\\\\\/___\\/\\\\\\________/\\\\\\//_____\n _\\/\\\\\\_____________\\/\\\\\\____\\///_____\\/\\\\\\_____/\\\\\\//________\n _\\/\\\\\\_____________\\/\\\\\\_____________\\/\\\\\\___/\\\\\\/___________\n _\\/\\\\\\_____________\\/\\\\\\_____________\\/\\\\\\__/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\_\n _\\///______________\\///______________\\///__\\///////////////__\n\n\n Runtime Edition\n\n PM2 is a Production Process Manager for Node.js applications\n with a built-in Load Balancer.\n\n Start and Daemonize any application:\n $ pm2 start app.js\n\n Load Balance 4 instances of api.js:\n $ pm2 start api.js -i 4\n\n Monitor in production:\n $ pm2 monitor\n\n Make pm2 auto-boot at server restart:\n $ pm2 startup\n\n To go further checkout:\n http://pm2.io/\n\n\n -------------\n\nLooking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117\n\u001b[32m[PM2] \u001b[39mSpawning PM2 daemon with pm2_home=/root/.pm2\n\u001b[32m[PM2] \u001b[39mPM2 Successfully daemonized\n\u001b[1m\u001b[90m[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)\u001b[39m\u001b[22m\n\u001b[90m/root/.pm2/pm2.log last 15 lines:\u001b[39m\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: --- New PM2 Daemon started ----------------------------------------------------\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Time : Sun Apr 16 2023 15:26:49 GMT+0000 (Coordinated Universal Time)\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: PM2 version : 5.3.0\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Node.js version : 18.12.1\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Current arch : x64\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: PM2 home : /root/.pm2\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: PM2 PID file : /root/.pm2/pm2.pid\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: RPC socket file : /root/.pm2/rpc.sock\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: BUS socket file : /root/.pm2/pub.sock\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Application log path : /root/.pm2/logs\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Worker Interval : 30000\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Process dump file : /root/.pm2/dump.pm2\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: Concurrent actions : 2\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: SIGTERM timeout : 1600\n\u001b[34mPM2 | \u001b[39m2023-04-16T15:26:49: PM2 log: ===============================================================================\n\nCollecting torch==1.13.1+cu117\n Downloading https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp310-cp310-linux_x86_64.whl (1801.8 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━��━━━━━━\u001b[0m \u001b[32m1.8/1.8 GB\u001b[0m \u001b[31m572.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m0:01\u001b[0mm\n\u001b[?25hCollecting torchvision==0.14.1+cu117\n Downloading https://download.pytorch.org/whl/cu117/torchvision-0.14.1%2Bcu117-cp310-cp310-linux_x86_64.whl (24.3 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.3/24.3 MB\u001b[0m \u001b[31m58.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[?25hCollecting typing-extensions (from torch==1.13.1+cu117)\n Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)\nCollecting numpy (from torchvision==0.14.1+cu117)\n Downloading numpy-1.24.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.3/17.3 MB\u001b[0m \u001b[31m70.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[?25hCollecting requests (from torchvision==0.14.1+cu117)\n Downloading requests-2.28.2-py3-none-any.whl (62 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.8/62.8 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting pillow!=8.3.*,>=5.3.0 (from torchvision==0.14.1+cu117)\n Downloading Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m83.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n\u001b[?25hCollecting charset-normalizer<4,>=2 (from requests->torchvision==0.14.1+cu117)\n Downloading charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m199.3/199.3 kB\u001b[0m \u001b[31m17.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting idna<4,>=2.5 (from requests->torchvision==0.14.1+cu117)\n Downloading https://download.pytorch.org/whl/idna-3.4-py3-none-any.whl (61 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.5/61.5 kB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting urllib3<1.27,>=1.21.1 (from requests->torchvision==0.14.1+cu117)\n Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m140.9/140.9 kB\u001b[0m \u001b[31m14.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting certifi>=2017.4.17 (from requests->torchvision==0.14.1+cu117)\n Downloading https://download.pytorch.org/whl/certifi-2022.12.7-py3-none-any.whl (155 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m155.3/155.3 kB\u001b[0m \u001b[31m17.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hInstalling collected packages: urllib3, typing-extensions, pillow, numpy, idna, charset-normalizer, certifi, torch, requests, torchvision\nSuccessfully installed certifi-2022.12.7 charset-normalizer-3.1.0 idna-3.4 numpy-1.24.2 pillow-9.5.0 requests-2.28.2 torch-1.13.1+cu117 torchvision-0.14.1+cu117 typing-extensions-4.5.0 urllib3-1.26.15\nInstalling gfpgan\nInstalling clip\nInstalling open_clip\nInstalling xformers\nCloning Stable Diffusion into /kaggle/working/stable-diffusion-webui/repositories/stable-diffusion-stability-ai...\nCloning Taming Transformers into /kaggle/working/stable-diffusion-webui/repositories/taming-transformers...\nCloning K-diffusion into /kaggle/working/stable-diffusion-webui/repositories/k-diffusion...\nCloning CodeFormer into /kaggle/working/stable-diffusion-webui/repositories/CodeFormer...\nCloning BLIP into /kaggle/working/stable-diffusion-webui/repositories/BLIP...\nInstalling requirements for CodeFormer\nInstalling requirements for Web UI\nInstalling requirements for Mov2mov\nInstalling requirements for ffmpeg\nInstalling requirements for imageio-ffmpeg\n\nInstalling sd-webui-controlnet requirement: svglib\nInstalling sd-webui-controlnet requirement: fvcore\n\nInstalling scikit-learn\nInstalling diffusers\n\nLaunching Web UI with arguments: --disable-safe-unpickle --deepdanbooru --share --skip-torch-cuda-test --xformers --api --listen --lowram --ckpt=/kaggle/working/stable-diffusion-webui/models/Stable-diffusion/Anything-V4.5.safetensors --no-half-vae --disable-console-progressbars\nCalculating sha256 for /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/Anything-V4.5.safetensors: a504b5b137246d210c44e3076f3fb65ffe59ed0f1e0178d2a21856663001bd01\nLoading weights [a504b5b137] from /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/Anything-V4.5.safetensors\nCreating model from config: /kaggle/working/stable-diffusion-webui/configs/v1-inference.yaml\nLatentDiffusion: Running in eps-prediction mode\nDiffusionWrapper has 859.52 M params.\nDownloading (…)olve/main/vocab.json: 100%|███| 961k/961k [00:00<00:00, 9.37MB/s]\nDownloading (…)olve/main/merges.txt: 100%|███| 525k/525k [00:00<00:00, 11.5MB/s]\nDownloading (…)cial_tokens_map.json: 100%|██████| 389/389 [00:00<00:00, 492kB/s]\nDownloading (…)okenizer_config.json: 100%|█████| 905/905 [00:00<00:00, 1.17MB/s]\nDownloading (…)lve/main/config.json: 100%|█| 4.52k/4.52k [00:00<00:00, 3.36MB/s]\nLoading VAE weights specified in settings: /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/orangemix.vae.pt\nApplying xformers cross attention optimization.\nTextual inversion embeddings loaded(1): EasyNegative\nModel loaded in 44.3s (calculate hash: 25.9s, load weights from disk: 6.5s, create model: 2.4s, apply weights to model: 3.8s, apply half(): 1.5s, load VAE: 3.5s, move model to device: 0.7s).\nRunning on local URL: http://0.0.0.0:7860\nRunning on public URL: https://59ddb150453eabf124.gradio.live\n\nThis share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces\nStartup time: 54.0s (import torch: 1.2s, import gradio: 1.0s, import ldm: 0.5s, other imports: 1.3s, setup codeformer: 0.1s, load scripts: 1.9s, load SD checkpoint: 44.3s, create ui: 1.0s, gradio launch: 2.5s).\n","output_type":"stream"}]},{"cell_type":"markdown","source":"### 交流群 632428790 (遇到问题可以找群主或者管理员解决)","metadata":{}},{"cell_type":"code","source":"#自动保存\nautosave()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 如需保存图片文件或者训练文件,点击页面顶端的Cancel Run,将输出目录的tar解压包下载即可","metadata":{}}]}
|