From 3760db64d8e182499e139c3132aad17602fcb6cf Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Wed, 24 Apr 2024 16:49:29 -0400 Subject: [PATCH 1/3] Add --host and --port args to invoke-train-ui. --- src/invoke_training/scripts/invoke_train_ui.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/invoke_training/scripts/invoke_train_ui.py b/src/invoke_training/scripts/invoke_train_ui.py index 9cf02432..b53ff66b 100644 --- a/src/invoke_training/scripts/invoke_train_ui.py +++ b/src/invoke_training/scripts/invoke_train_ui.py @@ -1,11 +1,26 @@ +import argparse + import uvicorn from invoke_training.ui.app import build_app def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--host", + default="127.0.0.1", + help="The server host. Set `--host 0.0.0.0` to make the app available on your network.", + ) + parser.add_argument("--port", default=8000, type=int, help="The server port.") + args = parser.parse_args() + app = build_app() - uvicorn.run(app) + uvicorn.run( + app, + host=args.host, + port=args.port, + ) if __name__ == "__main__": From 1cbde1490ed078e25a7ad3db48fafed5aaacac2d Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Wed, 24 Apr 2024 16:53:08 -0400 Subject: [PATCH 2/3] Update invoke-train-ui docs with --host and --port args. --- README.md | 26 +++++++++++++++----------- docs/get-started/quick-start.md | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8f55e3c0..eada86f2 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ A library for training custom Stable Diffusion models (fine-tuning, LoRA training, textual inversion, etc.) that can be used in [InvokeAI](https://github.com/invoke-ai/InvokeAI). -> [!WARNING] -> `invoke-training` is still under active development, and breaking changes are likely. Full backwards compatibility will not be guranteed until v1.0.0. +> [!WARNING] > `invoke-training` is still under active development, and breaking changes are likely. Full backwards compatibility will not be guranteed until v1.0.0. > In the meantime, I recommend pinning to a specific commit hash. ## Documentation @@ -13,14 +12,14 @@ https://invoke-ai.github.io/invoke-training/ ## Training Modes - Stable Diffusion - - LoRA - - DreamBooth LoRA - - Textual Inversion + - LoRA + - DreamBooth LoRA + - Textual Inversion - Stable Diffusion XL - - LoRA - - DreamBooth LoRA - - Textual Inversion - - LoRA and Textual Inversion + - LoRA + - DreamBooth LoRA + - Textual Inversion + - LoRA and Textual Inversion More training modes coming soon! @@ -43,6 +42,7 @@ pip install -e ".[test]" --extra-index-url https://download.pytorch.org/whl/cu12 ### CLI Run training via the CLI with type-checked YAML configuration files for maximum control: + ```bash invoke-train --cfg-file src/invoke_training/sample_configs/sdxl_textual_inversion_gnome_1x24gb.yaml ``` @@ -50,20 +50,24 @@ invoke-train --cfg-file src/invoke_training/sample_configs/sdxl_textual_inversio ### GUI Run training via the GUI for a simpler starting point. + ```bash invoke-train-ui + +# Or, you can optionally override the default host and port: +invoke-train-ui --host 0.0.0.0 --port 1234 ``` ## Features Training progress can be monitored with [Tensorboard](https://www.tensorflow.org/tensorboard): ![Screenshot of the Tensorboard UI showing validation images.](docs/images/tensorboard_val_images_screenshot.png) -*Validation images in the Tensorboard UI.* +_Validation images in the Tensorboard UI._ All trained models are compatible with InvokeAI: ![Screenshot of the InvokeAI UI with an example of a Yoda pokemon generated using a Pokemon LoRA model.](docs/images/invokeai_yoda_pokemon_lora.png) -*Example image generated with the prompt "A cute yoda pokemon creature." and a trained Pokemon LoRA.* +_Example image generated with the prompt "A cute yoda pokemon creature." and a trained Pokemon LoRA._ ## Contributing diff --git a/docs/get-started/quick-start.md b/docs/get-started/quick-start.md index c2366d5a..64a36c00 100644 --- a/docs/get-started/quick-start.md +++ b/docs/get-started/quick-start.md @@ -7,13 +7,19 @@ There is also a video introduction to `invoke-training`: ## Quick Start - GUI + ### 1. Installation + Follow the [`invoke-training` installation instructions](./installation.md). ### 2. Launch the GUI + ```bash # From the invoke-training directory: invoke-train-ui + +# Or, you can optionally override the default host and port: +invoke-train-ui --host 0.0.0.0 --port 1234 ``` Access the GUI in your browser at the URL printed to the console. @@ -33,17 +39,20 @@ Click on 'Generate Config' to generate a YAML configuration file. This YAML conf Click on the 'Start Training' and check your terminal for progress logs. ### 6. Monitor training + Monitor the training process with Tensorboard by running `tensorboard --logdir output/` and visiting [localhost:6006](http://localhost:6006) in your browser. Here you can see generated validation images throughout the training process. ![Screenshot of the Tensorboard UI showing validation images.](../images/tensorboard_val_images_screenshot.png) -*Validation images in the Tensorboard UI.* +_Validation images in the Tensorboard UI._ ### 7. Invokeai + Select a checkpoint based on the quality of the generated images. If you haven't already, setup [InvokeAI](https://github.com/invoke-ai/InvokeAI) by following its documentation. Copy your selected LoRA checkpoint into your `${INVOKEAI_ROOT}/autoimport/lora` directory. For example: + ```bash # Note: You will have to replace the timestamp in the checkpoint path. cp output/1691088769.5694647/checkpoint_epoch-00000002.safetensors ${INVOKEAI_ROOT}/autoimport/lora/pokemon_epoch-00000002.safetensors @@ -52,12 +61,14 @@ cp output/1691088769.5694647/checkpoint_epoch-00000002.safetensors ${INVOKEAI_RO You can now use your trained Pokemon LoRA in the InvokeAI UI! 🎉 ![Screenshot of the InvokeAI UI with an example of a Yoda pokemon generated using a Pokemon LoRA model.](../images/invokeai_yoda_pokemon_lora.png) -*Example image generated with the prompt "A cute yoda pokemon creature." and Pokemon LoRA.* - +_Example image generated with the prompt "A cute yoda pokemon creature." and Pokemon LoRA._ ## Quick Start - CLI + ### 1. Installation + Follow the [`invoke-training` installation instructions](./installation.md). ### 2. Training + See the [Textual Inversion - SDXL](../tutorials/stable_diffusion/textual_inversion_sdxl.md) tutorial for instructions on how to train a model via the CLI. From 9abb93223fb3d4c71ee1c81d2fa60bda8dc18ff9 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Wed, 24 Apr 2024 16:55:28 -0400 Subject: [PATCH 3/3] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eada86f2..2d2e9982 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A library for training custom Stable Diffusion models (fine-tuning, LoRA training, textual inversion, etc.) that can be used in [InvokeAI](https://github.com/invoke-ai/InvokeAI). -> [!WARNING] > `invoke-training` is still under active development, and breaking changes are likely. Full backwards compatibility will not be guranteed until v1.0.0. +> [!WARNING] > `invoke-training` is still under active development, and breaking changes are likely. Full backwards compatibility will not be guaranteed until v1.0.0. > In the meantime, I recommend pinning to a specific commit hash. ## Documentation