Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"受控生成","local":"controlled-generation","sections":[{"title":"InstructPix2Pix","local":"instructpix2pix","sections":[],"depth":2},{"title":"Attend and Excite","local":"attend-and-excite","sections":[],"depth":2},{"title":"语义引导(SEGA)","local":"semantic-guidance-sega","sections":[],"depth":2},{"title":"自注意力引导(SAG)","local":"self-attention-guidance-sag","sections":[],"depth":2},{"title":"Depth2Image","local":"depth2image","sections":[],"depth":2},{"title":"MultiDiffusion 全景","local":"multidiffusion-panorama","sections":[],"depth":2},{"title":"微调您自己的模型","local":"fine-tuning-your-own-models","sections":[],"depth":2},{"title":"DreamBooth","local":"dreambooth","sections":[],"depth":2},{"title":"文本反转","local":"textual-inversion","sections":[],"depth":2},{"title":"ControlNet","local":"controlnet","sections":[],"depth":2},{"title":"提示词加权","local":"prompt-weighting","sections":[],"depth":2},{"title":"Custom Diffusion","local":"custom-diffusion","sections":[],"depth":2},{"title":"DiffEdit","local":"diffedit","sections":[],"depth":2},{"title":"T2I-Adapter","local":"t2i-adapter","sections":[],"depth":2},{"title":"Fabric","local":"fabric","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/start.0S0_iEoG.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/I9eooN77.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bupkjr9f.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/app.CPdOxCbw.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CyvZ3FS5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/l0QnnOED.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DnVIJfC5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/0.DteTvmQZ.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CoSrdQax.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/390.DYfxoBKz.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DSPDl1gz.js" rel="modulepreload"> | |
| <!--1v3kjpy--><meta name="hf:doc:metadata" content="{"title":"Controlled generation","local":"controlled-generation","sections":[{"title":"InstructPix2Pix","local":"instructpix2pix","sections":[],"depth":2},{"title":"Attend and Excite","local":"attend-and-excite","sections":[],"depth":2},{"title":"Semantic Guidance (SEGA)","local":"semantic-guidance-sega","sections":[],"depth":2},{"title":"Self-attention Guidance (SAG)","local":"self-attention-guidance-sag","sections":[],"depth":2},{"title":"Depth2Image","local":"depth2image","sections":[],"depth":2},{"title":"MultiDiffusion Panorama","local":"multidiffusion-panorama","sections":[],"depth":2},{"title":"Fine-tuning your own models","local":"fine-tuning-your-own-models","sections":[],"depth":2},{"title":"DreamBooth","local":"dreambooth","sections":[],"depth":2},{"title":"Textual Inversion","local":"textual-inversion","sections":[],"depth":2},{"title":"ControlNet","local":"controlnet","sections":[],"depth":2},{"title":"Prompt Weighting","local":"prompt-weighting","sections":[],"depth":2},{"title":"Custom Diffusion","local":"custom-diffusion","sections":[],"depth":2},{"title":"DiffEdit","local":"diffedit","sections":[],"depth":2},{"title":"T2I-Adapter","local":"t2i-adapter","sections":[],"depth":2},{"title":"Fabric","local":"fabric","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" 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><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="controlled-generation" 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="#controlled-generation"><span><svg 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><!---->受控生成<!----></span></h1><!--]--><!----> <p>控制扩散模型生成的输出一直是社区长期追求的目标,如今已成为一个活跃的研究课题。在许多流行的扩散模型中,输入(包括图像和文本提示)的细微变化都可能导致输出发生巨大改变。在理想情况下,我们希望能够控制语义如何被保留和改变。</p> <p>大多数保留语义的示例都归结为能够准确地将输入的变化映射到输出的变化。例如,在提示词中为主语添加一个形容词,会保留整幅图像,仅修改所变更的主语。或者,对特定主体进行图像变体生成时,会保留该主体的姿态。</p> <p>此外,除了语义保真之外,我们还希望影响生成图像的其他特性。也就是说,总体而言,我们希望输出图像具有高质量、符合特定风格或更加逼真。</p> <p>我们将记录 <code>diffusers</code> 支持的用于控制扩散模型生成过程的一些技术。其中许多属于前沿研究,细节可能较为复杂。如果某些内容需要澄清,或者您有建议,请随时发起 <a href="https://github.com/huggingface/diffusers/discussions" rel="nofollow">GitHub Discussion</a> 或 <a href="https://github.com/huggingface/diffusers/issues" rel="nofollow">GitHub issue</a>。</p> <p>我们提供了关于如何控制生成过程的高层说明,并附上了一段技术细节的示例。如需更深入的技术解释,从流水线中链接的原始论文始终是最好的参考资料。</p> <p>根据具体用例,应选择合适的技术。在许多情况下,这些技术可以组合使用。例如,可以将 Textual Inversion 与 SEGA 结合,为使用 Textual Inversion 生成的输出提供更强的语义引导。</p> <p>除非另有说明,这些技术适用于现有模型,且不需要它们自身的权重。</p> <ol><li><a href="#instructpix2pix">InstructPix2Pix</a></li> <li><a href="#attend-and-excite">Attend and Excite</a></li> <li><a href="#semantic-guidance-sega">语义引导</a></li> <li><a href="#self-attention-guidance-sag">自注意力引导</a></li> <li><a href="#depth2image">Depth2Image</a></li> <li><a href="#multidiffusion-panorama">MultiDiffusion 全景</a></li> <li><a href="#dreambooth">DreamBooth</a></li> <li><a href="#textual-inversion">文本反转</a></li> <li><a href="#controlnet">ControlNet</a></li> <li><a href="#prompt-weighting">提示词加权</a></li> <li><a href="#custom-diffusion">自定义扩散</a></li> <li><a href="#diffedit">DiffEdit</a></li> <li><a href="#t2i-adapter">T2I-Adapter</a></li> <li><a href="#fabric">FABRIC</a></li></ol> <p>为了方便起见,我们提供了一张表格,用于说明哪些方法仅用于推理,哪些方法需要微调/训练。</p> <table><thead><tr><th align="center"><strong>方法</strong></th><th align="center"><strong>仅推理</strong></th><th align="center"><strong>需要训练 /<br/> 微调</strong></th><th align="center"><strong>评论</strong></th></tr></thead><tbody><tr><td align="center"><a href="#instructpix2pix">InstructPix2Pix</a></td><td align="center">✅</td><td align="center">❌</td><td align="center">此外,还可以进行<br/>微调,以提升在特定<br/>编辑指令上的<br/>性能。</td></tr><tr><td align="center"><a href="#attend-and-excite">Attend and Excite</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#semantic-guidance-sega">语义引导</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#self-attention-guidance-sag">自注意力引导</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#depth2image">Depth2Image</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#multidiffusion-panorama">MultiDiffusion 全景</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#dreambooth">DreamBooth</a></td><td align="center">❌</td><td align="center">✅</td><td align="center"></td></tr><tr><td align="center"><a href="#textual-inversion">文本反转</a></td><td align="center">❌</td><td align="center">✅</td><td align="center"></td></tr><tr><td align="center"><a href="#controlnet">ControlNet</a></td><td align="center">✅</td><td align="center">❌</td><td align="center">ControlNet 可以针对<br/>自定义条件进行<br/>训练/微调。</td></tr><tr><td align="center"><a href="#prompt-weighting">提示词加权</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#custom-diffusion">自定义扩散</a></td><td align="center">❌</td><td align="center">✅</td><td align="center"></td></tr><tr><td align="center"><a href="#diffedit">DiffEdit</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#t2i-adapter">T2I-Adapter</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr><tr><td align="center"><a href="#fabric">Fabric</a></td><td align="center">✅</td><td align="center">❌</td><td align="center"></td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="instructpix2pix" 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="#instructpix2pix"><span><svg 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><!---->InstructPix2Pix<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2211.09800" rel="nofollow">论文</a></p> <p><a href="../api/pipelines/pix2pix">InstructPix2Pix</a> 基于 Stable Diffusion 进行微调,以支持对输入图像进行编辑。它以一张图像和一段描述编辑操作的提示词作为输入,并输出编辑后的图像。 | |
| InstructPix2Pix 经过专门训练,能够很好地配合类似 <a href="https://openai.com/blog/instruction-following/" rel="nofollow">InstructGPT</a> 的提示词使用。</p> <!--[1--><h2 class="relative group"><a id="attend-and-excite" 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="#attend-and-excite"><span><svg 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><!---->Attend and Excite<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2301.13826" rel="nofollow">论文</a></p> <p>Attend and Excite 能够确保提示词中的主体在最终图像中得到忠实呈现。</p> <p>输入是一组 token 索引,对应于提示词中需要出现在图像里的主体。在去噪过程中,每个 token 索引都保证对图像中至少一个 patch 具有最低注意力阈值。在去噪过程中,中间潜变量会被迭代优化,以增强最被忽视的主体 token 的注意力,直到所有主体 token 的注意力都达到阈值。</p> <p>与 Pix2Pix Zero 类似,Attend and Excite 的流程中也包含一个小型优化循环(保持预训练权重不变),因此可能需要比常规的 <a href="../api/pipelines/stable_diffusion/text2img">StableDiffusionPipeline</a> 更多的内存。</p> <!--[1--><h2 class="relative group"><a id="semantic-guidance-sega" 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="#semantic-guidance-sega"><span><svg 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><!---->语义引导(SEGA)<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2301.12247" rel="nofollow">论文</a></p> <p>SEGA 允许从图像中添加或移除一个或多个概念,并且可以控制概念的强度。例如,可以使用“微笑”概念来逐步增加或减少肖像中的微笑程度。</p> <p>与分类器自由引导通过空提示输入提供引导类似,SEGA 通过概念提示提供引导。可以同时应用多个此类概念提示。根据引导是正向还是负向应用,每个概念提示可以添加或移除其对应的概念。</p> <p>与 Pix2Pix Zero 或 Attend and Excite 不同,SEGA 直接作用于扩散过程,而非执行任何显式的基于梯度的优化。</p> <!--[1--><h2 class="relative group"><a id="self-attention-guidance-sag" 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="#self-attention-guidance-sag"><span><svg 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><!---->自注意力引导(SAG)<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2210.00939" rel="nofollow">论文</a></p> <p>Self-attention Guidance 提升了图像的整体质量。</p> <p>SAG 提供了从未经高频细节条件化的预测到完全条件化图像的引导。高频细节是从 UNet 自注意力图中提取出来的。</p> <!--[1--><h2 class="relative group"><a id="depth2image" 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="#depth2image"><span><svg 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><!---->Depth2Image<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/stabilityai/stable-diffusion-2-depth" rel="nofollow">项目</a></p> <p><a href="../api/pipelines/stable_diffusion/depth2img">Depth2Image</a> 基于 Stable Diffusion 进行微调,以更好地保留文本引导图像变化中的语义信息。</p> <p>它以原始图像的独眼深度估计作为条件。</p> <!--[1--><h2 class="relative group"><a id="multidiffusion-panorama" 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="#multidiffusion-panorama"><span><svg 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><!---->MultiDiffusion 全景<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2302.08113" rel="nofollow">论文</a></p> <p>MultiDiffusion Panorama 在预训练扩散模型上定义了一种新的生成过程。该过程将多种扩散生成方法结合在一起,可直接用于生成高质量且多样化的图像。生成结果遵循用户提供的控制条件,例如期望的宽高比(如全景图)以及空间引导信号,范围从紧密的分割掩码到边界框。 | |
| MultiDiffusion Panorama 允许您以任意宽高比(例如全景图)生成高质量图像。</p> <!--[1--><h2 class="relative group"><a id="fine-tuning-your-own-models" 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="#fine-tuning-your-own-models"><span><svg 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><!---->微调您自己的模型<!----></span></h2><!--]--><!----> <p>除了预训练模型,Diffusers 还提供了训练脚本,用于在用户提供的数据上对模型进行微调。</p> <!--[1--><h2 class="relative group"><a id="dreambooth" 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="#dreambooth"><span><svg 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><!---->DreamBooth<!----></span></h2><!--]--><!----> <p><a href="https://dreambooth.github.io/" rel="nofollow">项目</a></p> <p><a href="../training/dreambooth">DreamBooth</a> 通过微调模型来使其学习新的主题。例如,可以使用几张某人的照片来生成该人物在不同风格下的图像。</p> <!--[1--><h2 class="relative group"><a id="textual-inversion" 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="#textual-inversion"><span><svg 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><!---->文本反转<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2208.01618" rel="nofollow">论文</a></p> <p><a href="../training/text_inversion">Textual Inversion</a> 通过微调模型来使其学习一个新概念。例如,可以使用几张特定艺术风格的图片来生成该风格下的图像。</p> <!--[1--><h2 class="relative group"><a id="controlnet" 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="#controlnet"><span><svg 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><!---->ControlNet<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2302.05543" rel="nofollow">论文</a></p> <p><a href="../api/pipelines/controlnet">ControlNet</a> 是一个辅助网络,用于添加额外的条件。 | |
| 共有 8 个标准的预训练 ControlNet,分别基于不同的条件进行训练,例如边缘检测、涂鸦、深度图和语义分割。</p> <!--[1--><h2 class="relative group"><a id="prompt-weighting" 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="#prompt-weighting"><span><svg 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><!---->提示词加权<!----></span></h2><!--]--><!----> <p><a href="../using-diffusers/weighted_prompts">提示词加权</a>是一种简单技术,用于对文本输入中的某些部分赋予更高的注意力权重。</p> <!--[1--><h2 class="relative group"><a id="custom-diffusion" 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="#custom-diffusion"><span><svg 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><!---->Custom Diffusion<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2212.04488" rel="nofollow">论文</a></p> <p><a href="../training/custom_diffusion">Custom Diffusion</a> 仅对预训练文本到图像扩散模型的交叉注意力图进行微调。它还支持额外执行 Textual Inversion。其设计本身就支持多概念训练。与 DreamBooth 和 Textual Inversion 类似,Custom Diffusion 也用于让预训练的文本到图像扩散模型学习新概念,从而生成包含目标概念的输出。</p> <!--[1--><h2 class="relative group"><a id="diffedit" 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="#diffedit"><span><svg 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><!---->DiffEdit<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2210.11427" rel="nofollow">论文</a></p> <p>DiffEdit 允许根据输入提示对输入图像进行语义编辑,同时尽可能保留原始输入图像。</p> <!--[1--><h2 class="relative group"><a id="t2i-adapter" 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="#t2i-adapter"><span><svg 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><!---->T2I-Adapter<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2302.08453" rel="nofollow">论文</a></p> <p><a href="../api/pipelines/stable_diffusion/adapter">T2I-Adapter</a> 是一个辅助网络,用于添加额外的条件。 | |
| 共有 8 个标准的预训练适配器,分别在不同的条件上进行训练,例如边缘检测、草图、深度图和语义分割。</p> <!--[1--><h2 class="relative group"><a id="fabric" 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="#fabric"><span><svg 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><!---->Fabric<!----></span></h2><!--]--><!----> <p><a href="https://huggingface.co/papers/2307.10159" rel="nofollow">论文</a></p> <p><a href="https://github.com/huggingface/diffusers/tree/442017ccc877279bcf24fbe92f92d3d0def191b6/examples/community#stable-diffusion-fabric-pipeline" rel="nofollow">Fabric</a> 是一种无需训练的方法,适用于多种流行的扩散模型。它利用最常用架构中存在的自注意力层,使扩散过程能够以一组反馈图像作为条件。</p> <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/using-diffusers/controlling_generation.md" target="_blank"><svg class="mr-1" 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="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_1qsdbwf = { | |
| base: "/docs/diffusers/main/en", | |
| assets: "/docs/diffusers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.0S0_iEoG.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.CPdOxCbw.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 390], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 37.8 kB
- Xet hash:
- b90521cbc426690864c70fd79e2c5a15c02263a202dd34b6f224d7c8121c226e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.