wd torrent dl, enhancements
This commit is contained in:
parent
5c33a3e99f
commit
7aa0acefb4
|
@ -54,6 +54,7 @@
|
|||
"import os.path\n",
|
||||
"\n",
|
||||
"if not os.path.exists('/notebooks/stable-diffusion-webui'):\n",
|
||||
" %cd /notebooks/\n",
|
||||
" !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
|
||||
"else: # update repo if already exists\n",
|
||||
" print('stable-diffusion-webui already downloaded, updating')\n",
|
||||
|
@ -105,20 +106,11 @@
|
|||
" print('GFPGANv1.3.pth already downloaded')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# import os\n",
|
||||
"# os.kill(os.getpid(), 9) # This will crash Colab (required, everything will still be intact so dont worry)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "F0EINk5M0s-w"
|
||||
"id": "F0EINk5M0s-w",
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"### Download the model"
|
||||
|
@ -128,7 +120,9 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Pick only one!**"
|
||||
"**Pick only one!**\n",
|
||||
"\n",
|
||||
"You don't need to repeat this step if you've already downloaded the model."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -166,11 +160,8 @@
|
|||
"\n",
|
||||
"# ===============================================================================================\n",
|
||||
"\n",
|
||||
"if not os.path.exists('/notebooks/stable-diffusion/models/ldm/stable-diffusion-v1/model.ckpt'):\n",
|
||||
" user_header = f\"'Authorization: Bearer {user_token}'\"\n",
|
||||
" !wget --header={user_header} https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt -O /notebooks/stable-diffusion-webui/model.ckpt\n",
|
||||
"else:\n",
|
||||
" print('Standard model already downloaded')"
|
||||
"user_header = f\"'Authorization: Bearer {user_token}'\"\n",
|
||||
"!wget --header={user_header} https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt -O /notebooks/stable-diffusion-webui/model.ckpt"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -185,9 +176,13 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"**HTTPS**"
|
||||
"**Web Download**\n",
|
||||
"\n",
|
||||
"Very slow"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -196,17 +191,46 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"if not os.path.exists('/notebooks/stable-diffusion-webui/model.ckpt'):\n",
|
||||
" !wget https://thisanimedoesnotexist.ai/downloads/wd-v1-2-full-ema.ckpt -O /notebooks/stable-diffusion-webui/model.ckpt\n",
|
||||
"else:\n",
|
||||
" print('Waifu Diffusion model already downloaded')"
|
||||
"!wget https://thisanimedoesnotexist.ai/downloads/wd-v1-2-full-ema.ckpt -O /notebooks/stable-diffusion-webui/model.ckpt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Gradient Dataset**"
|
||||
"**Torrent**\n",
|
||||
"\n",
|
||||
"Very fast."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!apt update\n",
|
||||
"!apt install -y aria2\n",
|
||||
"%cd /notebooks/stable-diffusion-webui\n",
|
||||
"!aria2c --seed-time=0 --max-overall-upload-limit=1K \"magnet:?xt=urn:btih:F45CECF4E9DE86DA83A78DD2CCCD7F27D5557A52&tr=udp://nyquist.localghost.org:6969\"\n",
|
||||
"!mv /notebooks/stable-diffusion-webui/wd-v1-2-full-ema.ckpt /notebooks/stable-diffusion-webui/model.ckpt\n",
|
||||
"!rm /notebooks/stable-diffusion-webui/wd-v1-2-full-ema.ckpt.aria2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Gradient Dataset Import**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Paperspace provides a way to mount external storage to notebooks, called *Datasets*. This is an advanced method but it will save you many GB since you can reuse the same model file across different notebooks.\n",
|
||||
"\n",
|
||||
"https://docs.paperspace.com/gradient/cli/datasets"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -216,7 +240,32 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"mounted_dataset_path = '/datasets/<name>'\n",
|
||||
"!rsync -ah --info=progress2 $mounted_dataset_path/wd-v1-2-full-ema.ckpt /notebooks/stable-diffusion-webui/model.ckpt"
|
||||
"\n",
|
||||
"# ============================================================\n",
|
||||
"\n",
|
||||
"!ln -s $mounted_dataset_path/wd-v1-2-full-ema.ckpt /notebooks/stable-diffusion-webui/model.ckpt\n",
|
||||
"\n",
|
||||
"!ls -la --block-size=GB /notebooks/stable-diffusion-webui/model.ckpt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"#### Delete local model\n",
|
||||
"If you want to change models."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!rm /notebooks/stable-diffusion-webui/model.ckpt"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -239,7 +288,9 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "R-xAdMA5wxXd"
|
||||
"id": "R-xAdMA5wxXd",
|
||||
"scrolled": true,
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -261,6 +312,33 @@
|
|||
"\n",
|
||||
"demo.launch(share=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Kill the WebUI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The WebUI process disconnects from the notebook so it must be killed manually."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"scrolled": true,
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"os.kill(os.getpid(), 9)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
Loading…
Reference in New Issue