From a16e7a4cc490cab282392d668284ca9bdb9f90f2 Mon Sep 17 00:00:00 2001 From: abhishekkrthakur Date: Fri, 29 Nov 2024 11:52:15 +0100 Subject: [PATCH] remove dreambooth --- README.md | 1 - colabs/AutoTrain_Dreambooth.ipynb | 178 --------------------------- configs/dreambooth/sd15_colab.yml | 24 ---- configs/dreambooth/sdxl_colab.yml | 25 ---- docs/source/_toctree.yml | 2 - docs/source/col_map.mdx | 4 - docs/source/quickstart.mdx | 2 - docs/source/quickstart_py.mdx | 1 - docs/source/tasks/dreambooth.mdx | 40 ------ docs/source/tasks/dreambooth.mdx.bck | 40 ------ 10 files changed, 317 deletions(-) delete mode 100644 colabs/AutoTrain_Dreambooth.ipynb delete mode 100644 configs/dreambooth/sd15_colab.yml delete mode 100644 configs/dreambooth/sdxl_colab.yml delete mode 100644 docs/source/tasks/dreambooth.mdx delete mode 100644 docs/source/tasks/dreambooth.mdx.bck diff --git a/README.md b/README.md index 4703ca682e..d0b153e762 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ NOTE: AutoTrain is free! You only pay for the resources you use in case you deci | Extractive Question Answering | ✅ | Coming Soon | [extractive_qa.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/extractive_question_answering) | | Image Classification | ✅ | Coming Soon | [image_classification.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/image_classification) | | Image Scoring/Regression | ✅ | Coming Soon | [image_regression.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/image_scoring) | -| DreamBooth LoRA | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/colabs/AutoTrain_Dreambooth.ipynb) | [dreambooth_lora.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/dreambooth) | | VLM | 🟥 | Coming Soon | [vlm.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/vlm) | diff --git a/colabs/AutoTrain_Dreambooth.ipynb b/colabs/AutoTrain_Dreambooth.ipynb deleted file mode 100644 index 06940639f1..0000000000 --- a/colabs/AutoTrain_Dreambooth.ipynb +++ /dev/null @@ -1,178 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "collapsed": true, - "id": "JvMRbVLEJlZT", - "outputId": "aa97ec7b-af8c-4072-8885-2aa36a1a3cdf" - }, - "outputs": [], - "source": [ - "#@title 🤗 AutoTrain DreamBooth\n", - "#@markdown In order to use this colab\n", - "#@markdown - upload images to a folder named `images/`\n", - "#@markdown - choose a project name if you wish\n", - "#@markdown - change model if you wish, you can also select sd2/2.1 or sd1.5\n", - "#@markdown - update prompt and remember it. choose keywords that don't usually appear in dictionaries\n", - "#@markdown - add huggingface information (token) if you wish to push trained model to huggingface hub\n", - "#@markdown - update hyperparameters if you wish\n", - "#@markdown - click `Runtime > Run all` or run each cell individually\n", - "#@markdown - report issues / feature requests here: https://github.com/huggingface/autotrain-advanced/issues\n", - "\n", - "import os\n", - "!pip install -U autotrain-advanced > install_logs.txt" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "cellView": "form", - "id": "A2-_lkBS1WKA" - }, - "outputs": [], - "source": [ - "#@markdown ---\n", - "#@markdown #### Project Config\n", - "project_name = 'my-dreambooth-project' # @param {type:\"string\"}\n", - "model_name = 'stabilityai/stable-diffusion-xl-base-1.0' # @param [\"stabilityai/stable-diffusion-xl-base-1.0\", \"runwayml/stable-diffusion-v1-5\", \"stabilityai/stable-diffusion-2-1\", \"stabilityai/stable-diffusion-2-1-base\"]\n", - "prompt = 'photo of a sks dog' # @param {type: \"string\"}\n", - "\n", - "#@markdown ---\n", - "#@markdown #### Push to Hub?\n", - "#@markdown Use these only if you want to push your trained model to a private repo in your Hugging Face Account\n", - "#@markdown If you dont use these, the model will be saved in Google Colab and you are required to download it manually.\n", - "#@markdown Please enter your Hugging Face write token. The trained model will be saved to your Hugging Face account.\n", - "#@markdown You can find your token here: https://huggingface.co/settings/tokens\n", - "push_to_hub = False # @param [\"False\", \"True\"] {type:\"raw\"}\n", - "hf_token = \"hf_XXX\" #@param {type:\"string\"}\n", - "hf_username = \"abc\" #@param {type:\"string\"}\n", - "\n", - "#@markdown ---\n", - "#@markdown #### Hyperparameters\n", - "learning_rate = 1e-4 # @param {type:\"number\"}\n", - "num_steps = 500 #@param {type:\"number\"}\n", - "batch_size = 1 # @param {type:\"slider\", min:1, max:32, step:1}\n", - "gradient_accumulation = 4 # @param {type:\"slider\", min:1, max:32, step:1}\n", - "resolution = 1024 # @param {type:\"slider\", min:128, max:1024, step:128}\n", - "use_8bit_adam = False # @param [\"False\", \"True\"] {type:\"raw\"}\n", - "use_xformers = False # @param [\"False\", \"True\"] {type:\"raw\"}\n", - "mixed_precision = \"fp16\" # @param [\"fp16\", \"bf16\", \"none\"] {type:\"raw\"}\n", - "train_text_encoder = False # @param [\"False\", \"True\"] {type:\"raw\"}\n", - "disable_gradient_checkpointing = False # @param [\"False\", \"True\"] {type:\"raw\"}\n", - "\n", - "os.environ[\"PROJECT_NAME\"] = project_name\n", - "os.environ[\"MODEL_NAME\"] = model_name\n", - "os.environ[\"PROMPT\"] = prompt\n", - "os.environ[\"PUSH_TO_HUB\"] = str(push_to_hub)\n", - "os.environ[\"HF_TOKEN\"] = hf_token\n", - "os.environ[\"LEARNING_RATE\"] = str(learning_rate)\n", - "os.environ[\"NUM_STEPS\"] = str(num_steps)\n", - "os.environ[\"BATCH_SIZE\"] = str(batch_size)\n", - "os.environ[\"GRADIENT_ACCUMULATION\"] = str(gradient_accumulation)\n", - "os.environ[\"RESOLUTION\"] = str(resolution)\n", - "os.environ[\"USE_8BIT_ADAM\"] = str(use_8bit_adam)\n", - "os.environ[\"USE_XFORMERS\"] = str(use_xformers)\n", - "os.environ[\"MIXED_PRECISION\"] = str(mixed_precision)\n", - "os.environ[\"TRAIN_TEXT_ENCODER\"] = str(train_text_encoder)\n", - "os.environ[\"DISABLE_GRADIENT_CHECKPOINTING\"] = str(disable_gradient_checkpointing)\n", - "os.environ[\"HF_USERNAME\"] = hf_username" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "collapsed": true, - "id": "g3cd_ED_yXXt", - "outputId": "f8e88e16-07c4-463c-9f6c-f0470a0288a2" - }, - "outputs": [], - "source": [ - "!autotrain dreambooth \\\n", - "--model ${MODEL_NAME} \\\n", - "--project-name ${PROJECT_NAME} \\\n", - "--image-path images/ \\\n", - "--prompt \"${PROMPT}\" \\\n", - "--resolution ${RESOLUTION} \\\n", - "--batch-size ${BATCH_SIZE} \\\n", - "--num-steps ${NUM_STEPS} \\\n", - "--gradient-accumulation ${GRADIENT_ACCUMULATION} \\\n", - "--lr ${LEARNING_RATE} \\\n", - "--mixed-precision ${MIXED_PRECISION} \\\n", - "--username ${HF_USERNAME} \\\n", - "$( [[ \"$USE_XFORMERS\" == \"True\" ]] && echo \"--xformers\" ) \\\n", - "$( [[ \"$TRAIN_TEXT_ENCODER\" == \"True\" ]] && echo \"--train-text-encoder\" ) \\\n", - "$( [[ \"$USE_8BIT_ADAM\" == \"True\" ]] && echo \"--use-8bit-adam\" ) \\\n", - "$( [[ \"$DISABLE_GRADIENT_CHECKPOINTING\" == \"True\" ]] && echo \"--disable_gradient-checkpointing\" ) \\\n", - "$( [[ \"$PUSH_TO_HUB\" == \"True\" ]] && echo \"--push-to-hub --token ${HF_TOKEN}\" )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "_LvIS7-7PcLT" - }, - "outputs": [], - "source": [ - "# Inference\n", - "# this is the inference code that you can use after you have trained your model\n", - "# Unhide code below and change prj_path to your repo or local path (e.g. my_dreambooth_project)\n", - "#\n", - "#\n", - "#\n", - "# from diffusers import DiffusionPipeline, StableDiffusionXLImg2ImgPipeline\n", - "# import torch\n", - "\n", - "# prj_path = \"username/repo_name\"\n", - "# model = \"stabilityai/stable-diffusion-xl-base-1.0\"\n", - "# pipe = DiffusionPipeline.from_pretrained(\n", - "# model,\n", - "# torch_dtype=torch.float16,\n", - "# )\n", - "# pipe.to(\"cuda\")\n", - "# pipe.load_lora_weights(prj_path, weight_name=\"pytorch_lora_weights.safetensors\")\n", - "\n", - "# refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(\n", - "# \"stabilityai/stable-diffusion-xl-refiner-1.0\",\n", - "# torch_dtype=torch.float16,\n", - "# )\n", - "# refiner.to(\"cuda\")\n", - "\n", - "# prompt = \"photo of a sks dog in a bucket\"\n", - "\n", - "# seed = 42\n", - "# generator = torch.Generator(\"cuda\").manual_seed(seed)\n", - "# image = pipe(prompt=prompt, generator=generator).images[0]\n", - "# image = refiner(prompt=prompt, generator=generator, image=image).images[0]\n", - "# image.save(f\"generated_image.png\")" - ] - } - ], - "metadata": { - "accelerator": "GPU", - "colab": { - "gpuType": "T4", - "provenance": [] - }, - "kernelspec": { - "display_name": "Python 3", - "name": "python3" - }, - "language_info": { - "name": "python" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/configs/dreambooth/sd15_colab.yml b/configs/dreambooth/sd15_colab.yml deleted file mode 100644 index 0b254bfbb4..0000000000 --- a/configs/dreambooth/sd15_colab.yml +++ /dev/null @@ -1,24 +0,0 @@ -task: dreambooth -base_model: runwayml/stable-diffusion-v1-5 -project_name: autotrain-sd15-finetuned -backend: local - -data: - path: data/ # store all images in this folder - prompt: photo of sks person # prompt for the model - -params: - resolution: 512 - batch_size: 1 - num_steps: 500 - lr: 1e-4 - gradient_accumulation: 4 - mixed_precision: fp16 - train_text_encoder: false - xformers: false - use_8bit_adam: false - -hub: - username: ${HF_USERNAME} - token: ${HF_TOKEN} - push_to_hub: true \ No newline at end of file diff --git a/configs/dreambooth/sdxl_colab.yml b/configs/dreambooth/sdxl_colab.yml deleted file mode 100644 index 3a280f5040..0000000000 --- a/configs/dreambooth/sdxl_colab.yml +++ /dev/null @@ -1,25 +0,0 @@ -task: dreambooth -base_model: stabilityai/stable-diffusion-xl-base-1.0 -project_name: autotrain-sdxl-finetuned -backend: local - -data: - path: data/ # store all images in this folder - prompt: photo of sks person # prompt for the model - -params: - resolution: 1024 - batch_size: 1 - num_steps: 500 - lr: 1e-4 - gradient_accumulation: 4 - mixed_precision: fp16 - train_text_encoder: false - xformers: false - use_8bit_adam: false - xl: true - -hub: - username: ${HF_USERNAME} - token: ${HF_TOKEN} - push_to_hub: true \ No newline at end of file diff --git a/docs/source/_toctree.yml b/docs/source/_toctree.yml index e51f2509cf..fbb26c0f87 100644 --- a/docs/source/_toctree.yml +++ b/docs/source/_toctree.yml @@ -31,8 +31,6 @@ title: Image Classification / Regression - local: tasks/object_detection title: Object Detection - - local: tasks/dreambooth - title: DreamBooth - local: tasks/seq2seq title: Seq2Seq - local: tasks/token_classification diff --git a/docs/source/col_map.mdx b/docs/source/col_map.mdx index a31672f84e..fa802e5afb 100644 --- a/docs/source/col_map.mdx +++ b/docs/source/col_map.mdx @@ -131,10 +131,6 @@ For a single target column, you can pass a list with a single element. For multiple target columns, e.g. a multi label classification task, you can pass a list with multiple elements. -# DreamBooth LoRA - -Dreambooth doesn't require column mapping. - # Image Classification For image classification, the column mapping should be as follows: diff --git a/docs/source/quickstart.mdx b/docs/source/quickstart.mdx index 725ea67ff5..048a25c959 100644 --- a/docs/source/quickstart.mdx +++ b/docs/source/quickstart.mdx @@ -55,7 +55,6 @@ positional arguments: app, llm, setup, - dreambooth, api, text-classification, text-regression, @@ -82,7 +81,6 @@ The autotrain commands that end users will be interested in are: - `app`: Start the AutoTrain UI - `llm`: Train a language model -- `dreambooth`: Train a model using DreamBooth - `text-classification`: Train a text classification model - `text-regression`: Train a text regression model - `image-classification`: Train an image classification model diff --git a/docs/source/quickstart_py.mdx b/docs/source/quickstart_py.mdx index 9bc2a5f1cd..d76086e56f 100644 --- a/docs/source/quickstart_py.mdx +++ b/docs/source/quickstart_py.mdx @@ -104,7 +104,6 @@ Your HF_TOKEN and HF_USERNAME are only required if you want to push the model or [[autodoc]] trainers.object_detection.params.ObjectDetectionParams -[[autodoc]] trainers.dreambooth.params.DreamBoothTrainingParams ### Tabular Tasks diff --git a/docs/source/tasks/dreambooth.mdx b/docs/source/tasks/dreambooth.mdx deleted file mode 100644 index f8402a9ed8..0000000000 --- a/docs/source/tasks/dreambooth.mdx +++ /dev/null @@ -1,40 +0,0 @@ -# DreamBooth - -DreamBooth is an innovative method that allows for the customization of text-to-image -models like Stable Diffusion using just a few images of a subject. -DreamBooth enables the generation of new, contextually varied images of the -subject in a range of scenes, poses, and viewpoints, expanding the creative -possibilities of generative models. - - -## Data Preparation - -The data format for DreamBooth training is simple. All you need is images of a concept (e.g. a person) and a concept token. - -### Step 1: Gather Your Images - -Collect 3-5 high-quality images of the subject you wish to personalize. -These images should vary slightly in pose or background to provide the model with a -diverse learning set. You can select more images if you want to train a more robust model. - - -### Step 2: Select Your Model - -Choose a base model from the Hugging Face Hub that is compatible with your needs. -It's essential to select a model that supports the image size of your training data. -Models available on the hub often have specific requirements or capabilities, -so ensure the model you choose can accommodate the dimensions of your images. - - -### Step 3: Define Your Concept Token - -The concept token is a crucial element in DreamBooth training. -This token acts as a unique identifier for your subject within the model. -Typically, you will use a simple, descriptive keyword like prompt in the parameters -section of your training setup. This token will be used to generate new images of -your subject by the model. - - -## Parameters - -[[autodoc]] trainers.dreambooth.params.DreamBoothTrainingParams \ No newline at end of file diff --git a/docs/source/tasks/dreambooth.mdx.bck b/docs/source/tasks/dreambooth.mdx.bck deleted file mode 100644 index f8402a9ed8..0000000000 --- a/docs/source/tasks/dreambooth.mdx.bck +++ /dev/null @@ -1,40 +0,0 @@ -# DreamBooth - -DreamBooth is an innovative method that allows for the customization of text-to-image -models like Stable Diffusion using just a few images of a subject. -DreamBooth enables the generation of new, contextually varied images of the -subject in a range of scenes, poses, and viewpoints, expanding the creative -possibilities of generative models. - - -## Data Preparation - -The data format for DreamBooth training is simple. All you need is images of a concept (e.g. a person) and a concept token. - -### Step 1: Gather Your Images - -Collect 3-5 high-quality images of the subject you wish to personalize. -These images should vary slightly in pose or background to provide the model with a -diverse learning set. You can select more images if you want to train a more robust model. - - -### Step 2: Select Your Model - -Choose a base model from the Hugging Face Hub that is compatible with your needs. -It's essential to select a model that supports the image size of your training data. -Models available on the hub often have specific requirements or capabilities, -so ensure the model you choose can accommodate the dimensions of your images. - - -### Step 3: Define Your Concept Token - -The concept token is a crucial element in DreamBooth training. -This token acts as a unique identifier for your subject within the model. -Typically, you will use a simple, descriptive keyword like prompt in the parameters -section of your training setup. This token will be used to generate new images of -your subject by the model. - - -## Parameters - -[[autodoc]] trainers.dreambooth.params.DreamBoothTrainingParams \ No newline at end of file