import{s as O,o as ee,n as te}from"../chunks/scheduler.94020406.js";import{S as se,i as le,g as p,s as o,r as v,E as ie,h as r,f as s,c as n,j as z,u as Z,x as J,k as A,y as oe,a as l,v as U,d as T,t as C,w as k}from"../chunks/index.a08c8d92.js";import{T as ne}from"../chunks/Tip.3b0aeee8.js";import{C as K}from"../chunks/CodeBlock.f1fae7de.js";import{D as ae}from"../chunks/DocNotebookDropdown.a1753374.js";import{H as pe,E as re}from"../chunks/getInferenceSnippets.4be082a0.js";function me(V){let i,f="🔒 허깅 페이스 허브에서 커뮤니티 파이프라인을 불러오는 것은 곧 해당 코드가 안전하다고 신뢰하는 것입니다. 코드를 자동으로 불러오고 실행하기 앞서 반드시 온라인으로 해당 코드의 신뢰성을 검사하세요!";return{c(){i=p("p"),i.textContent=f},l(a){i=r(a,"P",{"data-svelte-h":!0}),J(i)!=="svelte-52untw"&&(i.textContent=f)},m(a,$){l(a,i,$)},p:te,d(a){a&&s(i)}}}function fe(V){let i,f,a,$,c,W,u,j,d,Q='커뮤니티 파이프라인은 논문에 명시된 원래의 구현체와 다른 형태로 구현된 모든 <code>DiffusionPipeline</code> 클래스를 의미합니다. (예를 들어, <code>StableDiffusionControlNetPipeline</code>는 <a href="https://huggingface.co/papers/2302.05543" rel="nofollow">“Text-to-Image Generation with ControlNet Conditioning”</a> 해당) 이들은 추가 기능을 제공하거나 파이프라인의 원래 구현을 확장합니다.',x,b,H='<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> 모든 공식 커뮤니티 파이프라인을 찾을 수 있습니다.',I,g,D="허브에서 커뮤니티 파이프라인을 로드하려면, 커뮤니티 파이프라인의 리포지토리 ID와 (파이프라인 가중치 및 구성 요소를 로드하려는) 모델의 리포지토리 ID를 인자로 전달해야 합니다. 예를 들어, 아래 예시에서는 <code>hf-internal-testing/diffusers-dummy-pipeline</code>에서 더미 파이프라인을 불러오고, <code>google/ddpm-cifar10-32</code>에서 파이프라인의 가중치와 컴포넌트들을 로드합니다.",N,m,B,y,E,h,Y='공식 커뮤니티 파이프라인을 불러오는 것은 비슷하지만, 공식 리포지토리 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> 컴포넌트를 직접 설정하는 것을 확인할 수 있습니다.',S,w,P,M,q='커뮤니티 파이프라인에 대한 자세한 내용은 <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>에 대한 가이드를 확인하세요 !',X,_,R,G,L;return c=new pe({props:{title:"커스텀 파이프라인 불러오기",local:"커스텀-파이프라인-불러오기",headingTag:"h1"}}),u=new ae({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/custom_pipeline_overview.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/custom_pipeline_overview.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/custom_pipeline_overview.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/custom_pipeline_overview.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/custom_pipeline_overview.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/custom_pipeline_overview.ipynb"}]}}),m=new ne({props:{warning:!0,$$slots:{default:[me]},$$scope:{ctx:V}}}),y=new K({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGZGRwbS1jaWZhcjEwLTMyJTIyJTJDJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1kdW1teS1waXBlbGluZSUyMiUwQSk=",highlighted:`<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>
)`,wrap:!1}}),w=new K({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBJbWFnZVByb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQWNsaXBfbW9kZWxfaWQlMjAlM0QlMjAlMjJsYWlvbiUyRkNMSVAtVmlULUItMzItbGFpb24yQi1zMzRCLWI3OUslMjIlMEElMEFmZWF0dXJlX2V4dHJhY3RvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2xpcF9tb2RlbF9pZCklMEFjbGlwX21vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZChjbGlwX21vZGVsX2lkKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUwQSUyMCUyMCUyMCUyMGN1c3RvbV9waXBlbGluZSUzRCUyMmNsaXBfZ3VpZGVkX3N0YWJsZV9kaWZmdXNpb24lMjIlMkMlMEElMjAlMjAlMjAlMjBjbGlwX21vZGVsJTNEY2xpcF9tb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGZlYXR1cmVfZXh0cmFjdG9yJTNEZmVhdHVyZV9leHRyYWN0b3IlMkMlMEEp",highlighted:`<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;stable-diffusion-v1-5/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,
)`,wrap:!1}}),_=new re({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/using-diffusers/custom_pipeline_overview.md"}}),{c(){i=p("meta"),f=o(),a=p("p"),$=o(),v(c.$$.fragment),W=o(),v(u.$$.fragment),j=o(),d=p("p"),d.innerHTML=Q,x=o(),b=p("p"),b.innerHTML=H,I=o(),g=p("p"),g.innerHTML=D,N=o(),v(m.$$.fragment),B=o(),v(y.$$.fragment),E=o(),h=p("p"),h.innerHTML=Y,S=o(),v(w.$$.fragment),P=o(),M=p("p"),M.innerHTML=q,X=o(),v(_.$$.fragment),R=o(),G=p("p"),this.h()},l(e){const t=ie("svelte-u9bgzb",document.head);i=r(t,"META",{name:!0,content:!0}),t.forEach(s),f=n(e),a=r(e,"P",{}),z(a).forEach(s),$=n(e),Z(c.$$.fragment,e),W=n(e),Z(u.$$.fragment,e),j=n(e),d=r(e,"P",{"data-svelte-h":!0}),J(d)!=="svelte-1yp19et"&&(d.innerHTML=Q),x=n(e),b=r(e,"P",{"data-svelte-h":!0}),J(b)!=="svelte-18lvwqp"&&(b.innerHTML=H),I=n(e),g=r(e,"P",{"data-svelte-h":!0}),J(g)!=="svelte-16aji3q"&&(g.innerHTML=D),N=n(e),Z(m.$$.fragment,e),B=n(e),Z(y.$$.fragment,e),E=n(e),h=r(e,"P",{"data-svelte-h":!0}),J(h)!=="svelte-ntl3n4"&&(h.innerHTML=Y),S=n(e),Z(w.$$.fragment,e),P=n(e),M=r(e,"P",{"data-svelte-h":!0}),J(M)!=="svelte-uvoq7s"&&(M.innerHTML=q),X=n(e),Z(_.$$.fragment,e),R=n(e),G=r(e,"P",{}),z(G).forEach(s),this.h()},h(){A(i,"name","hf:doc:metadata"),A(i,"content",ce)},m(e,t){oe(document.head,i),l(e,f,t),l(e,a,t),l(e,$,t),U(c,e,t),l(e,W,t),U(u,e,t),l(e,j,t),l(e,d,t),l(e,x,t),l(e,b,t),l(e,I,t),l(e,g,t),l(e,N,t),U(m,e,t),l(e,B,t),U(y,e,t),l(e,E,t),l(e,h,t),l(e,S,t),U(w,e,t),l(e,P,t),l(e,M,t),l(e,X,t),U(_,e,t),l(e,R,t),l(e,G,t),L=!0},p(e,[t]){const F={};t&2&&(F.$$scope={dirty:t,ctx:e}),m.$set(F)},i(e){L||(T(c.$$.fragment,e),T(u.$$.fragment,e),T(m.$$.fragment,e),T(y.$$.fragment,e),T(w.$$.fragment,e),T(_.$$.fragment,e),L=!0)},o(e){C(c.$$.fragment,e),C(u.$$.fragment,e),C(m.$$.fragment,e),C(y.$$.fragment,e),C(w.$$.fragment,e),C(_.$$.fragment,e),L=!1},d(e){e&&(s(f),s(a),s($),s(W),s(j),s(d),s(x),s(b),s(I),s(g),s(N),s(B),s(E),s(h),s(S),s(P),s(M),s(X),s(R),s(G)),s(i),k(c,e),k(u,e),k(m,e),k(y,e),k(w,e),k(_,e)}}}const ce='{"title":"커스텀 파이프라인 불러오기","local":"커스텀-파이프라인-불러오기","sections":[],"depth":1}';function ue(V){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Me extends se{constructor(i){super(),le(this,i,ue,fe,O,{})}}export{Me as component};
