Better handling of undefined settings, add SDv2.0 download blocks, SDv2.0 upscale test
This commit is contained in:
parent
391c01b60b
commit
7414a1848c
|
@ -113,21 +113,10 @@
|
|||
" # If you don't set a password, anyone can install and run arbitrary code on your machine!\n",
|
||||
" # Instead, use gradio_auth which will automatically enable extensions when set.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# ===================================================================================================\n",
|
||||
"# Save variables to Jupiter's temp storage so we can access it even if the kernel restarts.\n",
|
||||
"%store symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae download_scripts activate_deepdanbooru activate_medvram disable_pickle_check gradio_port gradio_auth search_paperspace_datasets ui_theme insecure_extension_access\n",
|
||||
"\n",
|
||||
"# A little function to alert you when you haven't run the first block\n",
|
||||
"def YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS():\n",
|
||||
" try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
" except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print(e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
" del test"
|
||||
"%store symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae download_scripts activate_deepdanbooru activate_medvram disable_pickle_check gradio_port gradio_auth search_paperspace_datasets ui_theme insecure_extension_access"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -159,6 +148,15 @@
|
|||
"source": [
|
||||
"import os\n",
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"%cd /notebooks/\n",
|
||||
"\n",
|
||||
"def delete_broken_symlinks(path):\n",
|
||||
|
@ -208,7 +206,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers download_scripts activate_deepdanbooru\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
|
||||
"\n",
|
||||
|
@ -288,7 +293,7 @@
|
|||
" !cp -r \"{repo_storage_dir}/stable-diffusion-webui/txt2mask/scripts/\" \"{repo_storage_dir}/stable-diffusion-webui/\"\n",
|
||||
"\n",
|
||||
" # Install the dynamic-prompts/wildcard script\n",
|
||||
" !git clone https://github.com/adieyal/sd-dynamic-prompting/ extensions/dynamic-prompts\n",
|
||||
" # !git clone https://github.com/adieyal/sd-dynamic-prompting/ extensions/dynamic-prompts\n",
|
||||
"\n",
|
||||
"if activate_xformers:\n",
|
||||
" print('Installing xformers...')\n",
|
||||
|
@ -404,9 +409,17 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-2/resolve/main/768-v-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-768-v-ema.ckpt\""
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-2/resolve/main/768-v-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-768-v-ema.ckpt\"\n",
|
||||
"!wget https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml -O \"{model_storage_dir}/sd-v2-0-768-v-ema.yaml\""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -425,9 +438,17 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-2-base/resolve/main/512-base-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-512-base-ema.ckpt\""
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-2-base/resolve/main/512-base-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-512-base-ema.ckpt\"\n",
|
||||
"!wget https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml -O \"{model_storage_dir}/sd-v2-0-512-base-ema.yaml\""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -444,7 +465,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-2-depth/resolve/main/512-depth-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-512-depth-ema.ckpt\""
|
||||
]
|
||||
|
@ -463,7 +491,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler/resolve/main/x4-upscaler-ema.ckpt -O \"{model_storage_dir}/sd-v2-0-x4-upscaler-ema.ckpt\""
|
||||
]
|
||||
|
@ -495,7 +530,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -518,7 +560,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -542,7 +591,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -573,7 +629,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -595,7 +658,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -637,7 +707,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step60000.ckpt -O \"{model_storage_dir}/trinart2_step60000.ckpt\""
|
||||
]
|
||||
|
@ -656,7 +733,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step95000.ckpt -O \"{model_storage_dir}/trinart2_step95000.ckpt\""
|
||||
]
|
||||
|
@ -675,7 +759,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step115000.ckpt -O \"{model_storage_dir}/trinart2_step115000.ckpt\""
|
||||
]
|
||||
|
@ -696,7 +787,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!wget https://huggingface.co/naclbit/trinart_characters_19.2m_stable_diffusion_v1/resolve/main/trinart_characters_it4_v1.ckpt -O \"{model_storage_dir}/trinart_characters_it4_v1.ckpt\""
|
||||
]
|
||||
|
@ -722,7 +820,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -753,7 +858,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -786,7 +898,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
|
@ -822,7 +941,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"# Get some storage back\n",
|
||||
"!pip cache purge\n",
|
||||
|
@ -852,7 +978,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r model_storage_dir repo_storage_dir link_novelai_anime_vae search_paperspace_datasets\n",
|
||||
"# YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"import os\n",
|
||||
"import glob\n",
|
||||
|
@ -993,7 +1126,14 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r model_storage_dir repo_storage_dir activate_xformers activate_deepdanbooru activate_medvram disable_pickle_check gradio_port gradio_auth ui_theme insecure_extension_access\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"try:\n",
|
||||
" test = [symlink_to_notebooks, model_storage_dir, repo_storage_dir, activate_xformers, link_novelai_anime_vae, download_scripts, activate_deepdanbooru, activate_medvram, disable_pickle_check, gradio_port, gradio_auth, search_paperspace_datasets, ui_theme]\n",
|
||||
"except NameError as e:\n",
|
||||
" print(\"There is an issue with your variables.\")\n",
|
||||
" print(\"Please go back to the first block and make sure your settings are correct, then run the cell.\")\n",
|
||||
" print('Error:', e)\n",
|
||||
" import sys\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
|
||||
"\n",
|
||||
|
@ -1038,6 +1178,8 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"\n",
|
||||
"!apt update\n",
|
||||
"!apt install -y p7zip-full\n",
|
||||
"from datetime import datetime\n",
|
||||
|
@ -1140,7 +1282,9 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
|
||||
"%store -r repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"\n",
|
||||
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
|
||||
"!git reset --hard <commit>"
|
||||
]
|
||||
|
@ -1181,7 +1325,8 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Uncomment the lines below to run this block. You can highlight the lines and do ctrl + /\n",
|
||||
"# %store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
|
||||
"# %store -r model_storage_dir repo_storage_dir\n",
|
||||
"# YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"# !rm -rf /storage/*\n",
|
||||
"# !mv /notebooks/*.ipynb / # move the notebook out of the directory before we nuke it\n",
|
||||
"# !rm -rf /notebooks/*\n",
|
||||
|
@ -1234,7 +1379,9 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
|
||||
"%store -r model_storage_dir repo_storage_dir\n",
|
||||
"YOU_DIDNT_RUN_THE_FIRST_BLOCK_WHERE_YOU_DEFINE_YOUR_SETTINGS()\n",
|
||||
"\n",
|
||||
"model_uri = input('URI of model to download: ')\n",
|
||||
"import re\n",
|
||||
"import requests\n",
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2a447d3d-e1d6-413c-89ac-d29bb74b0ab2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# !pip install --force-reinstall git+https://github.com/huggingface/diffusers.git\n",
|
||||
"\n",
|
||||
"# load model and scheduler\n",
|
||||
"from diffusers import StableDiffusionUpscalePipeline, DPMSolverMultistepScheduler\n",
|
||||
"import torch\n",
|
||||
"pipeline = StableDiffusionUpscalePipeline.from_pretrained(\"stabilityai/stable-diffusion-x4-upscaler\", revision=\"fp16\", torch_dtype=torch.float16)\n",
|
||||
"pipeline.to(\"cuda\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b1282338-bee8-485d-8d05-0185d4d367c8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"source_img = '/notebooks/test.png'\n",
|
||||
"prompt = 'an image'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a4e125e1-dad0-48b3-b535-117a47858ab7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from PIL import Image\n",
|
||||
"\n",
|
||||
"low_res_img = Image.open(source_img).convert(\"RGB\")\n",
|
||||
"upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0]\n",
|
||||
"upscaled_image.save(\"upsampled.png\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "3199cd6a-108a-422f-a4cc-f384f9f55bb1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"from PIL import Image\n",
|
||||
"from io import BytesIO\n",
|
||||
"from diffusers import StableDiffusionUpscalePipeline\n",
|
||||
"import torch\n",
|
||||
"\n",
|
||||
"# load model and scheduler\n",
|
||||
"model_id = \"stabilityai/stable-diffusion-x4-upscaler\"\n",
|
||||
"pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, revision=\"fp16\", torch_dtype=torch.float16)\n",
|
||||
"pipeline = pipeline.to(\"cuda\")\n",
|
||||
"\n",
|
||||
"# let's download an image\n",
|
||||
"url = \"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png\"\n",
|
||||
"response = requests.get(url)\n",
|
||||
"low_res_img = Image.open(BytesIO(response.content)).convert(\"RGB\")\n",
|
||||
"low_res_img = low_res_img.resize((128, 128))\n",
|
||||
"prompt = \"a white cat\"\n",
|
||||
"upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0]\n",
|
||||
"upscaled_image.save(\"upsampled_cat.png\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "4cd5c9ea-367a-48ab-aed1-73854ca42848",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"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.9.13"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
Loading…
Reference in New Issue