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

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

	`),f(P.$$.fragment,t),xt=i(t),_=p(t,"DIV",{class:!0,"data-svelte-h":!0}),$(_)!=="svelte-kyasla"&&(_.innerHTML=qt),At=i(t),f(B.$$.fragment,t),Nt=i(t),q=p(t,"P",{"data-svelte-h":!0}),$(q)!=="svelte-thi158"&&(q.innerHTML=Dt),vt=i(t),f(D.$$.fragment,t),Xt=i(t),O=p(t,"P",{}),Jt(O).forEach(l),this.h()},h(){j(m,"name","hf:doc:metadata"),j(m,"content",ce),te(d.src,Rt="https://stevhliu-ddpm-butterflies-128.hf.space")||j(d,"src",Rt),j(d,"frameborder","0"),j(d,"width","850"),j(d,"height","550"),j(y,"class","flex justify-center"),j(_,"class","flex justify-center")},m(t,e){me(document.head,m),n(t,b,e),n(t,U,e),n(t,K,e),u(w,t,e),n(t,lt,e),n(t,C,e),n(t,nt,e),n(t,d,e),n(t,at,e),n(t,W,e),n(t,it,e),n(t,T,e),n(t,st,e),u(Z,t,e),n(t,pt,e),n(t,x,e),n(t,mt,e),u(A,t,e),n(t,Mt,e),n(t,N,e),n(t,ft,e),u(v,t,e),n(t,ut,e),n(t,X,e),n(t,ct,e),u(E,t,e),n(t,rt,e),u(J,t,e),n(t,ot,e),n(t,L,e),n(t,$t,e),u(R,t,e),n(t,Ut,e),u(G,t,e),n(t,dt,e),n(t,V,e),n(t,ht,e),u(Y,t,e),n(t,gt,e),n(t,H,e),n(t,yt,e),u(Q,t,e),n(t,_t,e),u(k,t,e),n(t,jt,e),n(t,S,e),n(t,bt,e),n(t,z,e),n(t,wt,e),u(g,t,e),n(t,Ct,e),n(t,F,e),n(t,Wt,e),u(I,t,e),n(t,Tt,e),n(t,y,e),n(t,Zt,e),u(P,t,e),n(t,xt,e),n(t,_,e),n(t,At,e),u(B,t,e),n(t,Nt,e),n(t,q,e),n(t,vt,e),u(D,t,e),n(t,Xt,e),n(t,O,e),Et=!0},p(t,[e]){const Kt={};e&2&&(Kt.$$scope={dirty:e,ctx:t}),g.$set(Kt)},i(t){Et||(c(w.$$.fragment,t),c(Z.$$.fragment,t),c(A.$$.fragment,t),c(v.$$.fragment,t),c(E.$$.fragment,t),c(J.$$.fragment,t),c(R.$$.fragment,t),c(G.$$.fragment,t),c(Y.$$.fragment,t),c(Q.$$.fragment,t),c(k.$$.fragment,t),c(g.$$.fragment,t),c(I.$$.fragment,t),c(P.$$.fragment,t),c(B.$$.fragment,t),c(D.$$.fragment,t),Et=!0)},o(t){r(w.$$.fragment,t),r(Z.$$.fragment,t),r(A.$$.fragment,t),r(v.$$.fragment,t),r(E.$$.fragment,t),r(J.$$.fragment,t),r(R.$$.fragment,t),r(G.$$.fragment,t),r(Y.$$.fragment,t),r(Q.$$.fragment,t),r(k.$$.fragment,t),r(g.$$.fragment,t),r(I.$$.fragment,t),r(P.$$.fragment,t),r(B.$$.fragment,t),r(D.$$.fragment,t),Et=!1},d(t){t&&(l(b),l(U),l(K),l(lt),l(C),l(nt),l(d),l(at),l(W),l(it),l(T),l(st),l(pt),l(x),l(mt),l(Mt),l(N),l(ft),l(ut),l(X),l(ct),l(rt),l(ot),l(L),l($t),l(Ut),l(dt),l(V),l(ht),l(gt),l(H),l(yt),l(_t),l(jt),l(S),l(bt),l(z),l(wt),l(Ct),l(F),l(Wt),l(Tt),l(y),l(Zt),l(xt),l(_),l(At),l(Nt),l(q),l(vt),l(Xt),l(O)),l(m),o(w,t),o(Z,t),o(A,t),o(v,t),o(E,t),o(J,t),o(R,t),o(G,t),o(Y,t),o(Q,t),o(k,t),o(g,t),o(I,t),o(P,t),o(B,t),o(D,t)}}}const ce='{"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 re(et){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends ne{constructor(m){super(),ae(this,m,re,ue,Ot,{})}}export{ge as component};
