Created using Colaboratory

This commit is contained in:
nawnie 2023-03-09 03:37:17 -06:00
parent 2531c7bd35
commit 431e1402d3
1 changed files with 47 additions and 21 deletions

View File

@ -82,7 +82,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "hAuBbtSvGpau"
"id": "hAuBbtSvGpau",
"cellView": "form"
},
"outputs": [],
"source": [
@ -96,7 +97,6 @@
"!pip install -q diffusers[torch]==0.13.0\n",
"!pip install -q pynvml==11.4.1\n",
"!pip install -q bitsandbytes==0.35.0\n",
"!pip install -q lion \n",
"!pip install -q ftfy==6.1.1\n",
"!pip install -q aiohttp==3.8.3\n",
"!pip install -q tensorboard>=2.11.0\n",
@ -135,23 +135,39 @@
"from IPython.display import clear_output\n",
"!mkdir input\n",
"%cd /content/EveryDream2trainer\n",
"MODEL_URL = \"https://huggingface.co/panopstor/EveryDream/resolve/main/sd_v1-5_vae.ckpt\" #@param [\"https://huggingface.co/panopstor/EveryDream/resolve/main/sd_v1-5_vae.ckpt\", \"https://huggingface.co/hakurei/waifu-diffusion-v1-3/resolve/main/wd-v1-3-float16.ckpt\", \"stabilityai/stable-diffusion-2-1-base\", \"stabilityai/stable-diffusion-2-1\"] {allow-input: true}\n",
"print(\"Downloading \")\n",
"!wget $MODEL_URL\n",
"MODEL_URL = \"sd_v1-5+vae.ckpt\" #@param [\"sd_v1-5+vae.ckpt\", \"hakurei/waifu-diffusion-v1-3\", \"stabilityai/stable-diffusion-2-1-base\", \"stabilityai/stable-diffusion-2-1\"] {allow-input: true}\n",
"if MODEL_URL == \"sd_v1-5+vae.ckpt\":\n",
" MODEL_URL = \"panopstor/EveryDream\"\n",
"\n",
"if \".co\" in MODEL_URL or \"https\" in MODEL_URL or \"www\" in MODEL_URL: #maybe just add a radio button to download this should work for now\n",
" print(\"Downloading \")\n",
" !wget $MODEL_URL\n",
" clear_output()\n",
" print(\"DONE!\")\n",
"else:\n",
" save_name = MODEL_URL\n",
" print(\"using diffusers from \" + save_name + \" a download will start when training begins!\")\n",
"\n",
"%cd /content/EveryDream2trainer\n",
"\n",
"clear_output()\n",
"print(\"DONE!\")"
"#@markdown * if you chose to link to diffusers Proceed to the [Run EveryDream 2](#scrollTo=j9pEI69WXS9w&line=2&uniqifier=1) cell\n"
]
},
{
"cell_type": "markdown",
"source": [
"# Optional, If you downloaded a Ckpt expand this to convert your model to diffusers, if you linked to diffusers this can be skipped!"
],
"metadata": {
"id": "jSOXhd3GXqWM"
}
},
{
"cell_type": "markdown",
"metadata": {
"id": "nEzuEYH0536C"
},
"source": [
"In order to train, you need a base model on which to train. This is a one-time setup to configure base models when you want to use a particular base. \n"
"In order to train, we need to convert a .ckpt into diffusers, if you linked to diffuers above or plan to chose to resume from a previous model you may skip this step."
]
},
{
@ -164,7 +180,7 @@
"outputs": [],
"source": [
"import os\n",
"#@title Setup conversion\n",
"#@title Setup conversion - Skip if you linked diffusers\n",
"\n",
"#@markdown **If you already did this once with Gdrive connected, you can skip this step as the cached copy is on your gdrive.** \n",
"# \n",
@ -230,9 +246,11 @@
"source": [
"#@title Pick your base model from a diffusers model saved to your Gdrive (converted above)\n",
"\n",
"#@markdown Do not skip this cell.\n",
"#@markdown Do not skip this cell before reading.\n",
"\n",
"#@markdown * If you have preveiously saved diffusers on your drive you can select it here\n",
"#@markdown * If you have preveiously saved diffusers on your drive, or needed to convert a ckpt you can select the diffuser path here\n",
"\n",
"#@markdown * If you chose to link to diffusers from hugging face you can skip this cell\n",
"\n",
"#@markdown ex. */content/drive/MyDrive/everydreamlogs/myproject_202208/ckpts/interrupted-gs023*\n",
"\n",
@ -243,15 +261,16 @@
},
{
"cell_type": "markdown",
"metadata": {
"id": "JXVu-W2lCjwX"
},
"source": [
"# Training\n",
"\n",
"For a more indepth Explanation of each of these paramaters check out /content/EveryDream2trainer/doc.\n",
"\n",
"\n",
"After youve tried a few models you will find /content/EveryDream2trainer/doc/ATWEAKING.md to be extremly helpful."
]
],
"metadata": {
"id": "EHyFzKWXX9kB"
}
},
{
"cell_type": "code",
@ -262,13 +281,16 @@
},
"outputs": [],
"source": [
"#@title \n",
"from google.colab import runtime\n",
"import time\n",
"#@title #Run Everydream 2\n",
"%cd /content/EveryDream2trainer\n",
"#@markdown # Run Everydream 2\n",
"#@markdown If you want to use a .json config or upload your own, skip this cell and run the cell below instead\n",
"\n",
"#@markdown * Save logs and output ckpts to Gdrive (strongly suggested)\n",
"Save_to_Gdrive = True #@param{type:\"boolean\"}\n",
"#@markdown * Disconnect after training to save Credits \n",
"Disconnect_after_training = False #@param{type:\"boolean\"}\n",
"#@markdown * Use resume to contnue training you just ran, will also find latest diffusers log in your Gdrive to continue.\n",
"resume = False #@param{type:\"boolean\"}\n",
"#@markdown * Name your project so you can find it in your logs\n",
@ -420,8 +442,12 @@
" --sample_steps $Steps_between_samples \\\n",
" --save_every_n_epoch $Save_every_N_epoch \\\n",
" --seed $Training_Seed \\\n",
" --zero_frequency_noise_ratio $zero_frequency_noise\n",
"\n"
" --zero_frequency_noise_ratio $zero_frequency_noise \\\n",
" --notebook\n",
"\n",
"if Disconnect_after_training :\n",
" time.sleep(3)\n",
" runtime.unassign()"
]
},
{