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