import{s as xe,o as Ee,n as Qe}from"../chunks/scheduler.6e0d5ff7.js";import{S as Be,i as Ne,g as i,s as a,r as m,E as Xe,h as p,f as e,c as s,j as Ve,u as r,x as o,k as Ie,y as Fe,a as n,v as c,d as u,t as M,w as U}from"../chunks/index.d7c1b260.js";import{H as y,g as Ye}from"../chunks/Heading.2be73954.js";import{T as Se}from"../chunks/Tip.c000e27b.js";import{C as f}from"../chunks/CodeBlock.09a08494.js";function Le(It){let d,T="가장 최신 버전의 예시 스크립트를 성공적으로 실행하기 위해서는, 소스에서 설치하고 최신 버전의 설치를 유지하는 것을 강력하게 추천합니다. 우리는 예시 스크립트들을 자주 업데이트하고 예시에 맞춘 특정한 요구사항을 설치합니다.";return{c(){d=i("p"),d.textContent=T},l(b){d=p(b,"P",{"data-svelte-h":!0}),o(d)!=="svelte-89o4gq"&&(d.textContent=T)},m(b,$t){n(b,d,$t)},p:Qe,d(b){b&&e(d)}}}function ke(It){let d,T,b,$t,J,xt,h,Dl='<a href="https://arxiv.org/abs/2302.05543" rel="nofollow">Adding Conditional Control to Text-to-Image Diffusion Models</a> (ControlNet)은 Lvmin Zhang과 Maneesh Agrawala에 의해 쓰여졌습니다.',Et,_,Al='이 예시는 <a href="https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md" rel="nofollow">원본 ControlNet 리포지토리에서 예시 학습하기</a>에 기반합니다. ControlNet은 원들을 채우기 위해 <a href="https://huggingface.co/datasets/fusing/fill50k" rel="nofollow">small synthetic dataset</a>을 사용해서 학습됩니다.',Qt,w,Bt,Z,ql="아래의 스크립트를 실행하기 전에, 라이브러리의 학습 의존성을 설치해야 합니다.",Nt,g,Xt,j,Pl="위 사항을 만족시키기 위해서, 새로운 가상환경에서 다음 일련의 스텝을 실행하세요:",Ft,R,Yt,C,Ol='그 다음에는 <a href="https://github.com/huggingface/diffusers/tree/main/examples/controlnet" rel="nofollow">예시 폴더</a>으로 이동합니다.',St,W,Lt,v,Kl="이제 실행하세요:",kt,G,Ht,$,te='<a href="https://github.com/huggingface/accelerate/" rel="nofollow">🤗Accelerate</a> 환경을 초기화 합니다:',zt,V,Dt,I,le="혹은 여러분의 환경이 무엇인지 몰라도 기본적인 🤗Accelerate 구성으로 초기화할 수 있습니다:",At,x,qt,E,ee="혹은 당신의 환경이 노트북 같은 상호작용하는 쉘을 지원하지 않는다면, 아래의 코드로 초기화 할 수 있습니다:",Pt,Q,Ot,B,Kt,N,ne='원본 데이터셋은 ControlNet <a href="https://huggingface.co/lllyasviel/ControlNet/blob/main/training/fill50k.zip" rel="nofollow">repo</a>에 올라와있지만, 우리는 <a href="https://huggingface.co/datasets/fusing/fill50k" rel="nofollow">여기</a>에 새롭게 다시 올려서 🤗 Datasets 과 호환가능합니다. 그래서 학습 스크립트 상에서 데이터 불러오기를 다룰 수 있습니다.',tl,X,ae='우리의 학습 예시는 원래 ControlNet의 학습에 쓰였던 <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow"><code>runwayml/stable-diffusion-v1-5</code></a>을 사용합니다. 그렇지만 ControlNet은 대응되는 어느 Stable Diffusion 모델(<a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" rel="nofollow"><code>CompVis/stable-diffusion-v1-4</code></a>) 혹은 <a href="https://huggingface.co/stabilityai/stable-diffusion-2-1" rel="nofollow"><code>stabilityai/stable-diffusion-2-1</code></a>의 증가를 위해 학습될 수 있습니다.',ll,F,se='자체 데이터셋을 사용하기 위해서는 <a href="create_dataset">학습을 위한 데이터셋 생성하기</a> 가이드를 확인하세요.',el,Y,nl,S,ie="이 학습에 사용될 다음 이미지들을 다운로드하세요:",al,L,sl,k,pe='<code>MODEL_NAME</code> 환경 변수 (Hub 모델 리포지토리 아이디 혹은 모델 가중치가 있는 디렉토리로 가는 주소)를 명시하고 <a href="https://huggingface.co/docs/diffusers/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path" rel="nofollow"><code>pretrained_model_name_or_path</code></a> 인자로 환경변수를 보냅니다.',il,H,oe="학습 스크립트는 당신의 리포지토리에 <code>diffusion_pytorch_model.bin</code> 파일을 생성하고 저장합니다.",pl,z,ol,D,me="이 기본적인 설정으로는 ~38GB VRAM이 필요합니다.",ml,A,re="기본적으로 학습 스크립트는 결과를 텐서보드에 기록합니다. 가중치(weight)와 편향(bias)을 사용하기 위해 <code>--report_to wandb</code> 를 전달합니다.",rl,q,ce="더 작은 batch(배치) 크기로 gradient accumulation(기울기 누적)을 하면 학습 요구사항을 ~20 GB VRAM으로 줄일 수 있습니다.",cl,P,ul,O,Ml,K,ue=`<code>accelerate</code> 은 seamless multi-GPU 학습을 고려합니다. <code>accelerate</code>과 함께 분산된 학습을 실행하기 위해 <a href="https://huggingface.co/docs/accelerate/basic_tutorials/launch" rel="nofollow">여기</a>
의 설명을 확인하세요. 아래는 예시 명령어입니다:`,Ul,tt,dl,lt,fl,et,yl,nt,Me='<thead><tr><th></th> <th align="center"></th></tr></thead> <tbody><tr><td></td> <td align="center">푸른 배경과 빨간 원</td></tr> <tr><td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png" alt="conditioning image"/></td> <td align="center"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/red_circle_with_blue_background_300_steps.png" alt="푸른 배경과 빨간 원"/></td></tr> <tr><td></td> <td align="center">갈색 꽃 배경과 청록색 원</td></tr> <tr><td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png" alt="conditioning image"/></td> <td align="center"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/cyan_circle_with_brown_floral_background_300_steps.png" alt="갈색 꽃 배경과 청록색 원"/></td></tr></tbody>',bl,at,gl,st,Ue='<thead><tr><th></th> <th align="center"></th></tr></thead> <tbody><tr><td></td> <td align="center">푸른 배경과 빨간 원</td></tr> <tr><td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png" alt="conditioning image"/></td> <td align="center"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/red_circle_with_blue_background_6000_steps.png" alt="푸른 배경과 빨간 원"/></td></tr> <tr><td></td> <td align="center">갈색 꽃 배경과 청록색 원</td></tr> <tr><td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png" alt="conditioning image"/></td> <td align="center"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/cyan_circle_with_brown_floral_background_6000_steps.png" alt="갈색 꽃 배경과 청록색 원"/></td></tr></tbody>',Tl,it,Jl,pt,de="16GB GPU에서 학습하기 위해 다음의 최적화를 진행하세요:",hl,ot,fe='<li>기울기 체크포인트 저장하기</li> <li>bitsandbyte의 <a href="https://github.com/TimDettmers/bitsandbytes#requirements--installation" rel="nofollow">8-bit optimizer</a>가 설치되지 않았다면 링크에 연결된 설명서를 보세요.</li>',_l,mt,ye="이제 학습 스크립트를 시작할 수 있습니다:",wl,rt,Zl,ct,jl,ut,be="12GB GPU에서 실행하기 위해 다음의 최적화를 진행하세요:",Rl,Mt,ge='<li>기울기 체크포인트 저장하기</li> <li>bitsandbyte의 8-bit <a href="https://github.com/TimDettmers/bitsandbytes#requirements--installation" rel="nofollow">optimizer</a>(가 설치되지 않았다면 링크에 연결된 설명서를 보세요)</li> <li><a href="https://huggingface.co/docs/diffusers/training/optimization/xformers" rel="nofollow">xFormers</a>(가 설치되지 않았다면 링크에 연결된 설명서를 보세요)</li> <li>기울기를 <code>None</code>으로 설정</li>',Cl,Ut,Wl,dt,Te="<code>pip install xformers</code>으로 <code>xformers</code>을 확실히 설치하고 <code>enable_xformers_memory_efficient_attention</code>을 사용하세요.",vl,ft,Gl,yt,Je=`우리는 ControlNet을 지원하기 위한 DeepSpeed를 철저하게 테스트하지 않았습니다. 환경설정이 메모리를 저장할 때,
그 환경이 성공적으로 학습했는지를 확정하지 않았습니다. 성공한 학습 실행을 위해 설정을 변경해야 할 가능성이 높습니다.`,$l,bt,he="8GB GPU에서 실행하기 위해 다음의 최적화를 진행하세요:",Vl,gt,_e='<li>기울기 체크포인트 저장하기</li> <li>bitsandbyte의 8-bit <a href="https://github.com/TimDettmers/bitsandbytes#requirements--installation" rel="nofollow">optimizer</a>(가 설치되지 않았다면 링크에 연결된 설명서를 보세요)</li> <li><a href="https://huggingface.co/docs/diffusers/training/optimization/xformers" rel="nofollow">xFormers</a>(가 설치되지 않았다면 링크에 연결된 설명서를 보세요)</li> <li>기울기를 <code>None</code>으로 설정</li> <li>DeepSpeed stage 2 변수와 optimizer 없에기</li> <li>fp16 혼합 정밀도(precision)</li>',Il,Tt,we=`<a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a>는 CPU 또는 NVME로 텐서를 VRAM에서 오프로드할 수 있습니다.
이를 위해서 훨씬 더 많은 RAM(약 25 GB)가 필요합니다.`,xl,Jt,Ze="DeepSpeed stage 2를 활성화하기 위해서 <code>accelerate config</code>로 환경을 구성해야합니다.",El,ht,je="구성(configuration) 파일은 이런 모습이어야 합니다:",Ql,_t,Bl,wt,Re="<팁>",Nl,Zt,Ce='<a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">문서</a>를 더 많은 DeepSpeed 설정 옵션을 위해 보세요.',Xl,jt,We="<팁>",Fl,Rt,ve=`기본 Adam optimizer를 DeepSpeed’의 Adam
<code>deepspeed.ops.adam.DeepSpeedCPUAdam</code> 으로 바꾸면 상당한 속도 향상을 이룰수 있지만,
Pytorch와 같은 버전의 CUDA toolchain이 필요합니다. 8-비트 optimizer는 현재 DeepSpeed와
호환되지 않는 것 같습니다.`,Yl,Ct,Sl,Wt,Ll,vt,Ge=`학습된 모델은 <code>StableDiffusionControlNetPipeline</code>과 함께 실행될 수 있습니다.
<code>base_model_path</code>와 <code>controlnet_path</code> 에 값을 지정하세요 <code>--pretrained_model_name_or_path</code> 와
<code>--output_dir</code> 는 학습 스크립트에 개별적으로 지정됩니다.`,kl,Gt,Hl,Vt,zl;return J=new y({props:{title:"ControlNet",local:"controlnet",headingTag:"h1"}}),w=new y({props:{title:"의존성 설치하기",local:"의존성-설치하기",headingTag:"h2"}}),g=new Se({props:{warning:!0,$$slots:{default:[Le]},$$scope:{ctx:It}}}),R=new f({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC1lJTIwLg==",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install -e .`,wrap:!1}}),W=new f({props:{code:"Y2QlMjBleGFtcGxlcyUyRmNvbnRyb2xuZXQ=",highlighted:'<span class="hljs-built_in">cd</span> examples/controlnet',wrap:!1}}),G=new f({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt",wrap:!1}}),V=new f({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),x=new f({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),Q=new f({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> write_basic_config

write_basic_config()`,wrap:!1}}),B=new y({props:{title:"원을 채우는 데이터셋",local:"원을-채우는-데이터셋",headingTag:"h2"}}),Y=new y({props:{title:"학습",local:"학습",headingTag:"h2"}}),L=new f({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmRpZmZ1c2VycyUyRmNvbnRyb2xuZXRfdHJhaW5pbmclMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMEElMEF3Z2V0JTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGZGlmZnVzZXJzJTJGY29udHJvbG5ldF90cmFpbmluZyUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZw==",highlighted:`wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png

wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png`,wrap:!1}}),z=new f({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=4 \\
 --push_to_hub`,wrap:!1}}),P=new f({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
  --push_to_hub`,wrap:!1}}),O=new y({props:{title:"여러개 GPU로 학습하기",local:"여러개-gpu로-학습하기",headingTag:"h2"}}),tt=new f({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMC0tbXVsdGlfZ3B1JTIwdHJhaW5fY29udHJvbG5ldC5weSUyMCU1QyUwQSUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9ESVIlMjAlNUMlMEElMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwLS1kYXRhc2V0X25hbWUlM0RmdXNpbmclMkZmaWxsNTBrJTIwJTVDJTBBJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtNSUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9pbWFnZSUyMCUyMi4lMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMjIlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzIucG5nJTIyJTIwJTVDJTBBJTIwLS12YWxpZGF0aW9uX3Byb21wdCUyMCUyMnJlZCUyMGNpcmNsZSUyMHdpdGglMjBibHVlJTIwYmFja2dyb3VuZCUyMiUyMCUyMmN5YW4lMjBjaXJjbGUlMjB3aXRoJTIwYnJvd24lMjBmbG9yYWwlMjBiYWNrZ3JvdW5kJTIyJTIwJTVDJTBBJTIwLS10cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMCU1QyUwQSUyMC0tdHJhY2tlcl9wcm9qZWN0X25hbWUlM0QlMjJjb250cm9sbmV0LWRlbW8lMjIlMjAlNUMlMEElMjAtLXJlcG9ydF90byUzRHdhbmRiJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> --multi_gpu train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=4 \\
 --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> \\
 --tracker_project_name=<span class="hljs-string">&quot;controlnet-demo&quot;</span> \\
 --report_to=wandb \\
  --push_to_hub`,wrap:!1}}),lt=new y({props:{title:"예시 결과",local:"예시-결과",headingTag:"h2"}}),et=new y({props:{title:"배치 사이즈 8로 300 스텝 이후:",local:"배치-사이즈-8로-300-스텝-이후",headingTag:"h4"}}),at=new y({props:{title:"배치 사이즈 8로 6000 스텝 이후:",local:"배치-사이즈-8로-6000-스텝-이후",headingTag:"h4"}}),it=new y({props:{title:"16GB GPU에서 학습하기",local:"16gb-gpu에서-학습하기",headingTag:"h2"}}),rt=new f({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --use_8bit_adam \\
  --push_to_hub`,wrap:!1}}),ct=new y({props:{title:"12GB GPU에서 학습하기",local:"12gb-gpu에서-학습하기",headingTag:"h2"}}),Ut=new f({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMC0tc2V0X2dyYWRzX3RvX25vbmUlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --use_8bit_adam \\
 --enable_xformers_memory_efficient_attention \\
 --set_grads_to_none \\
  --push_to_hub`,wrap:!1}}),ft=new y({props:{title:"8GB GPU에서 학습하기",local:"8gb-gpu에서-학습하기",headingTag:"h2"}}),_t=new f({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTBBJTIwJTIwZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNBJTIwNCUwQSUyMCUyMG9mZmxvYWRfb3B0aW1pemVyX2RldmljZSUzQSUyMGNwdSUwQSUyMCUyMG9mZmxvYWRfcGFyYW1fZGV2aWNlJTNBJTIwY3B1JTBBJTIwJTIwemVybzNfaW5pdF9mbGFnJTNBJTIwZmFsc2UlMEElMjAlMjB6ZXJvX3N0YWdlJTNBJTIwMiUwQWRpc3RyaWJ1dGVkX3R5cGUlM0ElMjBERUVQU1BFRUQ=",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">deepspeed_config:</span>
  <span class="hljs-attr">gradient_accumulation_steps:</span> <span class="hljs-number">4</span>
  <span class="hljs-attr">offload_optimizer_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">offload_param_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">false</span>
  <span class="hljs-attr">zero_stage:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</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fdG9fbm9uZSUyMCU1QyUwQSUyMC0tbWl4ZWRfcHJlY2lzaW9uJTIwZnAxNiUyMCU1QyUwQSUyMC0tcHVzaF90b19odWI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --enable_xformers_memory_efficient_attention \\
 --set_grads_to_none \\
 --mixed_precision fp16 \\
 --push_to_hub`,wrap:!1}}),Wt=new y({props:{title:"추론",local:"추론",headingTag:"h2"}}),Gt=new f({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkNvbnRyb2xOZXRQaXBlbGluZSUyQyUyMENvbnRyb2xOZXRNb2RlbCUyQyUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWJhc2VfbW9kZWxfcGF0aCUyMCUzRCUyMCUyMnBhdGglMjB0byUyMG1vZGVsJTIyJTBBY29udHJvbG5ldF9wYXRoJTIwJTNEJTIwJTIycGF0aCUyMHRvJTIwY29udHJvbG5ldCUyMiUwQSUwQWNvbn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bW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKCklMEElMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBY29udHJvbF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8xLnBuZyUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJwYWxlJTIwZ29sZGVuJTIwcm9kJTIwY2lyY2xlJTIwd2l0aCUyMG9sZCUyMGxhY2UlMjBiYWNrZ3JvdW5kJTIyJTBBJTBBJTIzJTIwJUVDJTlEJUI0JUVCJUFGJUI4JUVDJUE3JTgwJTIwJUVDJTgzJTlEJUVDJTg0JUIxJUVEJTk1JTk4JUVBJUI4JUIwJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2gubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTIwaW1hZ2UlM0Rjb250cm9sX2ltYWdlKS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjIuJTJGb3V0cHV0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

base_model_path = <span class="hljs-string">&quot;path to model&quot;</span>
controlnet_path = <span class="hljs-string">&quot;path to controlnet&quot;</span>

controlnet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    base_model_path, controlnet=controlnet, torch_dtype=torch.float16
)

<span class="hljs-comment"># 더 빠른 스케줄러와 메모리 최적화로 diffusion 프로세스 속도 올리기</span>
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
<span class="hljs-comment"># xformers가 설치되지 않으면 아래 줄을 삭제하기</span>
pipe.enable_xformers_memory_efficient_attention()

pipe.enable_model_cpu_offload()

control_image = load_image(<span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span>)
prompt = <span class="hljs-string">&quot;pale golden rod circle with old lace background&quot;</span>

<span class="hljs-comment"># 이미지 생성하기</span>
generator = torch.manual_seed(<span class="hljs-number">0</span>)
image = pipe(prompt, num_inference_steps=<span class="hljs-number">20</span>, generator=generator, image=control_image).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;./output.png&quot;</span>)`,wrap:!1}}),{c(){d=i("meta"),T=a(),b=i("p"),$t=a(),m(J.$$.fragment),xt=a(),h=i("p"),h.innerHTML=Dl,Et=a(),_=i("p"),_.innerHTML=Al,Qt=a(),m(w.$$.fragment),Bt=a(),Z=i("p"),Z.textContent=ql,Nt=a(),m(g.$$.fragment),Xt=a(),j=i("p"),j.textContent=Pl,Ft=a(),m(R.$$.fragment),Yt=a(),C=i("p"),C.innerHTML=Ol,St=a(),m(W.$$.fragment),Lt=a(),v=i("p"),v.textContent=Kl,kt=a(),m(G.$$.fragment),Ht=a(),$=i("p"),$.innerHTML=te,zt=a(),m(V.$$.fragment),Dt=a(),I=i("p"),I.textContent=le,At=a(),m(x.$$.fragment),qt=a(),E=i("p"),E.textContent=ee,Pt=a(),m(Q.$$.fragment),Ot=a(),m(B.$$.fragment),Kt=a(),N=i("p"),N.innerHTML=ne,tl=a(),X=i("p"),X.innerHTML=ae,ll=a(),F=i("p"),F.innerHTML=se,el=a(),m(Y.$$.fragment),nl=a(),S=i("p"),S.textContent=ie,al=a(),m(L.$$.fragment),sl=a(),k=i("p"),k.innerHTML=pe,il=a(),H=i("p"),H.innerHTML=oe,pl=a(),m(z.$$.fragment),ol=a(),D=i("p"),D.textContent=me,ml=a(),A=i("p"),A.innerHTML=re,rl=a(),q=i("p"),q.textContent=ce,cl=a(),m(P.$$.fragment),ul=a(),m(O.$$.fragment),Ml=a(),K=i("p"),K.innerHTML=ue,Ul=a(),m(tt.$$.fragment),dl=a(),m(lt.$$.fragment),fl=a(),m(et.$$.fragment),yl=a(),nt=i("table"),nt.innerHTML=Me,bl=a(),m(at.$$.fragment),gl=a(),st=i("table"),st.innerHTML=Ue,Tl=a(),m(it.$$.fragment),Jl=a(),pt=i("p"),pt.textContent=de,hl=a(),ot=i("ul"),ot.innerHTML=fe,_l=a(),mt=i("p"),mt.textContent=ye,wl=a(),m(rt.$$.fragment),Zl=a(),m(ct.$$.fragment),jl=a(),ut=i("p"),ut.textContent=be,Rl=a(),Mt=i("ul"),Mt.innerHTML=ge,Cl=a(),m(Ut.$$.fragment),Wl=a(),dt=i("p"),dt.innerHTML=Te,vl=a(),m(ft.$$.fragment),Gl=a(),yt=i("p"),yt.textContent=Je,$l=a(),bt=i("p"),bt.textContent=he,Vl=a(),gt=i("ul"),gt.innerHTML=_e,Il=a(),Tt=i("p"),Tt.innerHTML=we,xl=a(),Jt=i("p"),Jt.innerHTML=Ze,El=a(),ht=i("p"),ht.textContent=je,Ql=a(),m(_t.$$.fragment),Bl=a(),wt=i("p"),wt.textContent=Re,Nl=a(),Zt=i("p"),Zt.innerHTML=Ce,Xl=a(),jt=i("p"),jt.textContent=We,Fl=a(),Rt=i("p"),Rt.innerHTML=ve,Yl=a(),m(Ct.$$.fragment),Sl=a(),m(Wt.$$.fragment),Ll=a(),vt=i("p"),vt.innerHTML=Ge,kl=a(),m(Gt.$$.fragment),Hl=a(),Vt=i("p"),this.h()},l(t){const l=Xe("svelte-u9bgzb",document.head);d=p(l,"META",{name:!0,content:!0}),l.forEach(e),T=s(t),b=p(t,"P",{}),Ve(b).forEach(e),$t=s(t),r(J.$$.fragment,t),xt=s(t),h=p(t,"P",{"data-svelte-h":!0}),o(h)!=="svelte-9fufis"&&(h.innerHTML=Dl),Et=s(t),_=p(t,"P",{"data-svelte-h":!0}),o(_)!=="svelte-srp9tb"&&(_.innerHTML=Al),Qt=s(t),r(w.$$.fragment,t),Bt=s(t),Z=p(t,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-audt4e"&&(Z.textContent=ql),Nt=s(t),r(g.$$.fragment,t),Xt=s(t),j=p(t,"P",{"data-svelte-h":!0}),o(j)!=="svelte-enix0a"&&(j.textContent=Pl),Ft=s(t),r(R.$$.fragment,t),Yt=s(t),C=p(t,"P",{"data-svelte-h":!0}),o(C)!=="svelte-1k8zlp9"&&(C.innerHTML=Ol),St=s(t),r(W.$$.fragment,t),Lt=s(t),v=p(t,"P",{"data-svelte-h":!0}),o(v)!=="svelte-1fgpi95"&&(v.textContent=Kl),kt=s(t),r(G.$$.fragment,t),Ht=s(t),$=p(t,"P",{"data-svelte-h":!0}),o($)!=="svelte-12bqcqg"&&($.innerHTML=te),zt=s(t),r(V.$$.fragment,t),Dt=s(t),I=p(t,"P",{"data-svelte-h":!0}),o(I)!=="svelte-wd3dp4"&&(I.textContent=le),At=s(t),r(x.$$.fragment,t),qt=s(t),E=p(t,"P",{"data-svelte-h":!0}),o(E)!=="svelte-1gibgaz"&&(E.textContent=ee),Pt=s(t),r(Q.$$.fragment,t),Ot=s(t),r(B.$$.fragment,t),Kt=s(t),N=p(t,"P",{"data-svelte-h":!0}),o(N)!=="svelte-u51kgh"&&(N.innerHTML=ne),tl=s(t),X=p(t,"P",{"data-svelte-h":!0}),o(X)!=="svelte-1kxzxc6"&&(X.innerHTML=ae),ll=s(t),F=p(t,"P",{"data-svelte-h":!0}),o(F)!=="svelte-18vs9m4"&&(F.innerHTML=se),el=s(t),r(Y.$$.fragment,t),nl=s(t),S=p(t,"P",{"data-svelte-h":!0}),o(S)!=="svelte-64o031"&&(S.textContent=ie),al=s(t),r(L.$$.fragment,t),sl=s(t),k=p(t,"P",{"data-svelte-h":!0}),o(k)!=="svelte-ky63v0"&&(k.innerHTML=pe),il=s(t),H=p(t,"P",{"data-svelte-h":!0}),o(H)!=="svelte-1v3g5fv"&&(H.innerHTML=oe),pl=s(t),r(z.$$.fragment,t),ol=s(t),D=p(t,"P",{"data-svelte-h":!0}),o(D)!=="svelte-on7i15"&&(D.textContent=me),ml=s(t),A=p(t,"P",{"data-svelte-h":!0}),o(A)!=="svelte-j3jf4w"&&(A.innerHTML=re),rl=s(t),q=p(t,"P",{"data-svelte-h":!0}),o(q)!=="svelte-ibpfse"&&(q.textContent=ce),cl=s(t),r(P.$$.fragment,t),ul=s(t),r(O.$$.fragment,t),Ml=s(t),K=p(t,"P",{"data-svelte-h":!0}),o(K)!=="svelte-kn2k8f"&&(K.innerHTML=ue),Ul=s(t),r(tt.$$.fragment,t),dl=s(t),r(lt.$$.fragment,t),fl=s(t),r(et.$$.fragment,t),yl=s(t),nt=p(t,"TABLE",{"data-svelte-h":!0}),o(nt)!=="svelte-7n8ul8"&&(nt.innerHTML=Me),bl=s(t),r(at.$$.fragment,t),gl=s(t),st=p(t,"TABLE",{"data-svelte-h":!0}),o(st)!=="svelte-197rfee"&&(st.innerHTML=Ue),Tl=s(t),r(it.$$.fragment,t),Jl=s(t),pt=p(t,"P",{"data-svelte-h":!0}),o(pt)!=="svelte-1a3ynwi"&&(pt.textContent=de),hl=s(t),ot=p(t,"UL",{"data-svelte-h":!0}),o(ot)!=="svelte-gud7gs"&&(ot.innerHTML=fe),_l=s(t),mt=p(t,"P",{"data-svelte-h":!0}),o(mt)!=="svelte-fmnd9z"&&(mt.textContent=ye),wl=s(t),r(rt.$$.fragment,t),Zl=s(t),r(ct.$$.fragment,t),jl=s(t),ut=p(t,"P",{"data-svelte-h":!0}),o(ut)!=="svelte-ulemqz"&&(ut.textContent=be),Rl=s(t),Mt=p(t,"UL",{"data-svelte-h":!0}),o(Mt)!=="svelte-ezl5xe"&&(Mt.innerHTML=ge),Cl=s(t),r(Ut.$$.fragment,t),Wl=s(t),dt=p(t,"P",{"data-svelte-h":!0}),o(dt)!=="svelte-m0yrgw"&&(dt.innerHTML=Te),vl=s(t),r(ft.$$.fragment,t),Gl=s(t),yt=p(t,"P",{"data-svelte-h":!0}),o(yt)!=="svelte-1bj00p0"&&(yt.textContent=Je),$l=s(t),bt=p(t,"P",{"data-svelte-h":!0}),o(bt)!=="svelte-sh9kz6"&&(bt.textContent=he),Vl=s(t),gt=p(t,"UL",{"data-svelte-h":!0}),o(gt)!=="svelte-xjm66k"&&(gt.innerHTML=_e),Il=s(t),Tt=p(t,"P",{"data-svelte-h":!0}),o(Tt)!=="svelte-2hnilk"&&(Tt.innerHTML=we),xl=s(t),Jt=p(t,"P",{"data-svelte-h":!0}),o(Jt)!=="svelte-b5or85"&&(Jt.innerHTML=Ze),El=s(t),ht=p(t,"P",{"data-svelte-h":!0}),o(ht)!=="svelte-1y0d6k"&&(ht.textContent=je),Ql=s(t),r(_t.$$.fragment,t),Bl=s(t),wt=p(t,"P",{"data-svelte-h":!0}),o(wt)!=="svelte-1terwo1"&&(wt.textContent=Re),Nl=s(t),Zt=p(t,"P",{"data-svelte-h":!0}),o(Zt)!=="svelte-1p0c8l1"&&(Zt.innerHTML=Ce),Xl=s(t),jt=p(t,"P",{"data-svelte-h":!0}),o(jt)!=="svelte-1terwo1"&&(jt.textContent=We),Fl=s(t),Rt=p(t,"P",{"data-svelte-h":!0}),o(Rt)!=="svelte-1en0huo"&&(Rt.innerHTML=ve),Yl=s(t),r(Ct.$$.fragment,t),Sl=s(t),r(Wt.$$.fragment,t),Ll=s(t),vt=p(t,"P",{"data-svelte-h":!0}),o(vt)!=="svelte-1erw0pq"&&(vt.innerHTML=Ge),kl=s(t),r(Gt.$$.fragment,t),Hl=s(t),Vt=p(t,"P",{}),Ve(Vt).forEach(e),this.h()},h(){Ie(d,"name","hf:doc:metadata"),Ie(d,"content",He)},m(t,l){Fe(document.head,d),n(t,T,l),n(t,b,l),n(t,$t,l),c(J,t,l),n(t,xt,l),n(t,h,l),n(t,Et,l),n(t,_,l),n(t,Qt,l),c(w,t,l),n(t,Bt,l),n(t,Z,l),n(t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,l),c(Ct,t,l),n(t,Sl,l),c(Wt,t,l),n(t,Ll,l),n(t,vt,l),n(t,kl,l),c(Gt,t,l),n(t,Hl,l),n(t,Vt,l),zl=!0},p(t,[l]){const $e={};l&2&&($e.$$scope={dirty:l,ctx:t}),g.$set($e)},i(t){zl||(u(J.$$.fragment,t),u(w.$$.fragment,t),u(g.$$.fragment,t),u(R.$$.fragment,t),u(W.$$.fragment,t),u(G.$$.fragment,t),u(V.$$.fragment,t),u(x.$$.fragment,t),u(Q.$$.fragment,t),u(B.$$.fragment,t),u(Y.$$.fragment,t),u(L.$$.fragment,t),u(z.$$.fragment,t),u(P.$$.fragment,t),u(O.$$.fragment,t),u(tt.$$.fragment,t),u(lt.$$.fragment,t),u(et.$$.fragment,t),u(at.$$.fragment,t),u(it.$$.fragment,t),u(rt.$$.fragment,t),u(ct.$$.fragment,t),u(Ut.$$.fragment,t),u(ft.$$.fragment,t),u(_t.$$.fragment,t),u(Ct.$$.fragment,t),u(Wt.$$.fragment,t),u(Gt.$$.fragment,t),zl=!0)},o(t){M(J.$$.fragment,t),M(w.$$.fragment,t),M(g.$$.fragment,t),M(R.$$.fragment,t),M(W.$$.fragment,t),M(G.$$.fragment,t),M(V.$$.fragment,t),M(x.$$.fragment,t),M(Q.$$.fragment,t),M(B.$$.fragment,t),M(Y.$$.fragment,t),M(L.$$.fragment,t),M(z.$$.fragment,t),M(P.$$.fragment,t),M(O.$$.fragment,t),M(tt.$$.fragment,t),M(lt.$$.fragment,t),M(et.$$.fragment,t),M(at.$$.fragment,t),M(it.$$.fragment,t),M(rt.$$.fragment,t),M(ct.$$.fragment,t),M(Ut.$$.fragment,t),M(ft.$$.fragment,t),M(_t.$$.fragment,t),M(Ct.$$.fragment,t),M(Wt.$$.fragment,t),M(Gt.$$.fragment,t),zl=!1},d(t){t&&(e(T),e(b),e($t),e(xt),e(h),e(Et),e(_),e(Qt),e(Bt),e(Z),e(Nt),e(Xt),e(j),e(Ft),e(Yt),e(C),e(St),e(Lt),e(v),e(kt),e(Ht),e($),e(zt),e(Dt),e(I),e(At),e(qt),e(E),e(Pt),e(Ot),e(Kt),e(N),e(tl),e(X),e(ll),e(F),e(el),e(nl),e(S),e(al),e(sl),e(k),e(il),e(H),e(pl),e(ol),e(D),e(ml),e(A),e(rl),e(q),e(cl),e(ul),e(Ml),e(K),e(Ul),e(dl),e(fl),e(yl),e(nt),e(bl),e(gl),e(st),e(Tl),e(Jl),e(pt),e(hl),e(ot),e(_l),e(mt),e(wl),e(Zl),e(jl),e(ut),e(Rl),e(Mt),e(Cl),e(Wl),e(dt),e(vl),e(Gl),e(yt),e($l),e(bt),e(Vl),e(gt),e(Il),e(Tt),e(xl),e(Jt),e(El),e(ht),e(Ql),e(Bl),e(wt),e(Nl),e(Zt),e(Xl),e(jt),e(Fl),e(Rt),e(Yl),e(Sl),e(Ll),e(vt),e(kl),e(Hl),e(Vt)),e(d),U(J,t),U(w,t),U(g,t),U(R,t),U(W,t),U(G,t),U(V,t),U(x,t),U(Q,t),U(B,t),U(Y,t),U(L,t),U(z,t),U(P,t),U(O,t),U(tt,t),U(lt,t),U(et,t),U(at,t),U(it,t),U(rt,t),U(ct,t),U(Ut,t),U(ft,t),U(_t,t),U(Ct,t),U(Wt,t),U(Gt,t)}}}const He='{"title":"ControlNet","local":"controlnet","sections":[{"title":"의존성 설치하기","local":"의존성-설치하기","sections":[],"depth":2},{"title":"원을 채우는 데이터셋","local":"원을-채우는-데이터셋","sections":[],"depth":2},{"title":"학습","local":"학습","sections":[],"depth":2},{"title":"여러개 GPU로 학습하기","local":"여러개-gpu로-학습하기","sections":[],"depth":2},{"title":"예시 결과","local":"예시-결과","sections":[{"title":"배치 사이즈 8로 300 스텝 이후:","local":"배치-사이즈-8로-300-스텝-이후","sections":[],"depth":4},{"title":"배치 사이즈 8로 6000 스텝 이후:","local":"배치-사이즈-8로-6000-스텝-이후","sections":[],"depth":4}],"depth":2},{"title":"16GB GPU에서 학습하기","local":"16gb-gpu에서-학습하기","sections":[],"depth":2},{"title":"12GB GPU에서 학습하기","local":"12gb-gpu에서-학습하기","sections":[],"depth":2},{"title":"8GB GPU에서 학습하기","local":"8gb-gpu에서-학습하기","sections":[],"depth":2},{"title":"추론","local":"추론","sections":[],"depth":2}],"depth":1}';function ze(It){return Ee(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=Ye}),[]}class Ke extends Be{constructor(d){super(),Ne(this,d,ze,ke,xe,{})}}export{Ke as component};
