remove ngrok block

This commit is contained in:
Cyberes 2022-10-04 10:57:09 -06:00 committed by GitHub
parent 27ba0c85a7
commit b8dfc54f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 37 deletions

View File

@ -7,7 +7,7 @@
"tags": []
},
"source": [
"# Voldemort's Stable Diffusion WebUI\n",
"# AUTOMATIC1111's Stable Diffusion WebUI\n",
"\n",
"Adapted from: https://colab.research.google.com/drive/1Iy-xW9t1-OQWhb0hNxueGij8phCyluOh\n",
"\n",
@ -48,7 +48,7 @@
"\n",
"`/notebooks/` is storage for this notebook only.\n",
"\n",
"`/tmp/` is not a persistent directory, meaning your files there will be deleted when the machine turns off.\n",
"<mark style=\"background-color:lime\">`/tmp/` is not a persistent directory, meaning your files there will be deleted when the machine turns off.</mark>\n",
"\n",
"<br>\n",
"\n",
@ -103,6 +103,7 @@
"source": [
"import os\n",
"%store -r free_tier model_storage_dir repo_storage_dir\n",
"%cd /notebooks/\n",
"\n",
"def delete_broken_symlinks(path):\n",
" # make sure to pass this function a path without a trailing slash\n",
@ -115,12 +116,9 @@
"if not os.path.exists(f'{repo_storage_dir}/stable-diffusion-webui'):\n",
" if free_tier:\n",
" delete_broken_symlinks('/notebooks/') # remove broken symlinks since it might have been installed in a non-persistent directory\n",
" if not os.path.exists(repo_storage_dir) and '/notebooks/' not in repo_storage_dir:\n",
" # symlink repo_storage_dir back to /notebooks/ only if it hasn't been downloaded to /notebooks/\n",
" if not os.path.exists(repo_storage_dir):\n",
" !mkdir -p \"{repo_storage_dir}\"\n",
" !ln -s \"{repo_storage_dir}\" /notebooks/\n",
" else:\n",
" print('Not symlinking repo_storage_dir back to /notebooks/')\n",
" %cd \"{repo_storage_dir}\"\n",
" !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
"else: # update repo if already exists\n",
@ -156,14 +154,15 @@
"# They require a few specific external git repo commits so we have to do it their way. \n",
"import launch\n",
"\n",
"# latent-diffusion is a requirement but launch.py isn't downloading it so we'll do it manually\n",
"if not os.path.exists(f'{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion'): # check that it hasn't been downloaded in case they fix this issue\n",
"# latent-diffusion is a requirement but launch.py isn't downloading it so we'll do it manually.\n",
"if not os.path.exists(f'{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion'):\n",
" !git clone https://github.com/crowsonkb/k-diffusion.git \"{repo_storage_dir}/stable-diffusion-webui/repositories/k-diffusion\"\n",
" !git clone https://github.com/Hafiidz/latent-diffusion.git \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion\"\n",
" # I don't think it's necessary to do this:\n",
" # %mkdir \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/\"\n",
" # %mkdir \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/pretrained_models\"\n",
" # !wget https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1 -O \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/pretrained_models/project.yaml\"\n",
" # !wget https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1 -O \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/pretrained_models/model.ckpt\"\n",
" # !wget https://raw.githubusercontent.com/Engineer-of-Stuff/stable-diffusion-paperspace/main/lfs/latent-diffusion/project.yaml -O \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/pretrained_models/project.yaml\"\n",
" # !wget https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/main/lfs/latent-diffusion/model.ckpt?raw=true -O \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion/experiments/pretrained_models/model.ckpt\"\n",
"\n",
"# Download the GFPGAN face restorer.\n",
"if not os.path.exists(f'{repo_storage_dir}/stable-diffusion-webui/GFPGANv1.3.pth'):\n",
@ -474,11 +473,8 @@
"outputs": [],
"source": [
"%store -r free_tier model_storage_dir repo_storage_dir\n",
"\n",
"!echo -e \"You are using $(du -sh /notebooks/ | cut -f1) in /notebooks/\\n\"\n",
"\n",
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
"!python webui.py --share # --gradio-auth me:password1234"
"!python webui.py --gradio-debug --share # --gradio-auth me:password1234"
]
},
{
@ -635,29 +631,6 @@
"# !rm -rf {model_storage_dir}\n",
"# !rm -rf {repo_storage_dir}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ngrok Proxy\n",
"\n",
"There's an issue with Gradio's infrastructure where you can't load an image larger than 2MB. We can get around this by running our own proxy with ngrok. Here's how to do it:\n",
"\n",
"1. Add `--port 7860` to the `!python ... webui.py` line in the Launch WebUI section above.\n",
"2. Launch the WebUI.\n",
"3. Go to [ngrok.com](https://ngrok.com/) in a new tab and sign up. Don't close that tab yet.\n",
"4. Open the terminal by clicking on the terminal button in the left sidebar menu. If you're not sure which one that is, hover over the items and a little tooltip will appear.\n",
"5. Run this in the terminal. Make sure to replace `<your authtoken>` with your auth token.\n",
"\n",
"```bash\n",
"pip install pyngrok\n",
"ngrok authtoken <your authtoken>\n",
"ngrok http 7860\n",
"```\n",
"\n",
"ngrok will assign you a subdomain and display a link to it. That's the link to your WebUI instance. If you want, create a new file named `start-ngrok.sh` and copy those lines into it so you can quickly connect."
]
}
],
"metadata": {