import{s as ee,j as le,o as ne,n as ae}from"../chunks/scheduler.6e0d5ff7.js";import{S as ie,i as se,g as s,s as a,r as M,m as pe,E as me,h as p,f as l,c as i,j as Gt,u as f,x as $,n as Me,k as b,y as fe,a as n,v as u,d as c,t as r,w as o}from"../chunks/index.d7c1b260.js";import{T as ue}from"../chunks/Tip.c000e27b.js";import{C as g}from"../chunks/CodeBlock.09a08494.js";import{H as et,E as ce}from"../chunks/EditOnGithub.733546da.js";function re(lt){let m,j="💡 전체 학습은 V100 GPU 4개를 사용할 경우, 2시간이 소요됩니다.";return{c(){m=s("p"),m.textContent=j},l(U){m=p(U,"P",{"data-svelte-h":!0}),$(m)!=="svelte-1iy6zbw"&&(m.textContent=j)},m(U,K){n(U,m,K)},p:ae,d(U){U&&l(m)}}}function oe(lt){let m,j,U,K,w,nt,C,Rt="unconditional 이미지 생성은 text-to-image 또는 image-to-image 모델과 달리 텍스트나 이미지에 대한 조건이 없이 학습 데이터 분포와 유사한 이미지만을 생성합니다.",at,d,Vt,it,W,Yt='이 가이드에서는 기존에 존재하던 데이터셋과 자신만의 커스텀 데이터셋에 대해 unconditional image generation 모델을 훈련하는 방법을 설명합니다. 훈련 세부 사항에 대해 더 자세히 알고 싶다면 unconditional image generation을 위한 모든 학습 스크립트를 <a href="https://github.com/huggingface/diffusers/tree/main/examples/unconditional_image_generation" rel="nofollow">여기</a>에서 확인할 수 있습니다.',st,T,Ht="스크립트를 실행하기 전, 먼저 의존성 라이브러리들을 설치해야 합니다.",pt,Z,mt,x,Qt='그 다음 🤗 <a href="https://github.com/huggingface/accelerate/" rel="nofollow">Accelerate</a> 환경을 초기화합니다.',Mt,A,ft,N,kt='별도의 설정 없이 기본 설정으로 🤗 <a href="https://github.com/huggingface/accelerate/" rel="nofollow">Accelerate</a> 환경을 초기화해봅시다.',ut,v,ct,E,St="노트북과 같은 대화형 쉘을 지원하지 않는 환경의 경우, 다음과 같이 사용해볼 수도 있습니다.",rt,X,ot,J,$t,L,zt="학습 스크립트에 다음 인자를 추가하여 허브에 모델을 업로드할 수 있습니다.",Ut,G,dt,R,gt,V,Ft="훈련 중 문제가 발생할 경우를 대비하여 체크포인트를 정기적으로 저장하는 것이 좋습니다. 체크포인트를 저장하려면 학습 스크립트에 다음 인자를 전달합니다:",ht,Y,yt,H,It="전체 훈련 상태는 500스텝마다 <code>output_dir</code>의 하위 폴더에 저장되며, 학습 스크립트에 <code>--resume_from_checkpoint</code> 인자를 전달함으로써 체크포인트를 불러오고 훈련을 재개할 수 있습니다.",_t,Q,bt,k,jt,S,Pt='이제 학습 스크립트를 시작할 준비가 되었습니다! <code>--dataset_name</code> 인자에 파인튜닝할 데이터셋 이름을 지정한 다음, <code>--output_dir</code> 인자에 지정된 경로로 저장합니다. 본인만의 데이터셋를 사용하려면, <a href="create_dataset">학습용 데이터셋 만들기</a> 가이드를 참조하세요.',wt,z,Bt="학습 스크립트는 <code>diffusion_pytorch_model.bin</code> 파일을 생성하고, 그것을 당신의 리포지토리에 저장합니다.",Ct,h,Wt,F,qt='예를 들어, <a href="https://huggingface.co/datasets/huggan/flowers-102-categories" rel="nofollow">Oxford Flowers</a> 데이터셋을 사용해 파인튜닝할 경우:',Tt,I,Zt,y,Dt='<img src="https://user-images.githubusercontent.com/26864830/180248660-a0b143d0-b89a-42c5-8656-2ebf6ece7e52.png"/>',xt,P,At,_,Ot='<img src="https://user-images.githubusercontent.com/26864830/180248200-928953b4-db38-48db-b0c6-8b740fe6786f.png"/>',Nt,B,vt,q,Kt='<code>accelerate</code>을 사용하면 원활한 다중 GPU 훈련이 가능합니다. <code>accelerate</code>을 사용하여 분산 훈련을 실행하려면 <a href="https://huggingface.co/docs/accelerate/basic_tutorials/launch" rel="nofollow">여기</a> 지침을 따르세요. 다음은 명령어 예제입니다.',Et,D,Xt,O,Jt,tt,Lt;return w=new et({props:{title:"Unconditional 이미지 생성",local:"unconditional-이미지-생성",headingTag:"h1"}}),Z=new g({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRpZmZ1c2VycyU1QnRyYWluaW5nJTVEJTIwYWNjZWxlcmF0ZSUyMGRhdGFzZXRz",highlighted:"pip install diffusers[training] accelerate datasets",wrap:!1}}),A=new g({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),v=new g({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),X=new g({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}}),J=new et({props:{title:"모델을 허브에 업로드하기",local:"모델을-허브에-업로드하기",headingTag:"h2"}}),G=new g({props:{code:"LS1wdXNoX3RvX2h1Yg==",highlighted:"--push_to_hub",wrap:!1}}),R=new et({props:{title:"체크포인트 저장하고 불러오기",local:"체크포인트-저장하고-불러오기",headingTag:"h2"}}),Y=new g({props:{code:"LS1jaGVja3BvaW50aW5nX3N0ZXBzJTNENTAw",highlighted:"--checkpointing_steps=500",wrap:!1}}),Q=new g({props:{code:"LS1yZXN1bWVfZnJvbV9jaGVja3BvaW50JTNEJTIyY2hlY2twb2ludC0xNTAwJTIy",highlighted:'--resume_from_checkpoint=<span class="hljs-string">&quot;checkpoint-1500&quot;</span>',wrap:!1}}),k=new et({props:{title:"파인튜닝",local:"파인튜닝",headingTag:"h2"}}),h=new ue({props:{$$slots:{default:[re]},$$scope:{ctx:lt}}}),I=new g({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3VuY29uZGl0aW9uYWwucHklMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyMmh1Z2dhbiUyRmZsb3dlcnMtMTAyLWNhdGVnb3JpZXMlMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q2NCUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyMmRkcG0tZW1hLWZsb3dlcnMtNjQlMjIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxNiUyMCU1QyUwQSUyMCUyMC0tbnVtX2Vwb2NocyUzRDEwMCUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTQlMjAlNUMlMEElMjAlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDUwMCUyMCU1QyUwQSUyMCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEbm8lMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`accelerate launch train_unconditional.py \\
  --dataset_name=<span class="hljs-string">&quot;huggan/flowers-102-categories&quot;</span> \\
  --resolution=64 \\
  --output_dir=<span class="hljs-string">&quot;ddpm-ema-flowers-64&quot;</span> \\
  --train_batch_size=16 \\
  --num_epochs=100 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=1e-4 \\
  --lr_warmup_steps=500 \\
  --mixed_precision=no \\
  --push_to_hub`,wrap:!1}}),P=new g({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3VuY29uZGl0aW9uYWwucHklMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyMmh1Z2dhbiUyRnBva2Vtb24lMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q2NCUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyMmRkcG0tZW1hLXBva2Vtb24tNjQlMjIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxNiUyMCU1QyUwQSUyMCUyMC0tbnVtX2Vwb2NocyUzRDEwMCUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTQlMjAlNUMlMEElMjAlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDUwMCUyMCU1QyUwQSUyMCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEbm8lMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`accelerate launch train_unconditional.py \\
  --dataset_name=<span class="hljs-string">&quot;huggan/pokemon&quot;</span> \\
  --resolution=64 \\
  --output_dir=<span class="hljs-string">&quot;ddpm-ema-pokemon-64&quot;</span> \\
  --train_batch_size=16 \\
  --num_epochs=100 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=1e-4 \\
  --lr_warmup_steps=500 \\
  --mixed_precision=no \\
  --push_to_hub`,wrap:!1}}),B=new et({props:{title:"여러개의 GPU로 훈련하기",local:"여러개의-gpu로-훈련하기",headingTag:"h3"}}),D=new g({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMC0tbXVsdGlfZ3B1JTIwdHJhaW5fdW5jb25kaXRpb25hbC5weSUyMCU1QyUwQSUyMCUyMC0tZGF0YXNldF9uYW1lJTNEJTIyaHVnZ2FuJTJGcG9rZW1vbiUyMiUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDY0JTIwLS1jZW50ZXJfY3JvcCUyMC0tcmFuZG9tX2ZsaXAlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjJkZHBtLWVtYS1wb2tlbW9uLTY0JTIyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMTYlMjAlNUMlMEElMjAlMjAtLW51bV9lcG9jaHMlM0QxMDAlMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMjAlNUMlMEElMjAlMjAtLXVzZV9lbWElMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0QxZS00JTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0Q1MDAlMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjIlMjAlNUMlMEElMjAlMjAtLWxvZ2dlciUzRCUyMndhbmRiJTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> --multi_gpu train_unconditional.py \\
  --dataset_name=<span class="hljs-string">&quot;huggan/pokemon&quot;</span> \\
  --resolution=64 --center_crop --random_flip \\
  --output_dir=<span class="hljs-string">&quot;ddpm-ema-pokemon-64&quot;</span> \\
  --train_batch_size=16 \\
  --num_epochs=100 \\
  --gradient_accumulation_steps=1 \\
  --use_ema \\
  --learning_rate=1e-4 \\
  --lr_warmup_steps=500 \\
  --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> \\
  --logger=<span class="hljs-string">&quot;wandb&quot;</span> \\
  --push_to_hub`,wrap:!1}}),O=new ce({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/training/unconditional_training.md"}}),{c(){m=s("meta"),j=a(),U=s("p"),K=a(),M(w.$$.fragment),nt=a(),C=s("p"),C.textContent=Rt,at=a(),d=s("iframe"),it=a(),W=s("p"),W.innerHTML=Yt,st=a(),T=s("p"),T.textContent=Ht,pt=a(),M(Z.$$.fragment),mt=a(),x=s("p"),x.innerHTML=Qt,Mt=a(),M(A.$$.fragment),ft=a(),N=s("p"),N.innerHTML=kt,ut=a(),M(v.$$.fragment),ct=a(),E=s("p"),E.textContent=St,rt=a(),M(X.$$.fragment),ot=a(),M(J.$$.fragment),$t=a(),L=s("p"),L.textContent=zt,Ut=a(),M(G.$$.fragment),dt=a(),M(R.$$.fragment),gt=a(),V=s("p"),V.textContent=Ft,ht=a(),M(Y.$$.fragment),yt=a(),H=s("p"),H.innerHTML=It,_t=a(),M(Q.$$.fragment),bt=a(),M(k.$$.fragment),jt=a(),S=s("p"),S.innerHTML=Pt,wt=a(),z=s("p"),z.innerHTML=Bt,Ct=a(),M(h.$$.fragment),Wt=a(),F=s("p"),F.innerHTML=qt,Tt=a(),M(I.$$.fragment),Zt=a(),y=s("div"),y.innerHTML=Dt,xt=pe(`
[Pokemon](https://huggingface.co/datasets/huggan/pokemon) 데이터셋을 사용할 경우:

	`),M(P.$$.fragment),At=a(),_=s("div"),_.innerHTML=Ot,Nt=a(),M(B.$$.fragment),vt=a(),q=s("p"),q.innerHTML=Kt,Et=a(),M(D.$$.fragment),Xt=a(),M(O.$$.fragment),Jt=a(),tt=s("p"),this.h()},l(t){const e=me("svelte-u9bgzb",document.head);m=p(e,"META",{name:!0,content:!0}),e.forEach(l),j=i(t),U=p(t,"P",{}),Gt(U).forEach(l),K=i(t),f(w.$$.fragment,t),nt=i(t),C=p(t,"P",{"data-svelte-h":!0}),$(C)!=="svelte-11cek6f"&&(C.textContent=Rt),at=i(t),d=p(t,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Gt(d).forEach(l),it=i(t),W=p(t,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1k5g2a5"&&(W.innerHTML=Yt),st=i(t),T=p(t,"P",{"data-svelte-h":!0}),$(T)!=="svelte-3u8bru"&&(T.textContent=Ht),pt=i(t),f(Z.$$.fragment,t),mt=i(t),x=p(t,"P",{"data-svelte-h":!0}),$(x)!=="svelte-1k19jiw"&&(x.innerHTML=Qt),Mt=i(t),f(A.$$.fragment,t),ft=i(t),N=p(t,"P",{"data-svelte-h":!0}),$(N)!=="svelte-ai9532"&&(N.innerHTML=kt),ut=i(t),f(v.$$.fragment,t),ct=i(t),E=p(t,"P",{"data-svelte-h":!0}),$(E)!=="svelte-ejz7fm"&&(E.textContent=St),rt=i(t),f(X.$$.fragment,t),ot=i(t),f(J.$$.fragment,t),$t=i(t),L=p(t,"P",{"data-svelte-h":!0}),$(L)!=="svelte-1v07mr9"&&(L.textContent=zt),Ut=i(t),f(G.$$.fragment,t),dt=i(t),f(R.$$.fragment,t),gt=i(t),V=p(t,"P",{"data-svelte-h":!0}),$(V)!=="svelte-oc22co"&&(V.textContent=Ft),ht=i(t),f(Y.$$.fragment,t),yt=i(t),H=p(t,"P",{"data-svelte-h":!0}),$(H)!=="svelte-snfiee"&&(H.innerHTML=It),_t=i(t),f(Q.$$.fragment,t),bt=i(t),f(k.$$.fragment,t),jt=i(t),S=p(t,"P",{"data-svelte-h":!0}),$(S)!=="svelte-1apcfe4"&&(S.innerHTML=Pt),wt=i(t),z=p(t,"P",{"data-svelte-h":!0}),$(z)!=="svelte-j3u7pw"&&(z.innerHTML=Bt),Ct=i(t),f(h.$$.fragment,t),Wt=i(t),F=p(t,"P",{"data-svelte-h":!0}),$(F)!=="svelte-1mxtjpt"&&(F.innerHTML=qt),Tt=i(t),f(I.$$.fragment,t),Zt=i(t),y=p(t,"DIV",{class:!0,"data-svelte-h":!0}),$(y)!=="svelte-bqefob"&&(y.innerHTML=Dt),xt=Me(t,`
[Pokemon](https://huggingface.co/datasets/huggan/pokemon) 데이터셋을 사용할 경우:

	`),f(P.$$.fragment,t),At=i(t),_=p(t,"DIV",{class:!0,"data-svelte-h":!0}),$(_)!=="svelte-kyasla"&&(_.innerHTML=Ot),Nt=i(t),f(B.$$.fragment,t),vt=i(t),q=p(t,"P",{"data-svelte-h":!0}),$(q)!=="svelte-thi158"&&(q.innerHTML=Kt),Et=i(t),f(D.$$.fragment,t),Xt=i(t),f(O.$$.fragment,t),Jt=i(t),tt=p(t,"P",{}),Gt(tt).forEach(l),this.h()},h(){b(m,"name","hf:doc:metadata"),b(m,"content",$e),le(d.src,Vt="https://stevhliu-ddpm-butterflies-128.hf.space")||b(d,"src",Vt),b(d,"frameborder","0"),b(d,"width","850"),b(d,"height","550"),b(y,"class","flex justify-center"),b(_,"class","flex justify-center")},m(t,e){fe(document.head,m),n(t,j,e),n(t,U,e),n(t,K,e),u(w,t,e),n(t,nt,e),n(t,C,e),n(t,at,e),n(t,d,e),n(t,it,e),n(t,W,e),n(t,st,e),n(t,T,e),n(t,pt,e),u(Z,t,e),n(t,mt,e),n(t,x,e),n(t,Mt,e),u(A,t,e),n(t,ft,e),n(t,N,e),n(t,ut,e),u(v,t,e),n(t,ct,e),n(t,E,e),n(t,rt,e),u(X,t,e),n(t,ot,e),u(J,t,e),n(t,$t,e),n(t,L,e),n(t,Ut,e),u(G,t,e),n(t,dt,e),u(R,t,e),n(t,gt,e),n(t,V,e),n(t,ht,e),u(Y,t,e),n(t,yt,e),n(t,H,e),n(t,_t,e),u(Q,t,e),n(t,bt,e),u(k,t,e),n(t,jt,e),n(t,S,e),n(t,wt,e),n(t,z,e),n(t,Ct,e),u(h,t,e),n(t,Wt,e),n(t,F,e),n(t,Tt,e),u(I,t,e),n(t,Zt,e),n(t,y,e),n(t,xt,e),u(P,t,e),n(t,At,e),n(t,_,e),n(t,Nt,e),u(B,t,e),n(t,vt,e),n(t,q,e),n(t,Et,e),u(D,t,e),n(t,Xt,e),u(O,t,e),n(t,Jt,e),n(t,tt,e),Lt=!0},p(t,[e]){const te={};e&2&&(te.$$scope={dirty:e,ctx:t}),h.$set(te)},i(t){Lt||(c(w.$$.fragment,t),c(Z.$$.fragment,t),c(A.$$.fragment,t),c(v.$$.fragment,t),c(X.$$.fragment,t),c(J.$$.fragment,t),c(G.$$.fragment,t),c(R.$$.fragment,t),c(Y.$$.fragment,t),c(Q.$$.fragment,t),c(k.$$.fragment,t),c(h.$$.fragment,t),c(I.$$.fragment,t),c(P.$$.fragment,t),c(B.$$.fragment,t),c(D.$$.fragment,t),c(O.$$.fragment,t),Lt=!0)},o(t){r(w.$$.fragment,t),r(Z.$$.fragment,t),r(A.$$.fragment,t),r(v.$$.fragment,t),r(X.$$.fragment,t),r(J.$$.fragment,t),r(G.$$.fragment,t),r(R.$$.fragment,t),r(Y.$$.fragment,t),r(Q.$$.fragment,t),r(k.$$.fragment,t),r(h.$$.fragment,t),r(I.$$.fragment,t),r(P.$$.fragment,t),r(B.$$.fragment,t),r(D.$$.fragment,t),r(O.$$.fragment,t),Lt=!1},d(t){t&&(l(j),l(U),l(K),l(nt),l(C),l(at),l(d),l(it),l(W),l(st),l(T),l(pt),l(mt),l(x),l(Mt),l(ft),l(N),l(ut),l(ct),l(E),l(rt),l(ot),l($t),l(L),l(Ut),l(dt),l(gt),l(V),l(ht),l(yt),l(H),l(_t),l(bt),l(jt),l(S),l(wt),l(z),l(Ct),l(Wt),l(F),l(Tt),l(Zt),l(y),l(xt),l(At),l(_),l(Nt),l(vt),l(q),l(Et),l(Xt),l(Jt),l(tt)),l(m),o(w,t),o(Z,t),o(A,t),o(v,t),o(X,t),o(J,t),o(G,t),o(R,t),o(Y,t),o(Q,t),o(k,t),o(h,t),o(I,t),o(P,t),o(B,t),o(D,t),o(O,t)}}}const $e='{"title":"Unconditional 이미지 생성","local":"unconditional-이미지-생성","sections":[{"title":"모델을 허브에 업로드하기","local":"모델을-허브에-업로드하기","sections":[],"depth":2},{"title":"체크포인트 저장하고 불러오기","local":"체크포인트-저장하고-불러오기","sections":[],"depth":2},{"title":"파인튜닝","local":"파인튜닝","sections":[{"title":"여러개의 GPU로 훈련하기","local":"여러개의-gpu로-훈련하기","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ue(lt){return ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ie{constructor(m){super(),se(this,m,Ue,oe,ee,{})}}export{be as component};
