import{s as as,o as ns,n as F}from"../chunks/scheduler.94020406.js";import{S as ps,i as is,g as f,s as p,r,E as Us,h as y,f as s,c as i,j as ls,u as o,x as u,k as es,y as Ms,a,v as T,d as J,t as c,w as m}from"../chunks/index.a08c8d92.js";import{T as ss}from"../chunks/Tip.3b0aeee8.js";import{C}from"../chunks/CodeBlock.f1fae7de.js";import{F as me,M as Ot}from"../chunks/Markdown.23159a98.js";import{H as I,E as rs}from"../chunks/getInferenceSnippets.36859684.js";function os(b){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 Ts(b){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,$,R='그런 다음, 다음 명령을 사용하여 학습 스크립트를 실행할 수 있습니다 (전체 학습 스크립트는 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">여기</a>에서 찾을 수 있습니다):',g,_,j;return M=new C({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 C({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(),$=f("p"),$.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),$=y(d,"P",{"data-svelte-h":!0}),u($)!=="svelte-1il13rm"&&($.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,$,V),a(d,g,V),T(_,d,V),j=!0},p:F,i(d){j||(J(M.$$.fragment,d),J(_.$$.fragment,d),j=!0)},o(d){c(M.$$.fragment,d),c(_.$$.fragment,d),j=!1},d(d){d&&(s(n),s(e),s(h),s($),s(g)),m(M,d),m(_,d)}}}function Js(b){let n,U;return n=new Ot({props:{$$slots:{default:[Ts]},$$scope:{ctx:b}}}),{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 cs(b){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="스크립트를 실행하기 전에 요구 사항이 설치되어 있는지 확인하십시오.",$,R,g,_,j="그러면 다음 명령어로 학습 스크립트를 실행시킬 수 있습니다:",d,V,E;return R=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:"pip install -U -r requirements.txt",wrap:!1}}),V=new C({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,$=p(),r(R.$$.fragment),g=p(),_=f("p"),_.textContent=j,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),$=i(w),o(R.$$.fragment,w),g=i(w),_=y(w,"P",{"data-svelte-h":!0}),u(_)!=="svelte-t3rhu9"&&(_.textContent=j),d=i(w),o(V.$$.fragment,w)},m(w,Q){a(w,n,Q),a(w,e,Q),a(w,M,Q),a(w,$,Q),T(R,w,Q),a(w,g,Q),a(w,_,Q),a(w,d,Q),T(V,w,Q),E=!0},p:F,i(w){E||(J(R.$$.fragment,w),J(V.$$.fragment,w),E=!0)},o(w){c(R.$$.fragment,w),c(V.$$.fragment,w),E=!1},d(w){w&&(s(n),s(e),s(M),s($),s(g),s(_),s(d)),m(R,w),m(V,w)}}}function ms(b){let n,U;return n=new Ot({props:{$$slots:{default:[cs]},$$scope:{ctx:b}}}),{c(){r(n.$$.fragment)},l(e){o(n.$$.fragment,e)},m(e,M){T(n,e,M),U=!0},p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RDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbnVtX2NsYXNzX2ltYWdlcyUzRDIwMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEODAw",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 ys(b){let n,U;return n=new Ot({props:{$$slots:{default:[fs]},$$scope:{ctx:b}}}),{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(b){let n,U;return n=new C({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 hs(b){let n,U;return n=new Ot({props:{$$slots:{default:[us]},$$scope:{ctx:b}}}),{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 ds(b){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 ws(b){let n,U;return n=new C({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 bs(b){let n,U;return n=new Ot({props:{$$slots:{default:[ws]},$$scope:{ctx:b}}}),{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 Cs(b){let n,U;return n=new C({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 _s(b){let n,U;return n=new Ot({props:{$$slots:{default:[Cs]},$$scope:{ctx:b}}}),{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 Vs(b){let n,U,e,M,h,$,R,g='<a href="https://huggingface.co/papers/2208.12242" rel="nofollow">DreamBooth</a>는 한 주제에 대한 적은 이미지(3~5개)만으로도 stable diffusion과 같이 text-to-image 모델을 개인화할 수 있는 방법입니다. 이를 통해 모델은 다양한 장면, 포즈 및 장면(뷰)에서 피사체에 대해 맥락화(contextualized)된 이미지를 생성할 수 있습니다.',_,j,d='<img src="https://dreambooth.github.io/DreamBooth_files/teaser_static.jpg" alt="프로젝트 블로그에서의 DreamBooth 예시"/>',V,E,w='에서의 Dreambooth 예시 <a href="https://dreambooth.github.io">project&#39;s blog.</a>',Q,S,fe='이 가이드는 다양한 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>에서 찾을 수 있습니다.',Pt,W,ye="스크립트를 실행하기 전에 라이브러리의 학습에 필요한 dependencies를 설치해야 합니다. 또한 <code>main</code> GitHub 브랜치에서 🧨 Diffusers를 설치하는 것이 좋습니다.",Kt,v,tl,x,ue='xFormers는 학습에 필요한 요구 사항은 아니지만, 가능하면 <a href="../optimization/xformers">설치</a>하는 것이 좋습니다. 학습 속도를 높이고 메모리 사용량을 줄일 수 있기 때문입니다.',ll,D,he='모든 dependencies을 설정한 후 다음을 사용하여 <a href="https://github.com/huggingface/accelerate/" rel="nofollow">🤗 Accelerate</a> 환경을 다음과 같이 초기화합니다:',el,A,sl,Y,de="별도 설정 없이 기본 🤗 Accelerate 환경을 설치하려면 다음을 실행합니다:",al,L,nl,k,we="또는 현재 환경이 노트북과 같은 대화형 셸을 지원하지 않는 경우 다음을 사용할 수 있습니다:",pl,z,il,H,Ul,N,Ml,B,rl,O,ol,q,be='과적합과 language drift를 방지하기 위해 사전 보존이 사용됩니다(관심이 있는 경우 <a href="https://huggingface.co/papers/2208.12242" rel="nofollow">논문</a>을 참조하세요).  사전 보존을 위해 동일한 클래스의 다른 이미지를 학습 프로세스의 일부로 사용합니다. 좋은 점은 Stable Diffusion 모델 자체를 사용하여 이러한 이미지를 생성할 수 있다는 것입니다! 학습 스크립트는 생성된 이미지를 우리가 지정한 로컬 경로에 저장합니다.',Tl,P,Ce="저자들에 따르면 사전 보존을 위해 <code>num_epochs * num_samples</code>개의 이미지를 생성하는 것이 좋습니다. 200-300개에서 대부분 잘 작동합니다.",Jl,X,cl,K,ml,tt,_e='해당 스크립트를 사용하면 <code>unet</code>과 함께 <code>text_encoder</code>를 파인튜닝할 수 있습니다. 실험에서(자세한 내용은 <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">🧨 Diffusers를 사용해 DreamBooth로 Stable Diffusion 학습하기</a> 게시물을 확인하세요), 특히 얼굴 이미지를 생성할 때 훨씬 더 나은 결과를 얻을 수 있습니다.',fl,Z,yl,lt,Ve="<code>--train_text_encoder</code> 인수를 학습 스크립트에 전달하여 <code>text_encoder</code> 및 <code>unet</code>을 파인튜닝할 수 있습니다:",ul,G,hl,et,dl,st,Re='DreamBooth에서 대규모 모델의 학습을 가속화하기 위한 파인튜닝 기술인 LoRA(Low-Rank Adaptation of Large Language Models)를 사용할 수 있습니다. 자세한 내용은 <a href="training/lora#dreambooth">LoRA 학습</a> 가이드를 참조하세요.',wl,at,bl,nt,$e="Dreambooth로 훈련하는 동안 과적합하기 쉬우므로, 때때로 학습 중에 정기적인 체크포인트를 저장하는 것이 유용합니다. 중간 체크포인트 중 하나가 최종 모델보다 더 잘 작동할 수 있습니다! 체크포인트 저장 기능을 활성화하려면 학습 스크립트에 다음 인수를 전달해야 합니다:",Cl,pt,_l,it,je="이렇게 하면 <code>output_dir</code>의 하위 폴더에 전체 학습 상태가 저장됩니다. 하위 폴더 이름은 접두사 <code>checkpoint-</code>로 시작하고 지금까지 수행된 step 수입니다. 예시로 <code>checkpoint-1500</code>은 1500 학습 step 후에 저장된 체크포인트입니다.",Vl,Ut,Rl,Mt,Ie="저장된 체크포인트에서 훈련을 재개하려면, <code>--resume_from_checkpoint</code> 인수를 전달한 다음 사용할 체크포인트의 이름을 지정하면 됩니다. 특수 문자열 <code>&quot;latest&quot;</code>를 사용하여 저장된 마지막 체크포인트(즉, step 수가 가장 많은 체크포인트)에서 재개할 수도 있습니다. 예를 들어 다음은 1500 step 후에 저장된 체크포인트에서부터 학습을 재개합니다:",$l,rt,jl,ot,Qe="원하는 경우 일부 하이퍼파라미터를 조정할 수 있습니다.",Il,Tt,Ql,Jt,ge="저장된 체크포인트는 훈련 재개에 적합한 형식으로 저장됩니다. 여기에는 모델 가중치뿐만 아니라 옵티마이저, 데이터 로더 및 학습률의 상태도 포함됩니다.",gl,ct,Ee="<strong><code>&quot;accelerate&gt;=0.16.0&quot;</code></strong>이 설치된 경우 다음 코드를 사용하여 중간 체크포인트에서 추론을 실행합니다.",El,mt,Nl,ft,Ne="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:",Bl,yt,Xl,ut,Zl,ht,Be="하드웨어에 따라 16GB에서 8GB까지 GPU에서 DreamBooth를 최적화하는 몇 가지 방법이 있습니다!",Gl,dt,Fl,wt,Xe='<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>한 다음 학습 스크립트에 다음 인수를 추가합니다:',Sl,bt,Wl,Ct,Ze="xFormers는 Flax에서 사용할 수 없습니다.",vl,_t,xl,Vt,Ge='메모리 사용량을 줄일 수 있는 또 다른 방법은 <a href="https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html" rel="nofollow">기울기 설정</a>을 0 대신 <code>None</code>으로 하는 것입니다. 그러나 이로 인해 특정 동작이 변경될 수 있으므로 문제가 발생하면 이 인수를 제거해 보십시오. 학습 스크립트에 다음 인수를 추가하여 그래디언트를 <code>None</code>으로 설정합니다.',Dl,Rt,Al,$t,Yl,jt,Fe='Gradient checkpointing과 <a href="https://github.com/TimDettmers/bitsandbytes" rel="nofollow">bitsandbytes</a>의 8비트 옵티마이저의 도움으로, 16GB GPU에서 dreambooth를 훈련할 수 있습니다. bitsandbytes가 설치되어 있는지 확인하세요:',Ll,It,kl,Qt,Se="그 다음, 학습 스크립트에 <code>--use_8bit_adam</code> 옵션을 명시합니다:",zl,gt,Hl,Et,Ol,Nt,We="12GB GPU에서 DreamBooth를 실행하려면 gradient checkpointing, 8비트 옵티마이저, xFormers를 활성화하고 그래디언트를 <code>None</code>으로 설정해야 합니다.",ql,Bt,Pl,Xt,Kl,Zt,ve='8GB GPU에 대해서는 <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a>를 사용해 일부 텐서를 VRAM에서 CPU 또는 NVME로 오프로드하여 더 적은 GPU 메모리로 학습할 수도 있습니다.',te,Gt,xe="🤗 Accelerate 환경을 구성하려면 다음 명령을 실행하세요:",le,Ft,ee,St,De=`환경 구성 중에 DeepSpeed를 사용할 것을 확인하세요.
그러면 DeepSpeed stage 2, fp16 혼합 정밀도를 결합하고 모델 매개변수와 옵티마이저 상태를 모두 CPU로 오프로드하면 8GB VRAM 미만에서 학습할 수 있습니다.
단점은 더 많은 시스템 RAM(약 25GB)이 필요하다는 것입니다. 추가 구성 옵션은 <a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">DeepSpeed 문서</a>를 참조하세요.`,se,Wt,Ae=`또한 기본 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와 함께 설치된 것과 동일해야 합니다.`,ae,vt,Ye="8비트 옵티마이저는 현재 DeepSpeed와 호환되지 않는 것 같습니다.",ne,xt,Le="다음 명령으로 학습을 시작합니다:",pe,Dt,ie,At,Ue,Yt,ke="모델을 학습한 후에는, 모델이 저장된 경로를 지정해 <code>StableDiffusionPipeline</code>로 추론을 수행할 수 있습니다. 프롬프트에 학습에 사용된 특수 <code>식별자</code>(이전 예시의 <code>sks</code>)가 포함되어 있는지 확인하세요.",Me,Lt,ze="<strong><code>&quot;accelerate&gt;=0.16.0&quot;</code></strong>이 설치되어 있는 경우 다음 코드를 사용하여 중간 체크포인트에서 추론을 실행할 수 있습니다:",re,kt,oe,zt,He='<a href="#inference-from-a-saved-checkpoint">저장된 학습 체크포인트</a>에서도 추론을 실행할 수도 있습니다.',Te,Ht,Je,qt,ce;return h=new I({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h1"}}),v=new C({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 C({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),L=new C({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),z=new C({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"}}),N=new ss({props:{warning:!0,$$slots:{default:[os]},$$scope:{ctx:b}}}),B=new me({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[ms],pytorch:[Js]},$$scope:{ctx:b}}}),O=new I({props:{title:"Prior-preserving(사전 보존) loss를 사용한 파인튜닝",local:"prior-preserving사전-보존-loss를-사용한-파인튜닝",headingTag:"h3"}}),X=new me({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[hs],pytorch:[ys]},$$scope:{ctx:b}}}),K=new I({props:{title:"텍스트 인코더와 and UNet로 파인튜닝하기",local:"텍스트-인코더와-and-unet로-파인튜닝하기",headingTag:"h2"}}),Z=new ss({props:{warning:!0,$$slots:{default:[ds]},$$scope:{ctx:b}}}),G=new me({props:{pytorch:!0,tensorflow:!1,jax:!0,$$slots:{jax:[_s],pytorch:[bs]},$$scope:{ctx:b}}}),et=new I({props:{title:"LoRA로 파인튜닝하기",local:"lora로-파인튜닝하기",headingTag:"h2"}}),at=new I({props:{title:"학습 중 체크포인트 저장하기",local:"학습-중-체크포인트-저장하기",headingTag:"h3"}}),pt=new C({props:{code:"JTIwJTIwLS1jaGVja3BvaW50aW5nX3N0ZXBzJTNENTAw",highlighted:"  --checkpointing_steps=500",wrap:!1}}),Ut=new I({props:{title:"저장된 체크포인트에서 훈련 재개하기",local:"저장된-체크포인트에서-훈련-재개하기",headingTag:"h4"}}),rt=new C({props:{code:"JTIwJTIwLS1yZXN1bWVfZnJvbV9jaGVja3BvaW50JTNEJTIyY2hlY2twb2ludC0xNTAwJTIy",highlighted:'  --resume_from_checkpoint=<span class="hljs-string">&quot;checkpoint-1500&quot;</span>',wrap:!1}}),Tt=new I({props:{title:"저장된 체크포인트를 사용하여 추론 수행하기",local:"저장된-체크포인트를-사용하여-추론-수행하기",headingTag:"h4"}}),mt=new C({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW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BJTk0JTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwQ0xJUFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyJTJGc2RkYXRhJTJGZHJlYW1ib290aCUyRmRhcnVtYS12Mi0xJTJGY2hlY2twb2ludC0xMDAlMkZ0ZXh0X2VuY29kZXIlMjIpJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB1bmV0JTNEdW5ldCUyQyUyMHRleHRfZW5jb2RlciUzRHRleHRfZW5jb2RlciUyQyUyMGR0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMCVFQyVCNiU5NCVFQiVBMSVBMCVFQyU5RCU4NCUyMCVFQyU4OCU5OCVFRCU5NiU4OSVFRCU5NSU5OCVFQSVCMSVCMCVFQiU4MiU5OCUyMCVFQyVBMCU4MCVFQyU5RSVBNSVFRCU5NSU5OCVFQSVCMSVCMCVFQiU4MiU5OCUyQyUyMCVFRCU5NyU4OCVFQiVCOCU4QyVFQyU5NyU5MCUyMCVFRCU5MSVCOCVFQyU4QiU5QyVFRCU5NSVBOSVFQiU4QiU4OCVFQiU4QiVBNC4lMEFwaXBlbGluZS5zYXZlX3ByZXRyYWluZWQoJTIyZHJlYW1ib290aC1waXBlbGluZSUyMik=",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}}),yt=new C({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBEaWZmdXNpb25QaXBlbGluZSUwQSUwQSUyMyUyMCVFRCU5NSU5OSVFQyU4QSVCNSVFQyU5NyU5MCUyMCVFQyU4MiVBQyVFQyU5QSVBOSVFQiU5MCU5QyUyMCVFQSVCMiU4MyVFQSVCMyVCQyUyMCVFQiU4RiU5OSVFQyU5RCVCQyVFRCU5NSU5QyUyMCVFQyU5RCVCOCVFQyU4OCU5OChtb2RlbCUyQyUyMHJldmlzaW9uKSVFQiVBMSU5QyUyMCVFRCU4QyU4QyVFQyU5RCVCNCVFRCU5NCU4NCVFQiU5RCVCQyVFQyU5RCVCOCVFQyU5RCU4NCUyMCVFQiVCNiU4OCVFQiU5RiVBQyVFQyU5OCVCNSVFQiU4QiU4OCVFQiU4QiVBNC4lMEFtb2RlbF9pZCUyMCUzRCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2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OUMlMjAlRUQlOEMlOEMlRUMlOUQlQjQlRUQlOTQlODQlRUIlOUQlQkMlRUMlOUQlQjglRUMlOUQlODQlMjAlRUIlOEIlQTQlRUMlOEIlOUMlMjAlRUIlQjklOEMlRUIlOTMlOUMlRUQlOTUlQTklRUIlOEIlODglRUIlOEIlQTQuKC51bmV0JTIwYW5kJTIwLnRleHRfZW5jb2RlciVFQiVBMSU5QyVFQyU5RCU5OCUyMCVFRCU5NSVBMCVFQiU4QiVCOSVFQiU4RiU4NCUyMCVFQyU5RSU5MSVFQiU4RiU5OSVFRCU5NSVCNCVFQyU5NSVCQyUyMCVFRCU5NSVBOSVFQiU4QiU4OCVFQiU4QiVBNCklMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUwQSUyMCUyMCUyMCUyMHVuZXQlM0RhY2NlbGVyYXRvci51bndyYXBfbW9kZWwodW5ldCklMkMlMEElMjAlMjAlMjAlMjB0ZXh0X2VuY29kZXIlM0RhY2NlbGVyYXRvci51bndyYXBfbW9kZWwodGV4dF9lbmNvZGVyKSUyQyUwQSklMEElMEElMjMlMjAlRUMlQjYlOTQlRUIlQTElQTAlRUMlOUQlODQlMjAlRUMlODglOTglRUQlOTYlODklRUQlOTUlOTglRUElQjElQjAlRUIlODIlOTglMjAlRUMlQTAlODAlRUMlOUUlQTUlRUQlOTUlOTglRUElQjElQjAlRUIlODIlOTglMkMlMjAlRUQlOTclODglRUIlQjglOEMlRUMlOTclOTAlMjAlRUQlOTElQjglRUMlOEIlOUMlRUQlOTUlQTklRUIlOEIlODglRUIlOEIlQTQuJTBBcGlwZWxpbmUuc2F2ZV9wcmV0cmFpbmVkKCUyMmRyZWFtYm9vdGgtcGlwZWxpbmUlMjIp",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}}),ut=new I({props:{title:"각 GPU 용량에서의 최적화",local:"각-gpu-용량에서의-최적화",headingTag:"h2"}}),dt=new I({props:{title:"xFormers",local:"xformers",headingTag:"h3"}}),bt=new C({props:{code:"JTIwJTIwLS1lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24=",highlighted:"  --enable_xformers_memory_efficient_attention",wrap:!1}}),_t=new I({props:{title:"그래디언트 없음으로 설정",local:"그래디언트-없음으로-설정",headingTag:"h3"}}),Rt=new C({props:{code:"JTIwJTIwLS1zZXRfZ3JhZHNfdG9fbm9uZQ==",highlighted:"  --set_grads_to_none",wrap:!1}}),$t=new I({props:{title:"16GB GPU",local:"16gb-gpu",headingTag:"h3"}}),It=new C({props:{code:"cGlwJTIwaW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lNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDIlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbnVtX2NsYXNzX2ltYWdlcyUzRDIwMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEODAw",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> \\
  --lr_war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pbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tdXNlXzhiaXRfYWRhbSUyMCU1QyUwQSUyMCUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwJTIwLS1zZXRfZ3JhZHNfdG9fbm9uZSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDJlLTYlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1udW1fY2xhc3NfaW1hZ2VzJTNEMjAwJTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0Q4MDA=",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}}),Xt=new I({props:{title:"8GB GPU에서 학습하기",local:"8gb-gpu에서-학습하기",headingTag:"h3"}}),Ft=new C({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Dt=new C({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}}),At=new I({props:{title:"추론",local:"추론",headingTag:"h2"}}),kt=new C({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}}),Ht=new rs({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/training/dreambooth.md"}}),{c(){n=f("meta"),U=p(),e=f("p"),M=p(),r(h.$$.fragment),$=p(),R=f("p"),R.innerHTML=g,_=p(),j=f("p"),j.innerHTML=d,V=p(),E=f("small"),E.innerHTML=w,Q=p(),S=f("p"),S.innerHTML=fe,Pt=p(),W=f("p"),W.innerHTML=ye,Kt=p(),r(v.$$.fragment),tl=p(),x=f("p"),x.innerHTML=ue,ll=p(),D=f("p"),D.innerHTML=he,el=p(),r(A.$$.fragment),sl=p(),Y=f("p"),Y.textContent=de,al=p(),r(L.$$.fragment),nl=p(),k=f("p"),k.textContent=we,pl=p(),r(z.$$.fragment),il=p(),r(H.$$.fragment),Ul=p(),r(N.$$.fragment),Ml=p(),r(B.$$.fragment),rl=p(),r(O.$$.fragment),ol=p(),q=f("p"),q.innerHTML=be,Tl=p(),P=f("p"),P.innerHTML=Ce,Jl=p(),r(X.$$.fragment),cl=p(),r(K.$$.fragment),ml=p(),tt=f("p"),tt.innerHTML=_e,fl=p(),r(Z.$$.fragment),yl=p(),lt=f("p"),lt.innerHTML=Ve,ul=p(),r(G.$$.fragment),hl=p(),r(et.$$.fragment),dl=p(),st=f("p"),st.innerHTML=Re,wl=p(),r(at.$$.fragment),bl=p(),nt=f("p"),nt.textContent=$e,Cl=p(),r(pt.$$.fragment),_l=p(),it=f("p"),it.innerHTML=je,Vl=p(),r(Ut.$$.fragment),Rl=p(),Mt=f("p"),Mt.innerHTML=Ie,$l=p(),r(rt.$$.fragment),jl=p(),ot=f("p"),ot.textContent=Qe,Il=p(),r(Tt.$$.fragment),Ql=p(),Jt=f("p"),Jt.textContent=ge,gl=p(),ct=f("p"),ct.innerHTML=Ee,El=p(),r(mt.$$.fragment),Nl=p(),ft=f("p"),ft.innerHTML=Ne,Bl=p(),r(yt.$$.fragment),Xl=p(),r(ut.$$.fragment),Zl=p(),ht=f("p"),ht.textContent=Be,Gl=p(),r(dt.$$.fragment),Fl=p(),wt=f("p"),wt.innerHTML=Xe,Sl=p(),r(bt.$$.fragment),Wl=p(),Ct=f("p"),Ct.textContent=Ze,vl=p(),r(_t.$$.fragment),xl=p(),Vt=f("p"),Vt.innerHTML=Ge,Dl=p(),r(Rt.$$.fragment),Al=p(),r($t.$$.fragment),Yl=p(),jt=f("p"),jt.innerHTML=Fe,Ll=p(),r(It.$$.fragment),kl=p(),Qt=f("p"),Qt.innerHTML=Se,zl=p(),r(gt.$$.fragment),Hl=p(),r(Et.$$.fragment),Ol=p(),Nt=f("p"),Nt.innerHTML=We,ql=p(),r(Bt.$$.fragment),Pl=p(),r(Xt.$$.fragment),Kl=p(),Zt=f("p"),Zt.innerHTML=ve,te=p(),Gt=f("p"),Gt.textContent=xe,le=p(),r(Ft.$$.fragment),ee=p(),St=f("p"),St.innerHTML=De,se=p(),Wt=f("p"),Wt.innerHTML=Ae,ae=p(),vt=f("p"),vt.textContent=Ye,ne=p(),xt=f("p"),xt.textContent=Le,pe=p(),r(Dt.$$.fragment),ie=p(),r(At.$$.fragment),Ue=p(),Yt=f("p"),Yt.innerHTML=ke,Me=p(),Lt=f("p"),Lt.innerHTML=ze,re=p(),r(kt.$$.fragment),oe=p(),zt=f("p"),zt.innerHTML=He,Te=p(),r(Ht.$$.fragment),Je=p(),qt=f("p"),this.h()},l(t){const l=Us("svelte-u9bgzb",document.head);n=y(l,"META",{name:!0,content:!0}),l.forEach(s),U=i(t),e=y(t,"P",{}),ls(e).forEach(s),M=i(t),o(h.$$.fragment,t),$=i(t),R=y(t,"P",{"data-svelte-h":!0}),u(R)!=="svelte-13ly7br"&&(R.innerHTML=g),_=i(t),j=y(t,"P",{"data-svelte-h":!0}),u(j)!=="svelte-1kn2nxe"&&(j.innerHTML=d),V=i(t),E=y(t,"SMALL",{"data-svelte-h":!0}),u(E)!=="svelte-pvgijy"&&(E.innerHTML=w),Q=i(t),S=y(t,"P",{"data-svelte-h":!0}),u(S)!=="svelte-zzw22q"&&(S.innerHTML=fe),Pt=i(t),W=y(t,"P",{"data-svelte-h":!0}),u(W)!=="svelte-ge4j3j"&&(W.innerHTML=ye),Kt=i(t),o(v.$$.fragment,t),tl=i(t),x=y(t,"P",{"data-svelte-h":!0}),u(x)!=="svelte-1i91gkn"&&(x.innerHTML=ue),ll=i(t),D=y(t,"P",{"data-svelte-h":!0}),u(D)!=="svelte-1eihpxk"&&(D.innerHTML=he),el=i(t),o(A.$$.fragment,t),sl=i(t),Y=y(t,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-1f2hl18"&&(Y.textContent=de),al=i(t),o(L.$$.fragment,t),nl=i(t),k=y(t,"P",{"data-svelte-h":!0}),u(k)!=="svelte-1d1ptkt"&&(k.textContent=we),pl=i(t),o(z.$$.fragment,t),il=i(t),o(H.$$.fragment,t),Ul=i(t),o(N.$$.fragment,t),Ml=i(t),o(B.$$.fragment,t),rl=i(t),o(O.$$.fragment,t),ol=i(t),q=y(t,"P",{"data-svelte-h":!0}),u(q)!=="svelte-16s28pv"&&(q.innerHTML=be),Tl=i(t),P=y(t,"P",{"data-svelte-h":!0}),u(P)!=="svelte-err38i"&&(P.innerHTML=Ce),Jl=i(t),o(X.$$.fragment,t),cl=i(t),o(K.$$.fragment,t),ml=i(t),tt=y(t,"P",{"data-svelte-h":!0}),u(tt)!=="svelte-sj6d0j"&&(tt.innerHTML=_e),fl=i(t),o(Z.$$.fragment,t),yl=i(t),lt=y(t,"P",{"data-svelte-h":!0}),u(lt)!=="svelte-u7f6lc"&&(lt.innerHTML=Ve),ul=i(t),o(G.$$.fragment,t),hl=i(t),o(et.$$.fragment,t),dl=i(t),st=y(t,"P",{"data-svelte-h":!0}),u(st)!=="svelte-11xlfgf"&&(st.innerHTML=Re),wl=i(t),o(at.$$.fragment,t),bl=i(t),nt=y(t,"P",{"data-svelte-h":!0}),u(nt)!=="svelte-1nrdgkj"&&(nt.textContent=$e),Cl=i(t),o(pt.$$.fragment,t),_l=i(t),it=y(t,"P",{"data-svelte-h":!0}),u(it)!=="svelte-t10p74"&&(it.innerHTML=je),Vl=i(t),o(Ut.$$.fragment,t),Rl=i(t),Mt=y(t,"P",{"data-svelte-h":!0}),u(Mt)!=="svelte-hg3lj6"&&(Mt.innerHTML=Ie),$l=i(t),o(rt.$$.fragment,t),jl=i(t),ot=y(t,"P",{"data-svelte-h":!0}),u(ot)!=="svelte-1k5w6f5"&&(ot.textContent=Qe),Il=i(t),o(Tt.$$.fragment,t),Ql=i(t),Jt=y(t,"P",{"data-svelte-h":!0}),u(Jt)!=="svelte-1uf2dye"&&(Jt.textContent=ge),gl=i(t),ct=y(t,"P",{"data-svelte-h":!0}),u(ct)!=="svelte-3mqope"&&(ct.innerHTML=Ee),El=i(t),o(mt.$$.fragment,t),Nl=i(t),ft=y(t,"P",{"data-svelte-h":!0}),u(ft)!=="svelte-10s7sps"&&(ft.innerHTML=Ne),Bl=i(t),o(yt.$$.fragment,t),Xl=i(t),o(ut.$$.fragment,t),Zl=i(t),ht=y(t,"P",{"data-svelte-h":!0}),u(ht)!=="svelte-30mzs2"&&(ht.textContent=Be),Gl=i(t),o(dt.$$.fragment,t),Fl=i(t),wt=y(t,"P",{"data-svelte-h":!0}),u(wt)!=="svelte-1nxj09"&&(wt.innerHTML=Xe),Sl=i(t),o(bt.$$.fragment,t),Wl=i(t),Ct=y(t,"P",{"data-svelte-h":!0}),u(Ct)!=="svelte-60g0k7"&&(Ct.textContent=Ze),vl=i(t),o(_t.$$.fragment,t),xl=i(t),Vt=y(t,"P",{"data-svelte-h":!0}),u(Vt)!=="svelte-1ev0obn"&&(Vt.innerHTML=Ge),Dl=i(t),o(Rt.$$.fragment,t),Al=i(t),o($t.$$.fragment,t),Yl=i(t),jt=y(t,"P",{"data-svelte-h":!0}),u(jt)!=="svelte-1tivb9a"&&(jt.innerHTML=Fe),Ll=i(t),o(It.$$.fragment,t),kl=i(t),Qt=y(t,"P",{"data-svelte-h":!0}),u(Qt)!=="svelte-g5qzqy"&&(Qt.innerHTML=Se),zl=i(t),o(gt.$$.fragment,t),Hl=i(t),o(Et.$$.fragment,t),Ol=i(t),Nt=y(t,"P",{"data-svelte-h":!0}),u(Nt)!=="svelte-3vgf1l"&&(Nt.innerHTML=We),ql=i(t),o(Bt.$$.fragment,t),Pl=i(t),o(Xt.$$.fragment,t),Kl=i(t),Zt=y(t,"P",{"data-svelte-h":!0}),u(Zt)!=="svelte-5o0gew"&&(Zt.innerHTML=ve),te=i(t),Gt=y(t,"P",{"data-svelte-h":!0}),u(Gt)!=="svelte-1n86m0z"&&(Gt.textContent=xe),le=i(t),o(Ft.$$.fragment,t),ee=i(t),St=y(t,"P",{"data-svelte-h":!0}),u(St)!=="svelte-1n79apf"&&(St.innerHTML=De),se=i(t),Wt=y(t,"P",{"data-svelte-h":!0}),u(Wt)!=="svelte-1pwvqjp"&&(Wt.innerHTML=Ae),ae=i(t),vt=y(t,"P",{"data-svelte-h":!0}),u(vt)!=="svelte-1cxr4jn"&&(vt.textContent=Ye),ne=i(t),xt=y(t,"P",{"data-svelte-h":!0}),u(xt)!=="svelte-17vtgpw"&&(xt.textContent=Le),pe=i(t),o(Dt.$$.fragment,t),ie=i(t),o(At.$$.fragment,t),Ue=i(t),Yt=y(t,"P",{"data-svelte-h":!0}),u(Yt)!=="svelte-1p7w8lw"&&(Yt.innerHTML=ke),Me=i(t),Lt=y(t,"P",{"data-svelte-h":!0}),u(Lt)!=="svelte-105ywuc"&&(Lt.innerHTML=ze),re=i(t),o(kt.$$.fragment,t),oe=i(t),zt=y(t,"P",{"data-svelte-h":!0}),u(zt)!=="svelte-17mzaw8"&&(zt.innerHTML=He),Te=i(t),o(Ht.$$.fragment,t),Je=i(t),qt=y(t,"P",{}),ls(qt).forEach(s),this.h()},h(){es(n,"name","hf:doc:metadata"),es(n,"content",Rs)},m(t,l){Ms(document.head,n),a(t,U,l),a(t,e,l),a(t,M,l),T(h,t,l),a(t,$,l),a(t,R,l),a(t,_,l),a(t,j,l),a(t,V,l),a(t,E,l),a(t,Q,l),a(t,S,l),a(t,Pt,l),a(t,W,l),a(t,Kt,l),T(v,t,l),a(t,tl,l),a(t,x,l),a(t,ll,l),a(t,D,l),a(t,el,l),T(A,t,l),a(t,sl,l),a(t,Y,l),a(t,al,l),T(L,t,l),a(t,nl,l),a(t,k,l),a(t,pl,l),T(z,t,l),a(t,il,l),T(H,t,l),a(t,Ul,l),T(N,t,l),a(t,Ml,l),T(B,t,l),a(t,rl,l),T(O,t,l),a(t,ol,l),a(t,q,l),a(t,Tl,l),a(t,P,l),a(t,Jl,l),T(X,t,l),a(t,cl,l),T(K,t,l),a(t,ml,l),a(t,tt,l),a(t,fl,l),T(Z,t,l),a(t,yl,l),a(t,lt,l),a(t,ul,l),T(G,t,l),a(t,hl,l),T(et,t,l),a(t,dl,l),a(t,st,l),a(t,wl,l),T(at,t,l),a(t,bl,l),a(t,nt,l),a(t,Cl,l),T(pt,t,l),a(t,_l,l),a(t,it,l),a(t,Vl,l),T(Ut,t,l),a(t,Rl,l),a(t,Mt,l),a(t,$l,l),T(rt,t,l),a(t,jl,l),a(t,ot,l),a(t,Il,l),T(Tt,t,l),a(t,Ql,l),a(t,Jt,l),a(t,gl,l),a(t,ct,l),a(t,El,l),T(mt,t,l),a(t,Nl,l),a(t,ft,l),a(t,Bl,l),T(yt,t,l),a(t,Xl,l),T(ut,t,l),a(t,Zl,l),a(t,ht,l),a(t,Gl,l),T(dt,t,l),a(t,Fl,l),a(t,wt,l),a(t,Sl,l),T(bt,t,l),a(t,Wl,l),a(t,Ct,l),a(t,vl,l),T(_t,t,l),a(t,xl,l),a(t,Vt,l),a(t,Dl,l),T(Rt,t,l),a(t,Al,l),T($t,t,l),a(t,Yl,l),a(t,jt,l),a(t,Ll,l),T(It,t,l),a(t,kl,l),a(t,Qt,l),a(t,zl,l),T(gt,t,l),a(t,Hl,l),T(Et,t,l),a(t,Ol,l),a(t,Nt,l),a(t,ql,l),T(Bt,t,l),a(t,Pl,l),T(Xt,t,l),a(t,Kl,l),a(t,Zt,l),a(t,te,l),a(t,Gt,l),a(t,le,l),T(Ft,t,l),a(t,ee,l),a(t,St,l),a(t,se,l),a(t,Wt,l),a(t,ae,l),a(t,vt,l),a(t,ne,l),a(t,xt,l),a(t,pe,l),T(Dt,t,l),a(t,ie,l),T(At,t,l),a(t,Ue,l),a(t,Yt,l),a(t,Me,l),a(t,Lt,l),a(t,re,l),T(kt,t,l),a(t,oe,l),a(t,zt,l),a(t,Te,l),T(Ht,t,l),a(t,Je,l),a(t,qt,l),ce=!0},p(t,[l]){const Oe={};l&2&&(Oe.$$scope={dirty:l,ctx:t}),N.$set(Oe);const qe={};l&2&&(qe.$$scope={dirty:l,ctx:t}),B.$set(qe);const Pe={};l&2&&(Pe.$$scope={dirty:l,ctx:t}),X.$set(Pe);const Ke={};l&2&&(Ke.$$scope={dirty:l,ctx:t}),Z.$set(Ke);const ts={};l&2&&(ts.$$scope={dirty:l,ctx:t}),G.$set(ts)},i(t){ce||(J(h.$$.fragment,t),J(v.$$.fragment,t),J(A.$$.fragment,t),J(L.$$.fragment,t),J(z.$$.fragment,t),J(H.$$.fragment,t),J(N.$$.fragment,t),J(B.$$.fragment,t),J(O.$$.fragment,t),J(X.$$.fragment,t),J(K.$$.fragment,t),J(Z.$$.fragment,t),J(G.$$.fragment,t),J(et.$$.fragment,t),J(at.$$.fragment,t),J(pt.$$.fragment,t),J(Ut.$$.fragment,t),J(rt.$$.fragment,t),J(Tt.$$.fragment,t),J(mt.$$.fragment,t),J(yt.$$.fragment,t),J(ut.$$.fragment,t),J(dt.$$.fragment,t),J(bt.$$.fragment,t),J(_t.$$.fragment,t),J(Rt.$$.fragment,t),J($t.$$.fragment,t),J(It.$$.fragment,t),J(gt.$$.fragment,t),J(Et.$$.fragment,t),J(Bt.$$.fragment,t),J(Xt.$$.fragment,t),J(Ft.$$.fragment,t),J(Dt.$$.fragment,t),J(At.$$.fragment,t),J(kt.$$.fragment,t),J(Ht.$$.fragment,t),ce=!0)},o(t){c(h.$$.fragment,t),c(v.$$.fragment,t),c(A.$$.fragment,t),c(L.$$.fragment,t),c(z.$$.fragment,t),c(H.$$.fragment,t),c(N.$$.fragment,t),c(B.$$.fragment,t),c(O.$$.fragment,t),c(X.$$.fragment,t),c(K.$$.fragment,t),c(Z.$$.fragment,t),c(G.$$.fragment,t),c(et.$$.fragment,t),c(at.$$.fragment,t),c(pt.$$.fragment,t),c(Ut.$$.fragment,t),c(rt.$$.fragment,t),c(Tt.$$.fragment,t),c(mt.$$.fragment,t),c(yt.$$.fragment,t),c(ut.$$.fragment,t),c(dt.$$.fragment,t),c(bt.$$.fragment,t),c(_t.$$.fragment,t),c(Rt.$$.fragment,t),c($t.$$.fragment,t),c(It.$$.fragment,t),c(gt.$$.fragment,t),c(Et.$$.fragment,t),c(Bt.$$.fragment,t),c(Xt.$$.fragment,t),c(Ft.$$.fragment,t),c(Dt.$$.fragment,t),c(At.$$.fragment,t),c(kt.$$.fragment,t),c(Ht.$$.fragment,t),ce=!1},d(t){t&&(s(U),s(e),s(M),s($),s(R),s(_),s(j),s(V),s(E),s(Q),s(S),s(Pt),s(W),s(Kt),s(tl),s(x),s(ll),s(D),s(el),s(sl),s(Y),s(al),s(nl),s(k),s(pl),s(il),s(Ul),s(Ml),s(rl),s(ol),s(q),s(Tl),s(P),s(Jl),s(cl),s(ml),s(tt),s(fl),s(yl),s(lt),s(ul),s(hl),s(dl),s(st),s(wl),s(bl),s(nt),s(Cl),s(_l),s(it),s(Vl),s(Rl),s(Mt),s($l),s(jl),s(ot),s(Il),s(Ql),s(Jt),s(gl),s(ct),s(El),s(Nl),s(ft),s(Bl),s(Xl),s(Zl),s(ht),s(Gl),s(Fl),s(wt),s(Sl),s(Wl),s(Ct),s(vl),s(xl),s(Vt),s(Dl),s(Al),s(Yl),s(jt),s(Ll),s(kl),s(Qt),s(zl),s(Hl),s(Ol),s(Nt),s(ql),s(Pl),s(Kl),s(Zt),s(te),s(Gt),s(le),s(ee),s(St),s(se),s(Wt),s(ae),s(vt),s(ne),s(xt),s(pe),s(ie),s(Ue),s(Yt),s(Me),s(Lt),s(re),s(oe),s(zt),s(Te),s(Je),s(qt)),s(n),m(h,t),m(v,t),m(A,t),m(L,t),m(z,t),m(H,t),m(N,t),m(B,t),m(O,t),m(X,t),m(K,t),m(Z,t),m(G,t),m(et,t),m(at,t),m(pt,t),m(Ut,t),m(rt,t),m(Tt,t),m(mt,t),m(yt,t),m(ut,t),m(dt,t),m(bt,t),m(_t,t),m(Rt,t),m($t,t),m(It,t),m(gt,t),m(Et,t),m(Bt,t),m(Xt,t),m(Ft,t),m(Dt,t),m(At,t),m(kt,t),m(Ht,t)}}}const Rs='{"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 $s(b){return ns(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bs extends ps{constructor(n){super(),is(this,n,$s,Vs,as,{})}}export{Bs as component};
