import{s as A,o as K,n as O}from"../chunks/scheduler.6e0d5ff7.js";import{S as ee,i as te,g as p,s as o,r as v,E as le,h as r,f as l,c as n,j as q,u as Z,x as J,k as F,y as se,a as s,v as $,d as U,t as I,w as C}from"../chunks/index.d7c1b260.js";import{T as ie}from"../chunks/Tip.c000e27b.js";import{C as z}from"../chunks/CodeBlock.09a08494.js";import{D as oe}from"../chunks/DocNotebookDropdown.b1b23d60.js";import{H as ne}from"../chunks/Heading.30a009b0.js";function ae(k){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,M){s(a,i,M)},p:O,d(a){a&&l(i)}}}function pe(k){let i,f,a,M,c,G,u,W,d,E='커뮤니티 파이프라인은 논문에 명시된 원래의 구현체와 다른 형태로 구현된 모든 <code>DiffusionPipeline</code> 클래스를 의미합니다. (예를 들어, <code>StableDiffusionControlNetPipeline</code>는 <a href="https://arxiv.org/abs/2302.05543" rel="nofollow">“Text-to-Image Generation with ControlNet Conditioning”</a> 해당) 이들은 추가 기능을 제공하거나 파이프라인의 원래 구현을 확장합니다.',x,b,N='<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> 모든 공식 커뮤니티 파이프라인을 찾을 수 있습니다.',B,g,H="허브에서 커뮤니티 파이프라인을 로드하려면, 커뮤니티 파이프라인의 리포지토리 ID와 (파이프라인 가중치 및 구성 요소를 로드하려는) 모델의 리포지토리 ID를 인자로 전달해야 합니다. 예를 들어, 아래 예시에서는 <code>hf-internal-testing/diffusers-dummy-pipeline</code>에서 더미 파이프라인을 불러오고, <code>google/ddpm-cifar10-32</code>에서 파이프라인의 가중치와 컴포넌트들을 로드합니다.",V,m,P,h,R,y,Q='공식 커뮤니티 파이프라인을 불러오는 것은 비슷하지만, 공식 리포지토리 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,j,_,D='커뮤니티 파이프라인에 대한 자세한 내용은 <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>에 대한 가이드를 확인하세요 !',L,T,X;return c=new ne({props:{title:"커스텀 파이프라인 불러오기",local:"커스텀-파이프라인-불러오기",headingTag:"h1"}}),u=new oe({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 ie({props:{warning:!0,$$slots:{default:[ae]},$$scope:{ctx:k}}}),h=new z({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 z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBJbWFnZVByb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQWNsaXBfbW9kZWxfaWQlMjAlM0QlMjAlMjJsYWlvbiUyRkNMSVAtVmlULUItMzItbGFpb24yQi1zMzRCLWI3OUslMjIlMEElMEFmZWF0dXJlX2V4dHJhY3RvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2xpcF9tb2RlbF9pZCklMEFjbGlwX21vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZChjbGlwX21vZGVsX2lkKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTBBJTIwJTIwJTIwJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyY2xpcF9ndWlkZWRfc3RhYmxlX2RpZmZ1c2lvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMGNsaXBfbW9kZWwlM0RjbGlwX21vZGVsJTJDJTBBJTIwJTIwJTIwJTIwZmVhdHVyZV9leHRyYWN0b3IlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUwQSk=",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;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,
)`,wrap:!1}}),{c(){i=p("meta"),f=o(),a=p("p"),M=o(),v(c.$$.fragment),G=o(),v(u.$$.fragment),W=o(),d=p("p"),d.innerHTML=E,x=o(),b=p("p"),b.innerHTML=N,B=o(),g=p("p"),g.innerHTML=H,V=o(),v(m.$$.fragment),P=o(),v(h.$$.fragment),R=o(),y=p("p"),y.innerHTML=Q,S=o(),v(w.$$.fragment),j=o(),_=p("p"),_.innerHTML=D,L=o(),T=p("p"),this.h()},l(e){const t=le("svelte-u9bgzb",document.head);i=r(t,"META",{name:!0,content:!0}),t.forEach(l),f=n(e),a=r(e,"P",{}),q(a).forEach(l),M=n(e),Z(c.$$.fragment,e),G=n(e),Z(u.$$.fragment,e),W=n(e),d=r(e,"P",{"data-svelte-h":!0}),J(d)!=="svelte-piihgu"&&(d.innerHTML=E),x=n(e),b=r(e,"P",{"data-svelte-h":!0}),J(b)!=="svelte-18lvwqp"&&(b.innerHTML=N),B=n(e),g=r(e,"P",{"data-svelte-h":!0}),J(g)!=="svelte-16aji3q"&&(g.innerHTML=H),V=n(e),Z(m.$$.fragment,e),P=n(e),Z(h.$$.fragment,e),R=n(e),y=r(e,"P",{"data-svelte-h":!0}),J(y)!=="svelte-ntl3n4"&&(y.innerHTML=Q),S=n(e),Z(w.$$.fragment,e),j=n(e),_=r(e,"P",{"data-svelte-h":!0}),J(_)!=="svelte-uvoq7s"&&(_.innerHTML=D),L=n(e),T=r(e,"P",{}),q(T).forEach(l),this.h()},h(){F(i,"name","hf:doc:metadata"),F(i,"content",re)},m(e,t){se(document.head,i),s(e,f,t),s(e,a,t),s(e,M,t),$(c,e,t),s(e,G,t),$(u,e,t),s(e,W,t),s(e,d,t),s(e,x,t),s(e,b,t),s(e,B,t),s(e,g,t),s(e,V,t),$(m,e,t),s(e,P,t),$(h,e,t),s(e,R,t),s(e,y,t),s(e,S,t),$(w,e,t),s(e,j,t),s(e,_,t),s(e,L,t),s(e,T,t),X=!0},p(e,[t]){const Y={};t&2&&(Y.$$scope={dirty:t,ctx:e}),m.$set(Y)},i(e){X||(U(c.$$.fragment,e),U(u.$$.fragment,e),U(m.$$.fragment,e),U(h.$$.fragment,e),U(w.$$.fragment,e),X=!0)},o(e){I(c.$$.fragment,e),I(u.$$.fragment,e),I(m.$$.fragment,e),I(h.$$.fragment,e),I(w.$$.fragment,e),X=!1},d(e){e&&(l(f),l(a),l(M),l(G),l(W),l(d),l(x),l(b),l(B),l(g),l(V),l(P),l(R),l(y),l(S),l(j),l(_),l(L),l(T)),l(i),C(c,e),C(u,e),C(m,e),C(h,e),C(w,e)}}}const re='{"title":"커스텀 파이프라인 불러오기","local":"커스텀-파이프라인-불러오기","sections":[],"depth":1}';function me(k){return K(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class he extends ee{constructor(i){super(),te(this,i,me,pe,A,{})}}export{he as component};
