Add files via upload

Former-commit-id: 4ad2c1541a
This commit is contained in:
Cyberes 2022-09-18 00:25:08 -06:00 committed by GitHub
parent 0965f9dfbe
commit b44e14c7c7
1 changed files with 46 additions and 92 deletions

View File

@ -43,7 +43,7 @@
"\n",
"`/notebooks/` is storage for this notebook only.\n",
"\n",
"We're going to store models in `/storage/models`.\n",
"We're going to store models in `/storage/models` and create a symlink.\n",
"\n",
"_You must run the block below or else the variable won't be accessable in the notebook._"
]
@ -59,8 +59,7 @@
"# ===============================================================\n",
"# Save the variable to Jupiter's temp storage to access it when the kernel restarts.\n",
"# To reset your storage directory, rerun this cell.\n",
"%store model_storage_dir\n",
"!mkdir -p $model_storage_dir"
"%store model_storage_dir"
]
},
{
@ -254,7 +253,6 @@
{
"cell_type": "markdown",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@ -270,23 +268,6 @@
"The 60000 steps version is the original, the 115000 steps is the 60000 with additional training. Use the 60000 step version if the style nudging is too much."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**115000**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r model_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step115000.ckpt -O $model_storage_dir/trinart2_step115000.ckpt"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -304,23 +285,11 @@
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step60000.ckpt -O $model_storage_dir/trinart2_step60000.ckpt"
]
},
{
"cell_type": "markdown",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"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"
"**95000**"
]
},
{
@ -329,15 +298,25 @@
"metadata": {},
"outputs": [],
"source": [
"mounted_dataset_path = '/datasets/<name>'\n",
"\n",
"# ============================================================\n",
"%store -r model_storage_dir\n",
"import os\n",
"for file in os.listdir(mounted_dataset_path):\n",
" if file.endswith(\"ckpt\"):\n",
" !ln -s $mounted_dataset_path/$file $model_storage_dir/$file\n",
" !ls -la --block-size=GB $model_storage_dir/$file"
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step95000.ckpt -O $model_storage_dir/trinart2_step95000.ckpt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**115000**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r model_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step115000.ckpt -O $model_storage_dir/trinart2_step115000.ckpt"
]
},
{
@ -368,6 +347,29 @@
"os.kill(os.getpid(), 9)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Link the models directory\n",
"\n",
"If it says `failed to create symbolic link: File exists` that's fine. It means you've already ran this block."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r model_storage_dir\n",
"import os\n",
"for file in os.listdir(model_storage_dir):\n",
" if file.endswith(\"ckpt\"):\n",
" !ln -s $model_storage_dir/$file /notebooks/stable-diffusion-webui/models/$file\n",
" !ls -la --block-size=GB /notebooks/stable-diffusion-webui/models/$file"
]
},
{
"cell_type": "markdown",
"metadata": {
@ -381,39 +383,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"First, enter the name of the model you want to use into `model_name` in the cell below.\n",
"\n",
"Then run the model. You will get a link to nnn.gradio.app, that's your WebUI. Follow it.\n",
"Run this block to launch the WebUI. You will get a link to nnn.gradio.app, that's your WebUI. Follow it.\n",
"\n",
"If you have any issues, restart the kernel."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Choose your Model**\n",
"\n",
"|Name||\n",
"|-|-|\n",
"|`sd-v1-4.ckpt`|Standard diffusion v1.4|\n",
"|`wd-v1-2-full-ema.ckpt`|waifu-diffusion v1.2|\n",
"|`wd-v1-2-full-ema-pruned.ckpt`|waifu-diffusion v1.2 half-size|\n",
"|`trinart2_step115000.ckpt`|trinart2 v2 11500 steps|\n",
"|`trinart2_step60000.ckpt`|trinart2 v2 60000 steps|\n",
"\n",
"Enter the name of the model you want to use in `model_name` below.\n",
"\n",
"To change models you must restart the kernel for it to take effect."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Start the WebUI**"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -423,28 +397,8 @@
},
"outputs": [],
"source": [
"model_name = ''\n",
"\n",
"# ===============================================================================================================\n",
"# Don't change anything in here\n",
"%store -r model_storage_dir\n",
"model_file = f'{model_storage_dir}/{model_name}'\n",
"\n",
"import sys\n",
"import os\n",
"\n",
"if not os.path.exists(model_file):\n",
" print('Cannot find model file:', model_file)\n",
" sys.exit(1)\n",
"\n",
"if model_name == '':\n",
" print('You forgot to fill out the variable model_name above.')\n",
" sys.exit(1)\n",
"\n",
"# ===============================================================================================================\n",
" \n",
"# You can modify the args if nessesary\n",
"!python /notebooks/stable-diffusion-webui/webui.py --share --ckpt $model_file # --opt-split-attention"
"!python /notebooks/stable-diffusion-webui/webui.py --share # --opt-split-attention"
]
},
{