Buckets:

hf-doc-build/doc / diffusers /v0.19.2 /ko /using-diffusers /custom_pipeline_overview.html
rtrm's picture
download
raw
9.28 kB
<meta charset="utf-8" /><meta http-equiv="content-security-policy" content=""><meta name="hf:doc:metadata" content="{&quot;local&quot;:&quot;&quot;,&quot;title&quot;:&quot;커스텀 파이프라인 불러오기&quot;}" data-svelte="svelte-1phssyn">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/assets/pages/__layout.svelte-hf-doc-builder.css">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/start-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/chunks/vendor-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/chunks/paths-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/pages/__layout.svelte-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/pages/using-diffusers/custom_pipeline_overview.mdx-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/chunks/Tip-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/chunks/CodeBlock-hf-doc-builder.js">
<link rel="modulepreload" href="/docs/diffusers/v0.19.2/ko/_app/chunks/DocNotebookDropdown-hf-doc-builder.js">
<h1 id="">커스텀 파이프라인 불러오기</h1>
<div class="flex space-x-1 absolute z-10 right-0 top-0">
<div class="relative colab-dropdown ">
<button class=" " type="button">
<img alt="Open In Colab" class="!m-0" src="https://colab.research.google.com/assets/colab-badge.svg">
</button>
</div>
<div class="relative colab-dropdown ">
<button class=" " type="button">
<img alt="Open In Studio Lab" class="!m-0" src="https://studiolab.sagemaker.aws/studiolab.svg">
</button>
</div></div>
<p>커뮤니티 파이프라인은 논문에 명시된 원래의 구현체와 다른 형태로 구현된 모든 <code>DiffusionPipeline</code> 클래스를 의미합니다. (예를 들어, <code>StableDiffusionControlNetPipeline</code><a href="https://arxiv.org/abs/2302.05543" rel="nofollow">“Text-to-Image Generation with ControlNet Conditioning”</a> 해당) 이들은 추가 기능을 제공하거나 파이프라인의 원래 구현을 확장합니다.</p>
<p><a href="https://github.com/huggingface/diffusers/tree/main/examples/community#speech-to-image" rel="nofollow">Speech to Image</a> 또는 <a href="https://github.com/huggingface/diffusers/tree/main/examples/community#composable-stable-diffusion" rel="nofollow">Composable Stable Diffusion</a> 과 같은 멋진 커뮤니티 파이프라인이 많이 있으며 <a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">여기에서</a> 모든 공식 커뮤니티 파이프라인을 찾을 수 있습니다.</p>
<p>허브에서 커뮤니티 파이프라인을 로드하려면, 커뮤니티 파이프라인의 리포지토리 ID와 (파이프라인 가중치 및 구성 요소를 로드하려는) 모델의 리포지토리 ID를 인자로 전달해야 합니다. 예를 들어, 아래 예시에서는 <code>hf-internal-testing/diffusers-dummy-pipeline</code>에서 더미 파이프라인을 불러오고, <code>google/ddpm-cifar10-32</code>에서 파이프라인의 가중치와 컴포넌트들을 로드합니다.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"><p>🔒 허깅 페이스 허브에서 커뮤니티 파이프라인을 불러오는 것은 곧 해당 코드가 안전하다고 신뢰하는 것입니다. 코드를 자동으로 불러오고 실행하기 앞서 반드시 온라인으로 해당 코드의 신뢰성을 검사하세요!</p></div>
<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><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>, custom_pipeline=<span class="hljs-string">&quot;hf-internal-testing/diffusers-dummy-pipeline&quot;</span>
)<!-- HTML_TAG_END --></pre></div>
<p>공식 커뮤니티 파이프라인을 불러오는 것은 비슷하지만, 공식 리포지토리 ID에서 가중치를 불러오는 것과 더불어 해당 파이프라인 내의 컴포넌트를 직접 지정하는 것 역시 가능합니다. 아래 예제를 보면 커뮤니티 <a href="https://github.com/huggingface/diffusers/tree/main/examples/community#clip-guided-stable-diffusion" rel="nofollow">CLIP Guided Stable Diffusion</a> 파이프라인을 로드할 때, 해당 파이프라인에서 사용할 <code>clip_model</code> 컴포넌트와 <code>feature_extractor</code> 컴포넌트를 직접 설정하는 것을 확인할 수 있습니다.</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><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPImageProcessor, CLIPModel
clip_model_id = <span class="hljs-string">&quot;laion/CLIP-ViT-B-32-laion2B-s34B-b79K&quot;</span>
feature_extractor = CLIPImageProcessor.from_pretrained(clip_model_id)
clip_model = CLIPModel.from_pretrained(clip_model_id)
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>,
custom_pipeline=<span class="hljs-string">&quot;clip_guided_stable_diffusion&quot;</span>,
clip_model=clip_model,
feature_extractor=feature_extractor,
)<!-- HTML_TAG_END --></pre></div>
<p>커뮤니티 파이프라인에 대한 자세한 내용은 <a href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/custom_pipeline_examples" rel="nofollow">커뮤니티 파이프라인</a> 가이드를 살펴보세요. 커뮤니티 파이프라인 등록에 관심이 있는 경우 <a href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/contribute_pipeline" rel="nofollow">커뮤니티 파이프라인에 기여하는 방법</a>에 대한 가이드를 확인하세요 !</p>
<script type="module" data-hydrate="1dxp00h">
import { start } from "/docs/diffusers/v0.19.2/ko/_app/start-hf-doc-builder.js";
start({
target: document.querySelector('[data-hydrate="1dxp00h"]').parentNode,
paths: {"base":"/docs/diffusers/v0.19.2/ko","assets":"/docs/diffusers/v0.19.2/ko"},
session: {},
route: false,
spa: false,
trailing_slash: "never",
hydrate: {
status: 200,
error: null,
nodes: [
import("/docs/diffusers/v0.19.2/ko/_app/pages/__layout.svelte-hf-doc-builder.js"),
import("/docs/diffusers/v0.19.2/ko/_app/pages/using-diffusers/custom_pipeline_overview.mdx-hf-doc-builder.js")
],
params: {}
}
});
</script>

Xet Storage Details

Size:
9.28 kB
·
Xet hash:
2f7ec05564fa4cde2bbbc29da700d3d607ee0813b80ce23b0768bc388cef28be

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.