Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Overview","local":"overview","sections":[{"title":"Install","local":"install","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/entry/start.21e27d66.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/scheduler.8c3d61f6.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/singletons.1db06f6d.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/index.0997d446.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/paths.085e8bc8.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/entry/app.de4fb612.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/index.da70eac4.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/nodes/0.f6117ae5.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/nodes/192.512bfd70.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/CodeBlock.00a903b3.js"> | |
| <link rel="modulepreload" href="/docs/diffusers/main/en/_app/immutable/chunks/EditOnGithub.1e64e623.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Overview","local":"overview","sections":[{"title":"Install","local":"install","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="overview" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#overview"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Overview</span></h1> <p data-svelte-h="svelte-odg5wz">π€ Diffusers provides a collection of training scripts for you to train your own diffusion models. You can find all of our training scripts in <a href="https://github.com/huggingface/diffusers/tree/main/examples" rel="nofollow">diffusers/examples</a>.</p> <p data-svelte-h="svelte-1l5xx5e">Each training script is:</p> <ul data-svelte-h="svelte-17s4x4c"><li><strong>Self-contained</strong>: the training script does not depend on any local files, and all packages required to run the script are installed from the <code>requirements.txt</code> file.</li> <li><strong>Easy-to-tweak</strong>: the training scripts are an example of how to train a diffusion model for a specific task and wonβt work out-of-the-box for every training scenario. Youβll likely need to adapt the training script for your specific use-case. To help you with that, weβve fully exposed the data preprocessing code and the training loop so you can modify it for your own use.</li> <li><strong>Beginner-friendly</strong>: the training scripts are designed to be beginner-friendly and easy to understand, rather than including the latest state-of-the-art methods to get the best and most competitive results. Any training methods we consider too complex are purposefully left out.</li> <li><strong>Single-purpose</strong>: each training script is expressly designed for only one task to keep it readable and understandable.</li></ul> <p data-svelte-h="svelte-1yvg5e">Our current collection of training scripts include:</p> <table data-svelte-h="svelte-cok55p"><thead><tr><th>Training</th> <th>SDXL-support</th> <th>LoRA-support</th> <th>Flax-support</th></tr></thead> <tbody><tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/unconditional_image_generation" rel="nofollow">unconditional image generation</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/training_example.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td> <td></td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/text_to_image" rel="nofollow">text-to-image</a></td> <td>π</td> <td>π</td> <td>π</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion" rel="nofollow">textual inversion</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_textual_inversion_training.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td> <td></td> <td></td> <td>π</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth" rel="nofollow">DreamBooth</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_dreambooth_training.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td> <td>π</td> <td>π</td> <td>π</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/controlnet" rel="nofollow">ControlNet</a></td> <td>π</td> <td></td> <td>π</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/instruct_pix2pix" rel="nofollow">InstructPix2Pix</a></td> <td>π</td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/custom_diffusion" rel="nofollow">Custom Diffusion</a></td> <td></td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/t2i_adapter" rel="nofollow">T2I-Adapters</a></td> <td>π</td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/kandinsky2_2/text_to_image" rel="nofollow">Kandinsky 2.2</a></td> <td></td> <td>π</td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/wuerstchen/text_to_image" rel="nofollow">Wuerstchen</a></td> <td></td> <td>π</td> <td></td></tr></tbody></table> <p data-svelte-h="svelte-n03e9a">These examples are <strong>actively</strong> maintained, so please feel free to open an issue if they arenβt working as expected. If you feel like another training example should be included, youβre more than welcome to start a <a href="https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feature_request.md&title=" rel="nofollow">Feature Request</a> to discuss your feature idea with us and whether it meets our criteria of being self-contained, easy-to-tweak, beginner-friendly, and single-purpose.</p> <h2 class="relative group"><a id="install" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#install"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Install</span></h2> <p data-svelte-h="svelte-1uukpq2">Make sure you can successfully run the latest versions of the example scripts by installing the library from source in a new virtual environment:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers | |
| <span class="hljs-built_in">cd</span> diffusers | |
| pip install .<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-gld5li">Then navigate to the folder of the training script (for example, <a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth" rel="nofollow">DreamBooth</a>) and install the <code>requirements.txt</code> file. Some training scripts have a specific requirement file for SDXL, LoRA or Flax. If youβre using one of these scripts, make sure you install its corresponding requirements file.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-built_in">cd</span> examples/dreambooth | |
| pip install -r requirements.txt | |
| <span class="hljs-comment"># to train SDXL with DreamBooth</span> | |
| pip install -r requirements_sdxl.txt<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1fce6dt">To speedup training and reduce memory-usage, we recommend:</p> <ul data-svelte-h="svelte-aa6btk"><li>using PyTorch 2.0 or higher to automatically use <a href="../optimization/torch2.0#scaled-dot-product-attention">scaled dot product attention</a> during training (you donβt need to make any changes to the training code)</li> <li>installing <a href="../optimization/xformers">xFormers</a> to enable memory-efficient attention</li></ul> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/overview.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1eu7tzz = { | |
| assets: "/docs/diffusers/main/en", | |
| base: "/docs/diffusers/main/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.21e27d66.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.de4fb612.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 192], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 13.7 kB
- Xet hash:
- 963149c0f6edbdd4cb3276273c35b4671b1a68b785e2f458c8c8794cea410e3c
Β·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.