import{s as es,o as ss,n as F}from"../chunks/scheduler.6e0d5ff7.js";import{S as as,i as ns,g as f,s as p,r,E as ps,h as y,f as s,c as i,j as Ke,u as o,x as u,k as ls,y as is,a,v as T,d as J,t as c,w as m}from"../chunks/index.d7c1b260.js";import{H as I,g as Us}from"../chunks/Heading.2be73954.js";import{T as ts}from"../chunks/Tip.c000e27b.js";import{C as b}from"../chunks/CodeBlock.09a08494.js";import{F as Je,M as Hl}from"../chunks/Markdown.6342ad80.js";function Ms(C){let n,U='DreamBooth 파인튜닝은 하이퍼파라미터에 매우 민감하고 과적합되기 쉽습니다. 적절한 하이퍼파라미터를 선택하는 데 도움이 되도록 다양한 권장 설정이 포함된 <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">심층 분석</a>을 살펴보는 것이 좋습니다.';return{c(){n=f("p"),n.innerHTML=U},l(e){n=y(e,"P",{"data-svelte-h":!0}),u(n)!=="svelte-1porws4"&&(n.innerHTML=U)},m(e,M){a(e,n,M)},p:F,d(e){e&&s(n)}}}function rs(C){let n,U=`<a href="https://drive.google.com/drive/folders/1BO_dyz-p65qhBRRMRA4TbZ8qW4rB99JZ" rel="nofollow">몇 장의 강아지 이미지들</a>로 DreamBooth를 시도해봅시다.
이를 다운로드해 디렉터리에 저장한 다음 <code>INSTANCE_DIR</code> 환경 변수를 해당 경로로 설정합니다:`,e,M,h,j,R='그런 다음, 다음 명령을 사용하여 학습 스크립트를 실행할 수 있습니다 (전체 학습 스크립트는 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">여기</a>에서 찾을 수 있습니다):',g,_,$;return M=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFleHBvcnQlMjBJTlNUQU5DRV9ESVIlM0QlMjJwYXRoX3RvX3RyYWluaW5nX2ltYWdlcyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJwYXRoX3RvX3NhdmVkX21vZGVsJTIy",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path_to_training_images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>`,wrap:!1}}),_=new b({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfZGF0YV9kaXIlM0QlMjRJTlNUQU5DRV9ESVIlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJhJTIwcGhvdG8lMjBvZiUyMHNrcyUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNENDAw",highlighted:`accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --max_train_steps=400`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=U,e=p(),r(M.$$.fragment),h=p(),j=f("p"),j.innerHTML=R,g=p(),r(_.$$.fragment)},l(d){n=y(d,"P",{"data-svelte-h":!0}),u(n)!=="svelte-mfcvm5"&&(n.innerHTML=U),e=i(d),o(M.$$.fragment,d),h=i(d),j=y(d,"P",{"data-svelte-h":!0}),u(j)!=="svelte-1il13rm"&&(j.innerHTML=R),g=i(d),o(_.$$.fragment,d)},m(d,V){a(d,n,V),a(d,e,V),T(M,d,V),a(d,h,V),a(d,j,V),a(d,g,V),T(_,d,V),$=!0},p:F,i(d){$||(J(M.$$.fragment,d),J(_.$$.fragment,d),$=!0)},o(d){c(M.$$.fragment,d),c(_.$$.fragment,d),$=!1},d(d){d&&(s(n),s(e),s(h),s(j),s(g)),m(M,d),m(_,d)}}}function os(C){let n,U;return n=new Hl({props:{$$slots:{default:[rs]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p(e,M){const h={};M&2&&(h.$$scope={dirty:M,ctx:e}),n.$set(h)},i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function Ts(C){let n,U='TPU에 액세스할 수 있거나 더 빠르게 훈련하고 싶다면 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_flax.py" rel="nofollow">Flax 학습 스크립트</a>를 사용해 볼 수 있습니다. Flax 학습 스크립트는 gradient checkpointing 또는 gradient accumulation을 지원하지 않으므로, 메모리가 30GB 이상인 GPU가 필요합니다.',e,M,h="스크립트를 실행하기 전에 요구 사항이 설치되어 있는지 확인하십시오.",j,R,g,_,$="그러면 다음 명령어로 학습 스크립트를 실행시킬 수 있습니다:",d,V,N;return R=new b({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:"pip install -U -r requirements.txt",wrap:!1}}),V=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMnBhdGgtdG8taW5zdGFuY2UtaW1hZ2VzJTIyJTBBZXhwb3J0JTIwT1VUUFVUX0RJUiUzRCUyMnBhdGgtdG8tc2F2ZS1tb2RlbCUyMiUwQSUwQXB5dGhvbiUyMHRyYWluX2RyZWFtYm9vdGhfZmxheC5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9kYXRhX2RpciUzRCUyNElOU1RBTkNFX0RJUiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDVlLTYlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDQwMA==",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;duongna/stable-diffusion-v1-4-flax&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path-to-instance-images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

python train_dreambooth_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --learning_rate=5e-6 \\
  --max_train_steps=400`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=U,e=p(),M=f("p"),M.textContent=h,j=p(),r(R.$$.fragment),g=p(),_=f("p"),_.textContent=$,d=p(),r(V.$$.fragment)},l(w){n=y(w,"P",{"data-svelte-h":!0}),u(n)!=="svelte-oo4uis"&&(n.innerHTML=U),e=i(w),M=y(w,"P",{"data-svelte-h":!0}),u(M)!=="svelte-14at9et"&&(M.textContent=h),j=i(w),o(R.$$.fragment,w),g=i(w),_=y(w,"P",{"data-svelte-h":!0}),u(_)!=="svelte-t3rhu9"&&(_.textContent=$),d=i(w),o(V.$$.fragment,w)},m(w,Q){a(w,n,Q),a(w,e,Q),a(w,M,Q),a(w,j,Q),T(R,w,Q),a(w,g,Q),a(w,_,Q),a(w,d,Q),T(V,w,Q),N=!0},p:F,i(w){N||(J(R.$$.fragment,w),J(V.$$.fragment,w),N=!0)},o(w){c(R.$$.fragment,w),c(V.$$.fragment,w),N=!1},d(w){w&&(s(n),s(e),s(M),s(j),s(g),s(_),s(d)),m(R,w),m(V,w)}}}function Js(C){let n,U;return n=new Hl({props:{$$slots:{default:[Ts]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U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vbiUzRDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbnVtX2NsYXNzX2ltYWdlcyUzRDIwMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEODAw",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path_to_training_images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path_to_class_images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --num_class_images=200 \\
  --max_train_steps=800`,wrap:!1}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p:F,i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function ms(C){let n,U;return n=new Hl({props:{$$slots:{default:[cs]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p(e,M){const h={};M&2&&(h.$$scope={dirty:M,ctx:e}),n.$set(h)},i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function fs(C){let n,U;return n=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMnBhdGgtdG8taW5zdGFuY2UtaW1hZ2VzJTIyJTBBZXhwb3J0JTIwQ0xBU1NfRElSJTNEJTIycGF0aC10by1jbGFzcy1pbWFnZXMlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTBBJTBBcHl0aG9uJTIwdHJhaW5fZHJlYW1ib290aF9mbGF4LnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX2RhdGFfZGlyJTNEJTI0SU5TVEFOQ0VfRElSJTIwJTVDJTBBJTIwJTIwLS1jbGFzc19kYXRhX2RpciUzRCUyNENMQVNTX0RJUiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLWNsYXNzX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDVlLTYlMjAlNUMlMEElMjAlMjAtLW51bV9jbGFzc19pbWFnZXMlM0QyMDAlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDgwMA==",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;duongna/stable-diffusion-v1-4-flax&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path-to-instance-images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path-to-class-images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

python train_dreambooth_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --learning_rate=5e-6 \\
  --num_class_images=200 \\
  --max_train_steps=800`,wrap:!1}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p:F,i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function ys(C){let n,U;return n=new Hl({props:{$$slots:{default:[fs]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p(e,M){const h={};M&2&&(h.$$scope={dirty:M,ctx:e}),n.$set(h)},i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function us(C){let n,U="텍스트 인코더를 학습시키려면 추가 메모리가 필요해 16GB GPU로는 동작하지 않습니다. 이 옵션을 사용하려면 최소 24GB VRAM이 필요합니다.";return{c(){n=f("p"),n.textContent=U},l(e){n=y(e,"P",{"data-svelte-h":!0}),u(n)!=="svelte-5sbu2g"&&(n.textContent=U)},m(e,M){a(e,n,M)},p:F,d(e){e&&s(n)}}}function hs(C){let n,U;return n=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFleHBvcnQlMjBJTlNUQU5DRV9ESVIlM0QlMjJwYXRoX3RvX3RyYWluaW5nX2ltYWdlcyUyMiUwQWV4cG9ydCUyMENMQVNTX0RJUiUzRCUyMnBhdGhfdG9fY2xhc3NfaW1hZ2VzJTIyJTBBZXhwb3J0JTIwT1VUUFVUX0RJUiUzRCUyMnBhdGhfdG9fc2F2ZWRfbW9kZWwlMjIlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwdHJhaW5fZHJlYW1ib290aC5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTIwJTVDJTBBJTIwJTIwLS10cmFpbl90ZXh0X2VuY29kZXIlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX2RhdGFfZGlyJTNEJTI0SU5TVEFOQ0VfRElSJTIwJTVDJTBBJTIwJTIwLS1jbGFzc19kYXRhX2RpciUzRCUyNENMQVNTX0RJUiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLWNsYXNzX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tdXNlXzhiaXRfYWRhbSUwQSUyMCUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDJlLTYlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1udW1fY2xhc3NfaW1hZ2VzJTNEMjAwJTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0Q4MDA=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path_to_training_images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path_to_class_images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --train_text_encoder \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --use_8bit_adam
  --gradient_checkpointing \\
  --learning_rate=2e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --num_class_images=200 \\
  --max_train_steps=800`,wrap:!1}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p:F,i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function ds(C){let n,U;return n=new Hl({props:{$$slots:{default:[hs]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p(e,M){const h={};M&2&&(h.$$scope={dirty:M,ctx:e}),n.$set(h)},i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function ws(C){let n,U;return n=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMnBhdGgtdG8taW5zdGFuY2UtaW1hZ2VzJTIyJTBBZXhwb3J0JTIwQ0xBU1NfRElSJTNEJTIycGF0aC10by1jbGFzcy1pbWFnZXMlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTBBJTBBcHl0aG9uJTIwdHJhaW5fZHJlYW1ib290aF9mbGF4LnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlMjAlNUMlMEElMjAlMjAtLXRyYWluX3RleHRfZW5jb2RlciUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfZGF0YV9kaXIlM0QlMjRJTlNUQU5DRV9ESVIlMjAlNUMlMEElMjAlMjAtLWNsYXNzX2RhdGFfZGlyJTNEJTI0Q0xBU1NfRElSJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMCUyMC0td2l0aF9wcmlvcl9wcmVzZXJ2YXRpb24lMjAtLXByaW9yX2xvc3Nfd2VpZ2h0JTNEMS4wJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJhJTIwcGhvdG8lMjBvZiUyMHNrcyUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNEMmUtNiUyMCU1QyUwQSUyMCUyMC0tbnVtX2NsYXNzX2ltYWdlcyUzRDIwMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEODAw",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;duongna/stable-diffusion-v1-4-flax&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path-to-instance-images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path-to-class-images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

python train_dreambooth_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --train_text_encoder \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --learning_rate=2e-6 \\
  --num_class_images=200 \\
  --max_train_steps=800`,wrap:!1}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p:F,i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function Cs(C){let n,U;return n=new Hl({props:{$$slots:{default:[ws]},$$scope:{ctx:C}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p(e,M){const h={};M&2&&(h.$$scope={dirty:M,ctx:e}),n.$set(h)},i(e){U||(J(n.$$.fragment,e),U=!0)},o(e){c(n.$$.fragment,e),U=!1},d(e){m(n,e)}}}function bs(C){let n,U,e,M,h,j,R,g='<a href="https://arxiv.org/abs/2208.12242" rel="nofollow">DreamBooth</a>는 한 주제에 대한 적은 이미지(3~5개)만으로도 stable diffusion과 같이 text-to-image 모델을 개인화할 수 있는 방법입니다. 이를 통해 모델은 다양한 장면, 포즈 및 장면(뷰)에서 피사체에 대해 맥락화(contextualized)된 이미지를 생성할 수 있습니다.',_,$,d='<img src="https://dreambooth.github.io/DreamBooth_files/teaser_static.jpg" alt="프로젝트 블로그에서의 DreamBooth 예시"/>',V,N,w='에서의 Dreambooth 예시 <a href="https://dreambooth.github.io">project&#39;s blog.</a>',Q,S,ce='이 가이드는 다양한 GPU, Flax 사양에 대해 <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" rel="nofollow"><code>CompVis/stable-diffusion-v1-4</code></a> 모델로 DreamBooth를 파인튜닝하는 방법을 보여줍니다. 더 깊이 파고들어 작동 방식을 확인하는 데 관심이 있는 경우, 이 가이드에 사용된 DreamBooth의 모든 학습 스크립트를 <a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth" rel="nofollow">여기</a>에서 찾을 수 있습니다.',ql,W,me="스크립트를 실행하기 전에 라이브러리의 학습에 필요한 dependencies를 설치해야 합니다. 또한 <code>main</code> GitHub 브랜치에서 🧨 Diffusers를 설치하는 것이 좋습니다.",Pl,v,Kl,x,fe='xFormers는 학습에 필요한 요구 사항은 아니지만, 가능하면 <a href="../optimization/xformers">설치</a>하는 것이 좋습니다. 학습 속도를 높이고 메모리 사용량을 줄일 수 있기 때문입니다.',lt,D,ye='모든 dependencies을 설정한 후 다음을 사용하여 <a href="https://github.com/huggingface/accelerate/" rel="nofollow">🤗 Accelerate</a> 환경을 다음과 같이 초기화합니다:',tt,A,et,Y,ue="별도 설정 없이 기본 🤗 Accelerate 환경을 설치하려면 다음을 실행합니다:",st,L,at,k,he="또는 현재 환경이 노트북과 같은 대화형 셸을 지원하지 않는 경우 다음을 사용할 수 있습니다:",nt,z,pt,H,it,E,Ut,B,Mt,O,rt,q,de='과적합과 language drift를 방지하기 위해 사전 보존이 사용됩니다(관심이 있는 경우 <a href="https://arxiv.org/abs/2208.12242" rel="nofollow">논문</a>을 참조하세요).  사전 보존을 위해 동일한 클래스의 다른 이미지를 학습 프로세스의 일부로 사용합니다. 좋은 점은 Stable Diffusion 모델 자체를 사용하여 이러한 이미지를 생성할 수 있다는 것입니다! 학습 스크립트는 생성된 이미지를 우리가 지정한 로컬 경로에 저장합니다.',ot,P,we="저자들에 따르면 사전 보존을 위해 <code>num_epochs * num_samples</code>개의 이미지를 생성하는 것이 좋습니다. 200-300개에서 대부분 잘 작동합니다.",Tt,X,Jt,K,ct,ll,Ce='해당 스크립트를 사용하면 <code>unet</code>과 함께 <code>text_encoder</code>를 파인튜닝할 수 있습니다. 실험에서(자세한 내용은 <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">🧨 Diffusers를 사용해 DreamBooth로 Stable Diffusion 학습하기</a> 게시물을 확인하세요), 특히 얼굴 이미지를 생성할 때 훨씬 더 나은 결과를 얻을 수 있습니다.',mt,Z,ft,tl,be="<code>--train_text_encoder</code> 인수를 학습 스크립트에 전달하여 <code>text_encoder</code> 및 <code>unet</code>을 파인튜닝할 수 있습니다:",yt,G,ut,el,ht,sl,_e='DreamBooth에서 대규모 모델의 학습을 가속화하기 위한 파인튜닝 기술인 LoRA(Low-Rank Adaptation of Large Language Models)를 사용할 수 있습니다. 자세한 내용은 <a href="training/lora#dreambooth">LoRA 학습</a> 가이드를 참조하세요.',dt,al,wt,nl,Ve="Dreambooth로 훈련하는 동안 과적합하기 쉬우므로, 때때로 학습 중에 정기적인 체크포인트를 저장하는 것이 유용합니다. 중간 체크포인트 중 하나가 최종 모델보다 더 잘 작동할 수 있습니다! 체크포인트 저장 기능을 활성화하려면 학습 스크립트에 다음 인수를 전달해야 합니다:",Ct,pl,bt,il,Re="이렇게 하면 <code>output_dir</code>의 하위 폴더에 전체 학습 상태가 저장됩니다. 하위 폴더 이름은 접두사 <code>checkpoint-</code>로 시작하고 지금까지 수행된 step 수입니다. 예시로 <code>checkpoint-1500</code>은 1500 학습 step 후에 저장된 체크포인트입니다.",_t,Ul,Vt,Ml,je="저장된 체크포인트에서 훈련을 재개하려면, <code>--resume_from_checkpoint</code> 인수를 전달한 다음 사용할 체크포인트의 이름을 지정하면 됩니다. 특수 문자열 <code>&quot;latest&quot;</code>를 사용하여 저장된 마지막 체크포인트(즉, step 수가 가장 많은 체크포인트)에서 재개할 수도 있습니다. 예를 들어 다음은 1500 step 후에 저장된 체크포인트에서부터 학습을 재개합니다:",Rt,rl,jt,ol,$e="원하는 경우 일부 하이퍼파라미터를 조정할 수 있습니다.",$t,Tl,It,Jl,Ie="저장된 체크포인트는 훈련 재개에 적합한 형식으로 저장됩니다. 여기에는 모델 가중치뿐만 아니라 옵티마이저, 데이터 로더 및 학습률의 상태도 포함됩니다.",Qt,cl,Qe="<strong><code>&quot;accelerate&gt;=0.16.0&quot;</code></strong>이 설치된 경우 다음 코드를 사용하여 중간 체크포인트에서 추론을 실행합니다.",gt,ml,Nt,fl,ge="If you have <strong><code>&quot;accelerate&lt;0.16.0&quot;</code></strong> installed, you need to convert it to an inference pipeline first:",Et,yl,Bt,ul,Xt,hl,Ne="하드웨어에 따라 16GB에서 8GB까지 GPU에서 DreamBooth를 최적화하는 몇 가지 방법이 있습니다!",Zt,dl,Gt,wl,Ee='<a href="https://github.com/facebookresearch/xformers" rel="nofollow">xFormers</a>는 Transformers를 최적화하기 위한 toolbox이며, 🧨 Diffusers에서 사용되는<a href="https://facebookresearch.github.io/xformers/components/ops.html#module-xformers.ops" rel="nofollow">memory-efficient attention</a>  메커니즘을 포함하고 있습니다. <a href="./optimization/xformers">xFormers를 설치</a>한 다음 학습 스크립트에 다음 인수를 추가합니다:',Ft,Cl,St,bl,Be="xFormers는 Flax에서 사용할 수 없습니다.",Wt,_l,vt,Vl,Xe='메모리 사용량을 줄일 수 있는 또 다른 방법은 <a href="https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html" rel="nofollow">기울기 설정</a>을 0 대신 <code>None</code>으로 하는 것입니다. 그러나 이로 인해 특정 동작이 변경될 수 있으므로 문제가 발생하면 이 인수를 제거해 보십시오. 학습 스크립트에 다음 인수를 추가하여 그래디언트를 <code>None</code>으로 설정합니다.',xt,Rl,Dt,jl,At,$l,Ze='Gradient checkpointing과 <a href="https://github.com/TimDettmers/bitsandbytes" rel="nofollow">bitsandbytes</a>의 8비트 옵티마이저의 도움으로, 16GB GPU에서 dreambooth를 훈련할 수 있습니다. bitsandbytes가 설치되어 있는지 확인하세요:',Yt,Il,Lt,Ql,Ge="그 다음, 학습 스크립트에 <code>--use_8bit_adam</code> 옵션을 명시합니다:",kt,gl,zt,Nl,Ht,El,Fe="12GB GPU에서 DreamBooth를 실행하려면 gradient checkpointing, 8비트 옵티마이저, xFormers를 활성화하고 그래디언트를 <code>None</code>으로 설정해야 합니다.",Ot,Bl,qt,Xl,Pt,Zl,Se='8GB GPU에 대해서는 <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a>를 사용해 일부 텐서를 VRAM에서 CPU 또는 NVME로 오프로드하여 더 적은 GPU 메모리로 학습할 수도 있습니다.',Kt,Gl,We="🤗 Accelerate 환경을 구성하려면 다음 명령을 실행하세요:",le,Fl,te,Sl,ve=`환경 구성 중에 DeepSpeed를 사용할 것을 확인하세요.
그러면 DeepSpeed stage 2, fp16 혼합 정밀도를 결합하고 모델 매개변수와 옵티마이저 상태를 모두 CPU로 오프로드하면 8GB VRAM 미만에서 학습할 수 있습니다.
단점은 더 많은 시스템 RAM(약 25GB)이 필요하다는 것입니다. 추가 구성 옵션은 <a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">DeepSpeed 문서</a>를 참조하세요.`,ee,Wl,xe=`또한 기본 Adam 옵티마이저를 DeepSpeed의 최적화된 Adam 버전으로 변경해야 합니다.
이는 상당한 속도 향상을 위한 Adam인 <a href="https://deepspeed.readthedocs.io/en/latest/optimizers.html#adam-cpu" rel="nofollow"><code>deepspeed.ops.adam.DeepSpeedCPUAdam</code></a>입니다.
<code>DeepSpeedCPUAdam</code>을 활성화하려면 시스템의 CUDA toolchain 버전이 PyTorch와 함께 설치된 것과 동일해야 합니다.`,se,vl,De="8비트 옵티마이저는 현재 DeepSpeed와 호환되지 않는 것 같습니다.",ae,xl,Ae="다음 명령으로 학습을 시작합니다:",ne,Dl,pe,Al,ie,Yl,Ye="모델을 학습한 후에는, 모델이 저장된 경로를 지정해 <code>StableDiffusionPipeline</code>로 추론을 수행할 수 있습니다. 프롬프트에 학습에 사용된 특수 <code>식별자</code>(이전 예시의 <code>sks</code>)가 포함되어 있는지 확인하세요.",Ue,Ll,Le="<strong><code>&quot;accelerate&gt;=0.16.0&quot;</code></strong>이 설치되어 있는 경우 다음 코드를 사용하여 중간 체크포인트에서 추론을 실행할 수 있습니다:",Me,kl,re,zl,ke='<a href="#inference-from-a-saved-checkpoint">저장된 학습 체크포인트</a>에서도 추론을 실행할 수도 있습니다.',oe,Ol,Te;return h=new I({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h1"}}),v=new b({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC1VJTIwLXIlMjBkaWZmdXNlcnMlMkZleGFtcGxlcyUyRmRyZWFtYm9vdGglMkZyZXF1aXJlbWVudHMudHh0",highlighted:`pip install git+https://github.com/huggingface/diffusers
pip install -U -r diffusers/examples/dreambooth/requirements.txt`,wrap:!1}}),A=new b({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),L=new b({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),z=new b({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}}),H=new I({props:{title:"파인튜닝",local:"파인튜닝",headingTag:"h2"}}),E=new ts({props:{warning:!0,$$slots:{default:[Ms]},$$scope:{ctx:C}}}),B=new Je({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[Js],pytorch:[os]},$$scope:{ctx:C}}}),O=new I({props:{title:"Prior-preserving(사전 보존) loss를 사용한 파인튜닝",local:"prior-preserving사전-보존-loss를-사용한-파인튜닝",headingTag:"h3"}}),X=new Je({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[ys],pytorch:[ms]},$$scope:{ctx:C}}}),K=new I({props:{title:"텍스트 인코더와 and UNet로 파인튜닝하기",local:"텍스트-인코더와-and-unet로-파인튜닝하기",headingTag:"h2"}}),Z=new ts({props:{warning:!0,$$slots:{default:[us]},$$scope:{ctx:C}}}),G=new Je({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[Cs],pytorch:[ds]},$$scope:{ctx:C}}}),el=new I({props:{title:"LoRA로 파인튜닝하기",local:"lora로-파인튜닝하기",headingTag:"h2"}}),al=new I({props:{title:"학습 중 체크포인트 저장하기",local:"학습-중-체크포인트-저장하기",headingTag:"h3"}}),pl=new b({props:{code:"JTIwJTIwLS1jaGVja3BvaW50aW5nX3N0ZXBzJTNENTAw",highlighted:"  --checkpointing_steps=500",wrap:!1}}),Ul=new I({props:{title:"저장된 체크포인트에서 훈련 재개하기",local:"저장된-체크포인트에서-훈련-재개하기",headingTag:"h4"}}),rl=new b({props:{code:"JTIwJTIwLS1yZXN1bWVfZnJvbV9jaGVja3BvaW50JTNEJTIyY2hlY2twb2ludC0xNTAwJTIy",highlighted:'  --resume_from_checkpoint=<span class="hljs-string">&quot;checkpoint-1500&quot;</span>',wrap:!1}}),Tl=new I({props:{title:"저장된 체크포인트를 사용하여 추론 수행하기",local:"저장된-체크포인트를-사용하여-추론-수행하기",headingTag:"h4"}}),ml=new b({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVs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TlBJTk0JTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwQ0xJUFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyJTJGc2RkYXRhJTJGZHJlYW1ib290aCUyRmRhcnVtYS12Mi0xJTJGY2hlY2twb2ludC0xMDAlMkZ0ZXh0X2VuY29kZXIlMjIpJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB1bmV0JTNEdW5ldCUyQyUyMHRleHRfZW5jb2RlciUzRHRleHRfZW5jb2RlciUyQyUyMGR0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMCVFQyVCNiU5NCVFQiVBMSVBMCVFQyU5RCU4NCUyMCVFQyU4OCU5OCVFRCU5NiU4OSVFRCU5NSU5OCVFQSVCMSVCMCVFQiU4MiU5OCUyMCVFQyVBMCU4MCVFQyU5RSVBNSVFRCU5NSU5OCVFQSVCMSVCMCVFQiU4MiU5OCUyQyUyMCVFRCU5NyU4OCVFQiVCOCU4QyVFQyU5NyU5MCUyMCVFRCU5MSVCOCVFQyU4QiU5QyVFRCU5NSVBOSVFQiU4QiU4OCVFQiU4QiVBNC4lMEFwaXBlbGluZS5zYXZlX3ByZXRyYWluZWQoJTIyZHJlYW1ib290aC1waXBlbGluZSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, UNet2DConditionModel
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextModel
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># 학습에 사용된 것과 동일한 인수(model, revision)로 파이프라인을 불러옵니다.</span>
model_id = <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>

unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">&quot;/sddata/dreambooth/daruma-v2-1/checkpoint-100/unet&quot;</span>)

<span class="hljs-comment"># \`args.train_text_encoder\`로 학습한 경우면 텍스트 인코더를 꼭 불러오세요</span>
text_encoder = CLIPTextModel.from_pretrained(<span class="hljs-string">&quot;/sddata/dreambooth/daruma-v2-1/checkpoint-100/text_encoder&quot;</span>)

pipeline = DiffusionPipeline.from_pretrained(model_id, unet=unet, text_encoder=text_encoder, dtype=torch.float16)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># 추론을 수행하거나 저장하거나, 허브에 푸시합니다.</span>
pipeline.save_pretrained(<span class="hljs-string">&quot;dreambooth-pipeline&quot;</span>)`,wrap:!1}}),yl=new b({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBEaWZmdXNpb25QaXBlbGluZSUwQSUwQSUyMyUyMCVFRCU5NSU5OSVFQyU4QSVCNSVFQyU5NyU5MCUyMCVFQyU4MiVBQyVFQyU5QSVBOSVFQiU5MCU5QyUyMCVFQSVCMiU4MyVFQSVCMyVCQyUyMCVFQiU4RiU5OSVFQyU5RCVCQyVFRCU5NSU5QyUyMCVFQyU5RCVCOCVFQyU4OCU5OChtb2RlbCUyQyUyMHJldmlzaW9uKSVFQiVBMSU5QyUyMCVFRCU4QyU4QyVFQyU5RCVCNCVFRCU5NCU4NCVFQiU5RCVCQyVFQyU5RCVCOCVFQyU5RCU4NCUyMCVFQiVCNiU4OCVFQiU5RiVBQyVFQyU5OCVCNSVFQiU4QiU4OCVFQiU4QiVBNC4lMEFtb2RlbF9pZCUyMCUzRCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFj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TElOUMlMjAlRUQlOEMlOEMlRUMlOUQlQjQlRUQlOTQlODQlRUIlOUQlQkMlRUMlOUQlQjglRUMlOUQlODQlMjAlRUIlOEIlQTQlRUMlOEIlOUMlMjAlRUIlQjklOEMlRUIlOTMlOUMlRUQlOTUlQTklRUIlOEIlODglRUIlOEIlQTQuKC51bmV0JTIwYW5kJTIwLnRleHRfZW5jb2RlciVFQiVBMSU5QyVFQyU5RCU5OCUyMCVFRCU5NSVBMCVFQiU4QiVCOSVFQiU4RiU4NCUyMCVFQyU5RSU5MSVFQiU4RiU5OSVFRCU5NSVCNCVFQyU5NSVCQyUyMCVFRCU5NSVBOSVFQiU4QiU4OCVFQiU4QiVBNCklMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUwQSUyMCUyMCUyMCUyMHVuZXQlM0RhY2NlbGVyYXRvci51bndyYXBfbW9kZWwodW5ldCklMkMlMEElMjAlMjAlMjAlMjB0ZXh0X2VuY29kZXIlM0RhY2NlbGVyYXRvci51bndyYXBfbW9kZWwodGV4dF9lbmNvZGVyKSUyQyUwQSklMEElMEElMjMlMjAlRUMlQjYlOTQlRUIlQTElQTAlRUMlOUQlODQlMjAlRUMlODglOTglRUQlOTYlODklRUQlOTUlOTglRUElQjElQjAlRUIlODIlOTglMjAlRUMlQTAlODAlRUMlOUUlQTUlRUQlOTUlOTglRUElQjElQjAlRUIlODIlOTglMkMlMjAlRUQlOTclODglRUIlQjglOEMlRUMlOTclOTAlMjAlRUQlOTElQjglRUMlOEIlOUMlRUQlOTUlQTklRUIlOEIlODglRUIlOEIlQTQuJTBBcGlwZWxpbmUuc2F2ZV9wcmV0cmFpbmVkKCUyMmRyZWFtYm9vdGgtcGlwZWxpbmUlMjIp",highlighted:`<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># 학습에 사용된 것과 동일한 인수(model, revision)로 파이프라인을 불러옵니다.</span>
model_id = <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
pipeline = DiffusionPipeline.from_pretrained(model_id)

accelerator = Accelerator()

<span class="hljs-comment"># 초기 학습에 \`--train_text_encoder\`가 사용된 경우 text_encoder를 사용합니다.</span>
unet, text_encoder = accelerator.prepare(pipeline.unet, pipeline.text_encoder)

<span class="hljs-comment"># 체크포인트 경로로부터 상태를 복원합니다. 여기서는 절대 경로를 사용해야 합니다.</span>
accelerator.load_state(<span class="hljs-string">&quot;/sddata/dreambooth/daruma-v2-1/checkpoint-100&quot;</span>)

<span class="hljs-comment"># unwrapped 모델로 파이프라인을 다시 빌드합니다.(.unet and .text_encoder로의 할당도 작동해야 합니다)</span>
pipeline = DiffusionPipeline.from_pretrained(
    model_id,
    unet=accelerator.unwrap_model(unet),
    text_encoder=accelerator.unwrap_model(text_encoder),
)

<span class="hljs-comment"># 추론을 수행하거나 저장하거나, 허브에 푸시합니다.</span>
pipeline.save_pretrained(<span class="hljs-string">&quot;dreambooth-pipeline&quot;</span>)`,wrap:!1}}),ul=new I({props:{title:"각 GPU 용량에서의 최적화",local:"각-gpu-용량에서의-최적화",headingTag:"h2"}}),dl=new I({props:{title:"xFormers",local:"xformers",headingTag:"h3"}}),Cl=new b({props:{code:"JTIwJTIwLS1lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24=",highlighted:"  --enable_xformers_memory_efficient_attention",wrap:!1}}),_l=new I({props:{title:"그래디언트 없음으로 설정",local:"그래디언트-없음으로-설정",headingTag:"h3"}}),Rl=new b({props:{code:"JTIwJTIwLS1zZXRfZ3JhZHNfdG9fbm9uZQ==",highlighted:"  --set_grads_to_none",wrap:!1}}),jl=new I({props:{title:"16GB GPU",local:"16gb-gpu",headingTag:"h3"}}),Il=new b({props:{code:"cGlwJT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ElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDIlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbnVtX2NsYXNzX2ltYWdlcyUzRDIwMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEODAw",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path_to_training_images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path_to_class_images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=2 --gradient_checkpointing \\
  --use_8bit_adam \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --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S10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tdXNlXzhiaXRfYWRhbSUyMCU1QyUwQSUyMCUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwJTIwLS1zZXRfZ3JhZHNfdG9fbm9uZSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDJlLTYlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1udW1fY2xhc3NfaW1hZ2VzJTNEMjAwJTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0Q4MDA=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path-to-instance-images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path-to-class-images&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_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 --gradient_checkpointing \\
  --use_8bit_adam \\
  --enable_xformers_memory_efficient_attention \\
  --set_grads_to_none \\
  --learning_rate=2e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --num_class_images=200 \\
  --max_train_steps=800`,wrap:!1}}),Xl=new I({props:{title:"8GB GPU에서 학습하기",local:"8gb-gpu에서-학습하기",headingTag:"h3"}}),Fl=new b({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Dl=new b({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFleHBvcnQlMjBJTlNUQU5DRV9ESVIlM0QlMjJwYXRoX3RvX3RyYWluaW5nX2ltYWdlcyUyMiUwQWV4cG9ydCUyMENMQVNTX0RJUiUzRCUyMnBhdGhfdG9fY2xhc3NfaW1hZ2VzJTIyJTBBZXhwb3J0JTIwT1VUUFVUX0RJUiUzRCUyMnBhdGhfdG9fc2F2ZWRfbW9kZWwlMjIlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwdHJhaW5fZHJlYW1ib290aC5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9kYXRhX2RpciUzRCUyNElOU1RBTkNFX0RJUiUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfZGF0YV9kaXIlM0QlMjRDTEFTU19ESVIlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwJTIwLS13aXRoX3ByaW9yX3ByZXNlcnZhdGlvbiUyMC0tcHJpb3JfbG9zc193ZWlnaHQlM0QxLjAlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1jbGFzc19wcm9tcHQlM0QlMjJhJTIwcGhvdG8lMjBvZiUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLXNhbXBsZV9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDVlLTYlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1udW1fY2xhc3NfaW1hZ2VzJTNEMjAwJTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0Q4MDAlMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRGZwMTY=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path_to_training_images&quot;</span>
<span class="hljs-built_in">export</span> CLASS_DIR=<span class="hljs-string">&quot;path_to_class_images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --class_data_dir=<span class="hljs-variable">$CLASS_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --with_prior_preservation --prior_loss_weight=1.0 \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;a photo of dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --sample_batch_size=1 \\
  --gradient_accumulation_steps=1 --gradient_checkpointing \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --num_class_images=200 \\
  --max_train_steps=800 \\
  --mixed_precision=fp16`,wrap:!1}}),Al=new I({props:{title:"추론",local:"추론",headingTag:"h2"}}),kl=new b({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnBhdGhfdG9fc2F2ZWRfbW9kZWwlMjIlMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIwaW4lMjBhJTIwYnVja2V0JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENy41KS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjJkb2ctYnVja2V0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;path_to_saved_model&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>
image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){n=f("meta"),U=p(),e=f("p"),M=p(),r(h.$$.fragment),j=p(),R=f("p"),R.innerHTML=g,_=p(),$=f("p"),$.innerHTML=d,V=p(),N=f("small"),N.innerHTML=w,Q=p(),S=f("p"),S.innerHTML=ce,ql=p(),W=f("p"),W.innerHTML=me,Pl=p(),r(v.$$.fragment),Kl=p(),x=f("p"),x.innerHTML=fe,lt=p(),D=f("p"),D.innerHTML=ye,tt=p(),r(A.$$.fragment),et=p(),Y=f("p"),Y.textContent=ue,st=p(),r(L.$$.fragment),at=p(),k=f("p"),k.textContent=he,nt=p(),r(z.$$.fragment),pt=p(),r(H.$$.fragment),it=p(),r(E.$$.fragment),Ut=p(),r(B.$$.fragment),Mt=p(),r(O.$$.fragment),rt=p(),q=f("p"),q.innerHTML=de,ot=p(),P=f("p"),P.innerHTML=we,Tt=p(),r(X.$$.fragment),Jt=p(),r(K.$$.fragment),ct=p(),ll=f("p"),ll.innerHTML=Ce,mt=p(),r(Z.$$.fragment),ft=p(),tl=f("p"),tl.innerHTML=be,yt=p(),r(G.$$.fragment),ut=p(),r(el.$$.fragment),ht=p(),sl=f("p"),sl.innerHTML=_e,dt=p(),r(al.$$.fragment),wt=p(),nl=f("p"),nl.textContent=Ve,Ct=p(),r(pl.$$.fragment),bt=p(),il=f("p"),il.innerHTML=Re,_t=p(),r(Ul.$$.fragment),Vt=p(),Ml=f("p"),Ml.innerHTML=je,Rt=p(),r(rl.$$.fragment),jt=p(),ol=f("p"),ol.textContent=$e,$t=p(),r(Tl.$$.fragment),It=p(),Jl=f("p"),Jl.textContent=Ie,Qt=p(),cl=f("p"),cl.innerHTML=Qe,gt=p(),r(ml.$$.fragment),Nt=p(),fl=f("p"),fl.innerHTML=ge,Et=p(),r(yl.$$.fragment),Bt=p(),r(ul.$$.fragment),Xt=p(),hl=f("p"),hl.textContent=Ne,Zt=p(),r(dl.$$.fragment),Gt=p(),wl=f("p"),wl.innerHTML=Ee,Ft=p(),r(Cl.$$.fragment),St=p(),bl=f("p"),bl.textContent=Be,Wt=p(),r(_l.$$.fragment),vt=p(),Vl=f("p"),Vl.innerHTML=Xe,xt=p(),r(Rl.$$.fragment),Dt=p(),r(jl.$$.fragment),At=p(),$l=f("p"),$l.innerHTML=Ze,Yt=p(),r(Il.$$.fragment),Lt=p(),Ql=f("p"),Ql.innerHTML=Ge,kt=p(),r(gl.$$.fragment),zt=p(),r(Nl.$$.fragment),Ht=p(),El=f("p"),El.innerHTML=Fe,Ot=p(),r(Bl.$$.fragment),qt=p(),r(Xl.$$.fragment),Pt=p(),Zl=f("p"),Zl.innerHTML=Se,Kt=p(),Gl=f("p"),Gl.textContent=We,le=p(),r(Fl.$$.fragment),te=p(),Sl=f("p"),Sl.innerHTML=ve,ee=p(),Wl=f("p"),Wl.innerHTML=xe,se=p(),vl=f("p"),vl.textContent=De,ae=p(),xl=f("p"),xl.textContent=Ae,ne=p(),r(Dl.$$.fragment),pe=p(),r(Al.$$.fragment),ie=p(),Yl=f("p"),Yl.innerHTML=Ye,Ue=p(),Ll=f("p"),Ll.innerHTML=Le,Me=p(),r(kl.$$.fragment),re=p(),zl=f("p"),zl.innerHTML=ke,oe=p(),Ol=f("p"),this.h()},l(l){const t=ps("svelte-u9bgzb",document.head);n=y(t,"META",{name:!0,content:!0}),t.forEach(s),U=i(l),e=y(l,"P",{}),Ke(e).forEach(s),M=i(l),o(h.$$.fragment,l),j=i(l),R=y(l,"P",{"data-svelte-h":!0}),u(R)!=="svelte-1j9768g"&&(R.innerHTML=g),_=i(l),$=y(l,"P",{"data-svelte-h":!0}),u($)!=="svelte-1kn2nxe"&&($.innerHTML=d),V=i(l),N=y(l,"SMALL",{"data-svelte-h":!0}),u(N)!=="svelte-pvgijy"&&(N.innerHTML=w),Q=i(l),S=y(l,"P",{"data-svelte-h":!0}),u(S)!=="svelte-zzw22q"&&(S.innerHTML=ce),ql=i(l),W=y(l,"P",{"data-svelte-h":!0}),u(W)!=="svelte-ge4j3j"&&(W.innerHTML=me),Pl=i(l),o(v.$$.fragment,l),Kl=i(l),x=y(l,"P",{"data-svelte-h":!0}),u(x)!=="svelte-1i91gkn"&&(x.innerHTML=fe),lt=i(l),D=y(l,"P",{"data-svelte-h":!0}),u(D)!=="svelte-1eihpxk"&&(D.innerHTML=ye),tt=i(l),o(A.$$.fragment,l),et=i(l),Y=y(l,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-1f2hl18"&&(Y.textContent=ue),st=i(l),o(L.$$.fragment,l),at=i(l),k=y(l,"P",{"data-svelte-h":!0}),u(k)!=="svelte-1d1ptkt"&&(k.textContent=he),nt=i(l),o(z.$$.fragment,l),pt=i(l),o(H.$$.fragment,l),it=i(l),o(E.$$.fragment,l),Ut=i(l),o(B.$$.fragment,l),Mt=i(l),o(O.$$.fragment,l),rt=i(l),q=y(l,"P",{"data-svelte-h":!0}),u(q)!=="svelte-1ut2fbw"&&(q.innerHTML=de),ot=i(l),P=y(l,"P",{"data-svelte-h":!0}),u(P)!=="svelte-err38i"&&(P.innerHTML=we),Tt=i(l),o(X.$$.fragment,l),Jt=i(l),o(K.$$.fragment,l),ct=i(l),ll=y(l,"P",{"data-svelte-h":!0}),u(ll)!=="svelte-sj6d0j"&&(ll.innerHTML=Ce),mt=i(l),o(Z.$$.fragment,l),ft=i(l),tl=y(l,"P",{"data-svelte-h":!0}),u(tl)!=="svelte-u7f6lc"&&(tl.innerHTML=be),yt=i(l),o(G.$$.fragment,l),ut=i(l),o(el.$$.fragment,l),ht=i(l),sl=y(l,"P",{"data-svelte-h":!0}),u(sl)!=="svelte-11xlfgf"&&(sl.innerHTML=_e),dt=i(l),o(al.$$.fragment,l),wt=i(l),nl=y(l,"P",{"data-svelte-h":!0}),u(nl)!=="svelte-1nrdgkj"&&(nl.textContent=Ve),Ct=i(l),o(pl.$$.fragment,l),bt=i(l),il=y(l,"P",{"data-svelte-h":!0}),u(il)!=="svelte-t10p74"&&(il.innerHTML=Re),_t=i(l),o(Ul.$$.fragment,l),Vt=i(l),Ml=y(l,"P",{"data-svelte-h":!0}),u(Ml)!=="svelte-hg3lj6"&&(Ml.innerHTML=je),Rt=i(l),o(rl.$$.fragment,l),jt=i(l),ol=y(l,"P",{"data-svelte-h":!0}),u(ol)!=="svelte-1k5w6f5"&&(ol.textContent=$e),$t=i(l),o(Tl.$$.fragment,l),It=i(l),Jl=y(l,"P",{"data-svelte-h":!0}),u(Jl)!=="svelte-1uf2dye"&&(Jl.textContent=Ie),Qt=i(l),cl=y(l,"P",{"data-svelte-h":!0}),u(cl)!=="svelte-3mqope"&&(cl.innerHTML=Qe),gt=i(l),o(ml.$$.fragment,l),Nt=i(l),fl=y(l,"P",{"data-svelte-h":!0}),u(fl)!=="svelte-10s7sps"&&(fl.innerHTML=ge),Et=i(l),o(yl.$$.fragment,l),Bt=i(l),o(ul.$$.fragment,l),Xt=i(l),hl=y(l,"P",{"data-svelte-h":!0}),u(hl)!=="svelte-30mzs2"&&(hl.textContent=Ne),Zt=i(l),o(dl.$$.fragment,l),Gt=i(l),wl=y(l,"P",{"data-svelte-h":!0}),u(wl)!=="svelte-1nxj09"&&(wl.innerHTML=Ee),Ft=i(l),o(Cl.$$.fragment,l),St=i(l),bl=y(l,"P",{"data-svelte-h":!0}),u(bl)!=="svelte-60g0k7"&&(bl.textContent=Be),Wt=i(l),o(_l.$$.fragment,l),vt=i(l),Vl=y(l,"P",{"data-svelte-h":!0}),u(Vl)!=="svelte-1ev0obn"&&(Vl.innerHTML=Xe),xt=i(l),o(Rl.$$.fragment,l),Dt=i(l),o(jl.$$.fragment,l),At=i(l),$l=y(l,"P",{"data-svelte-h":!0}),u($l)!=="svelte-1tivb9a"&&($l.innerHTML=Ze),Yt=i(l),o(Il.$$.fragment,l),Lt=i(l),Ql=y(l,"P",{"data-svelte-h":!0}),u(Ql)!=="svelte-g5qzqy"&&(Ql.innerHTML=Ge),kt=i(l),o(gl.$$.fragment,l),zt=i(l),o(Nl.$$.fragment,l),Ht=i(l),El=y(l,"P",{"data-svelte-h":!0}),u(El)!=="svelte-3vgf1l"&&(El.innerHTML=Fe),Ot=i(l),o(Bl.$$.fragment,l),qt=i(l),o(Xl.$$.fragment,l),Pt=i(l),Zl=y(l,"P",{"data-svelte-h":!0}),u(Zl)!=="svelte-5o0gew"&&(Zl.innerHTML=Se),Kt=i(l),Gl=y(l,"P",{"data-svelte-h":!0}),u(Gl)!=="svelte-1n86m0z"&&(Gl.textContent=We),le=i(l),o(Fl.$$.fragment,l),te=i(l),Sl=y(l,"P",{"data-svelte-h":!0}),u(Sl)!=="svelte-1n79apf"&&(Sl.innerHTML=ve),ee=i(l),Wl=y(l,"P",{"data-svelte-h":!0}),u(Wl)!=="svelte-1pwvqjp"&&(Wl.innerHTML=xe),se=i(l),vl=y(l,"P",{"data-svelte-h":!0}),u(vl)!=="svelte-1cxr4jn"&&(vl.textContent=De),ae=i(l),xl=y(l,"P",{"data-svelte-h":!0}),u(xl)!=="svelte-17vtgpw"&&(xl.textContent=Ae),ne=i(l),o(Dl.$$.fragment,l),pe=i(l),o(Al.$$.fragment,l),ie=i(l),Yl=y(l,"P",{"data-svelte-h":!0}),u(Yl)!=="svelte-1p7w8lw"&&(Yl.innerHTML=Ye),Ue=i(l),Ll=y(l,"P",{"data-svelte-h":!0}),u(Ll)!=="svelte-105ywuc"&&(Ll.innerHTML=Le),Me=i(l),o(kl.$$.fragment,l),re=i(l),zl=y(l,"P",{"data-svelte-h":!0}),u(zl)!=="svelte-17mzaw8"&&(zl.innerHTML=ke),oe=i(l),Ol=y(l,"P",{}),Ke(Ol).forEach(s),this.h()},h(){ls(n,"name","hf:doc:metadata"),ls(n,"content",_s)},m(l,t){is(document.head,n),a(l,U,t),a(l,e,t),a(l,M,t),T(h,l,t),a(l,j,t),a(l,R,t),a(l,_,t),a(l,$,t),a(l,V,t),a(l,N,t),a(l,Q,t),a(l,S,t),a(l,ql,t),a(l,W,t),a(l,Pl,t),T(v,l,t),a(l,Kl,t),a(l,x,t),a(l,lt,t),a(l,D,t),a(l,tt,t),T(A,l,t),a(l,et,t),a(l,Y,t),a(l,st,t),T(L,l,t),a(l,at,t),a(l,k,t),a(l,nt,t),T(z,l,t),a(l,pt,t),T(H,l,t),a(l,it,t),T(E,l,t),a(l,Ut,t),T(B,l,t),a(l,Mt,t),T(O,l,t),a(l,rt,t),a(l,q,t),a(l,ot,t),a(l,P,t),a(l,Tt,t),T(X,l,t),a(l,Jt,t),T(K,l,t),a(l,ct,t),a(l,ll,t),a(l,mt,t),T(Z,l,t),a(l,ft,t),a(l,tl,t),a(l,yt,t),T(G,l,t),a(l,ut,t),T(el,l,t),a(l,ht,t),a(l,sl,t),a(l,dt,t),T(al,l,t),a(l,wt,t),a(l,nl,t),a(l,Ct,t),T(pl,l,t),a(l,bt,t),a(l,il,t),a(l,_t,t),T(Ul,l,t),a(l,Vt,t),a(l,Ml,t),a(l,Rt,t),T(rl,l,t),a(l,jt,t),a(l,ol,t),a(l,$t,t),T(Tl,l,t),a(l,It,t),a(l,Jl,t),a(l,Qt,t),a(l,cl,t),a(l,gt,t),T(ml,l,t),a(l,Nt,t),a(l,fl,t),a(l,Et,t),T(yl,l,t),a(l,Bt,t),T(ul,l,t),a(l,Xt,t),a(l,hl,t),a(l,Zt,t),T(dl,l,t),a(l,Gt,t),a(l,wl,t),a(l,Ft,t),T(Cl,l,t),a(l,St,t),a(l,bl,t),a(l,Wt,t),T(_l,l,t),a(l,vt,t),a(l,Vl,t),a(l,xt,t),T(Rl,l,t),a(l,Dt,t),T(jl,l,t),a(l,At,t),a(l,$l,t),a(l,Yt,t),T(Il,l,t),a(l,Lt,t),a(l,Ql,t),a(l,kt,t),T(gl,l,t),a(l,zt,t),T(Nl,l,t),a(l,Ht,t),a(l,El,t),a(l,Ot,t),T(Bl,l,t),a(l,qt,t),T(Xl,l,t),a(l,Pt,t),a(l,Zl,t),a(l,Kt,t),a(l,Gl,t),a(l,le,t),T(Fl,l,t),a(l,te,t),a(l,Sl,t),a(l,ee,t),a(l,Wl,t),a(l,se,t),a(l,vl,t),a(l,ae,t),a(l,xl,t),a(l,ne,t),T(Dl,l,t),a(l,pe,t),T(Al,l,t),a(l,ie,t),a(l,Yl,t),a(l,Ue,t),a(l,Ll,t),a(l,Me,t),T(kl,l,t),a(l,re,t),a(l,zl,t),a(l,oe,t),a(l,Ol,t),Te=!0},p(l,[t]){const ze={};t&2&&(ze.$$scope={dirty:t,ctx:l}),E.$set(ze);const He={};t&2&&(He.$$scope={dirty:t,ctx:l}),B.$set(He);const Oe={};t&2&&(Oe.$$scope={dirty:t,ctx:l}),X.$set(Oe);const qe={};t&2&&(qe.$$scope={dirty:t,ctx:l}),Z.$set(qe);const Pe={};t&2&&(Pe.$$scope={dirty:t,ctx:l}),G.$set(Pe)},i(l){Te||(J(h.$$.fragment,l),J(v.$$.fragment,l),J(A.$$.fragment,l),J(L.$$.fragment,l),J(z.$$.fragment,l),J(H.$$.fragment,l),J(E.$$.fragment,l),J(B.$$.fragment,l),J(O.$$.fragment,l),J(X.$$.fragment,l),J(K.$$.fragment,l),J(Z.$$.fragment,l),J(G.$$.fragment,l),J(el.$$.fragment,l),J(al.$$.fragment,l),J(pl.$$.fragment,l),J(Ul.$$.fragment,l),J(rl.$$.fragment,l),J(Tl.$$.fragment,l),J(ml.$$.fragment,l),J(yl.$$.fragment,l),J(ul.$$.fragment,l),J(dl.$$.fragment,l),J(Cl.$$.fragment,l),J(_l.$$.fragment,l),J(Rl.$$.fragment,l),J(jl.$$.fragment,l),J(Il.$$.fragment,l),J(gl.$$.fragment,l),J(Nl.$$.fragment,l),J(Bl.$$.fragment,l),J(Xl.$$.fragment,l),J(Fl.$$.fragment,l),J(Dl.$$.fragment,l),J(Al.$$.fragment,l),J(kl.$$.fragment,l),Te=!0)},o(l){c(h.$$.fragment,l),c(v.$$.fragment,l),c(A.$$.fragment,l),c(L.$$.fragment,l),c(z.$$.fragment,l),c(H.$$.fragment,l),c(E.$$.fragment,l),c(B.$$.fragment,l),c(O.$$.fragment,l),c(X.$$.fragment,l),c(K.$$.fragment,l),c(Z.$$.fragment,l),c(G.$$.fragment,l),c(el.$$.fragment,l),c(al.$$.fragment,l),c(pl.$$.fragment,l),c(Ul.$$.fragment,l),c(rl.$$.fragment,l),c(Tl.$$.fragment,l),c(ml.$$.fragment,l),c(yl.$$.fragment,l),c(ul.$$.fragment,l),c(dl.$$.fragment,l),c(Cl.$$.fragment,l),c(_l.$$.fragment,l),c(Rl.$$.fragment,l),c(jl.$$.fragment,l),c(Il.$$.fragment,l),c(gl.$$.fragment,l),c(Nl.$$.fragment,l),c(Bl.$$.fragment,l),c(Xl.$$.fragment,l),c(Fl.$$.fragment,l),c(Dl.$$.fragment,l),c(Al.$$.fragment,l),c(kl.$$.fragment,l),Te=!1},d(l){l&&(s(U),s(e),s(M),s(j),s(R),s(_),s($),s(V),s(N),s(Q),s(S),s(ql),s(W),s(Pl),s(Kl),s(x),s(lt),s(D),s(tt),s(et),s(Y),s(st),s(at),s(k),s(nt),s(pt),s(it),s(Ut),s(Mt),s(rt),s(q),s(ot),s(P),s(Tt),s(Jt),s(ct),s(ll),s(mt),s(ft),s(tl),s(yt),s(ut),s(ht),s(sl),s(dt),s(wt),s(nl),s(Ct),s(bt),s(il),s(_t),s(Vt),s(Ml),s(Rt),s(jt),s(ol),s($t),s(It),s(Jl),s(Qt),s(cl),s(gt),s(Nt),s(fl),s(Et),s(Bt),s(Xt),s(hl),s(Zt),s(Gt),s(wl),s(Ft),s(St),s(bl),s(Wt),s(vt),s(Vl),s(xt),s(Dt),s(At),s($l),s(Yt),s(Lt),s(Ql),s(kt),s(zt),s(Ht),s(El),s(Ot),s(qt),s(Pt),s(Zl),s(Kt),s(Gl),s(le),s(te),s(Sl),s(ee),s(Wl),s(se),s(vl),s(ae),s(xl),s(ne),s(pe),s(ie),s(Yl),s(Ue),s(Ll),s(Me),s(re),s(zl),s(oe),s(Ol)),s(n),m(h,l),m(v,l),m(A,l),m(L,l),m(z,l),m(H,l),m(E,l),m(B,l),m(O,l),m(X,l),m(K,l),m(Z,l),m(G,l),m(el,l),m(al,l),m(pl,l),m(Ul,l),m(rl,l),m(Tl,l),m(ml,l),m(yl,l),m(ul,l),m(dl,l),m(Cl,l),m(_l,l),m(Rl,l),m(jl,l),m(Il,l),m(gl,l),m(Nl,l),m(Bl,l),m(Xl,l),m(Fl,l),m(Dl,l),m(Al,l),m(kl,l)}}}const _s='{"title":"DreamBooth","local":"dreambooth","sections":[{"title":"파인튜닝","local":"파인튜닝","sections":[{"title":"Prior-preserving(사전 보존) loss를 사용한 파인튜닝","local":"prior-preserving사전-보존-loss를-사용한-파인튜닝","sections":[],"depth":3}],"depth":2},{"title":"텍스트 인코더와 and UNet로 파인튜닝하기","local":"텍스트-인코더와-and-unet로-파인튜닝하기","sections":[],"depth":2},{"title":"LoRA로 파인튜닝하기","local":"lora로-파인튜닝하기","sections":[{"title":"학습 중 체크포인트 저장하기","local":"학습-중-체크포인트-저장하기","sections":[{"title":"저장된 체크포인트에서 훈련 재개하기","local":"저장된-체크포인트에서-훈련-재개하기","sections":[],"depth":4},{"title":"저장된 체크포인트를 사용하여 추론 수행하기","local":"저장된-체크포인트를-사용하여-추론-수행하기","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"각 GPU 용량에서의 최적화","local":"각-gpu-용량에서의-최적화","sections":[{"title":"xFormers","local":"xformers","sections":[],"depth":3},{"title":"그래디언트 없음으로 설정","local":"그래디언트-없음으로-설정","sections":[],"depth":3},{"title":"16GB GPU","local":"16gb-gpu","sections":[],"depth":3},{"title":"12GB GPU","local":"12gb-gpu","sections":[],"depth":3},{"title":"8GB GPU에서 학습하기","local":"8gb-gpu에서-학습하기","sections":[],"depth":3}],"depth":2},{"title":"추론","local":"추론","sections":[],"depth":2}],"depth":1}';function Vs(C){return ss(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=Us}),[]}class Ns extends as{constructor(n){super(),ns(this,n,Vs,bs,es,{})}}export{Ns as component};
