Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix txt2img save bugs, enable upload of training images, allow google drive download of models #27

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

.DS_Store
gen.bat
gen_ref.bat
train.bat
__pycache__
*/**/__pycache__
logs
logs
.ipynb_checkpoints
139 changes: 73 additions & 66 deletions dreambooth_colab_joepenna.ipynb
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#@title Load repo (if needed)\n",
"!git clone https://github.com/JoePenna/Dreambooth-Stable-Diffusion\n",
"%cd Dreambooth-Stable-Diffusion"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -65,31 +50,36 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#@title # Required - Navigate back to the directory.\n",
"%cd Dreambooth-Stable-Diffusion"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"id": "6tjx0HcjesFo"
},
"outputs": [],
"source": [
"#@markdown Hugging Face Login\n",
"from huggingface_hub import notebook_login\n",
"\n",
"notebook_login()"
],
"metadata": {
"id": "6tjx0HcjesFo"
},
"execution_count": 1,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "O15vMMhCevib"
},
"outputs": [],
"source": [
"#@markdown Download the 1.4 sd model\n",
"from IPython.display import clear_output\n",
Expand All @@ -106,15 +96,15 @@
"!mv {actual_locations_of_model_blob[-1]} model.ckpt\n",
"clear_output()\n",
"print(\"✅ model.ckpt successfully downloaded\")\n"
],
"metadata": {
"id": "O15vMMhCevib"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "N96aedTtfBjO"
},
"outputs": [],
"source": [
"#@title # Download Regularization Images\n",
"#@markdown We’ve created the following image sets\n",
Expand All @@ -129,15 +119,15 @@
"\n",
"!mkdir -p regularization_images/{dataset}\n",
"!mv -v Stable-Diffusion-Regularization-Images-{dataset}/{dataset}/*.* regularization_images/{dataset}"
],
"metadata": {
"id": "N96aedTtfBjO"
},
"execution_count": 2,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "A7hmdOdOfGzs"
},
"outputs": [],
"source": [
"#@title # Training Images\n",
"#@markdown ## Upload your training images\n",
Expand Down Expand Up @@ -166,15 +156,15 @@
" print(\"❌ no training images found. Please upload images to training_images\")\n",
"else:\n",
" print(\"✅ \" + str(len(training_images_file_paths)) + \" training images found\")\n"
],
"metadata": {
"id": "A7hmdOdOfGzs"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "m2o_fFFvfxHi"
},
"outputs": [],
"source": [
"#@title # Training\n",
"\n",
Expand Down Expand Up @@ -205,15 +195,15 @@
" --class_word \"{class_word}\" \\\n",
" --token \"{token}\" \\\n",
" --no-test"
],
"metadata": {
"id": "m2o_fFFvfxHi"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Ll_ZIFNUulKJ"
},
"outputs": [],
"source": [
"#@title # Copy and name the checkpoint file\n",
"\n",
Expand All @@ -229,27 +219,44 @@
"!mv \"{last_checkpoint_file}\" \"trained_models/{file_name}\"\n",
"\n",
"print(\"Download your trained model file from trained_models/\" + file_name + \" and use in your favorite Stable Diffusion repo!\")"
],
"metadata": {
"id": "Ll_ZIFNUulKJ"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "mkidEm4evn1J"
},
"outputs": [],
"source": [
"#@title Save model in google drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')\n",
"\n",
"!cp trained_models/{file_name} /content/drive/MyDrive/{file_name}"
],
"metadata": {
"id": "mkidEm4evn1J"
},
"execution_count": null,
"outputs": []
]
}
]
],
"metadata": {
"colab": {
"collapsed_sections": [],
"provenance": []
},
"kernelspec": {
"display_name": "Python 3.9.0 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.9.0"
},
"vscode": {
"interpreter": {
"hash": "0f8486a44be3db540a44064ef4647f290d210aa4269e54f181de788486e3e134"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading