import{s as Pa,o as Ka,n as Ms}from"../chunks/scheduler.bdbef820.js";import{S as Oa,i as sl,g as w,s as m,r as h,A as al,h as d,f as a,c,j as Da,u as y,x as _,k as Za,y as ll,a as l,v as j,d as u,t as g,w as b}from"../chunks/index.33f81d56.js";import{T as _a}from"../chunks/Tip.34194030.js";import{Y as tl}from"../chunks/Youtube.0e329b00.js";import{C as v}from"../chunks/CodeBlock.362b34a4.js";import{D as el}from"../chunks/DocNotebookDropdown.d5db5928.js";import{F as xs,M as zs}from"../chunks/Markdown.03194dea.js";import{H as Bs,E as nl}from"../chunks/EditOnGithub.a9246e21.js";function pl(X){let t,M='이 작업과 호환되는 모든 아키텍처와 체크포인트를 보려면 <a href="https://huggingface.co/tasks/image-classification" rel="nofollow">작업 페이지</a>를 확인하는 것이 좋습니다.';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-rbw0jx"&&(t.innerHTML=M)},m(e,i){l(e,t,i)},p:Ms,d(e){e&&a(t)}}}function rl(X){let t,M='이미지에 몇 가지 이미지 변환을 적용하여 과적합에 대해 모델을 더 견고하게 만듭니다. 여기서 Torchvision의 <a href="https://pytorch.org/vision/stable/transforms.html" rel="nofollow"><code>transforms</code></a> 모듈을 사용하지만, 원하는 이미지 라이브러리를 사용할 수도 있습니다.',e,i,T="이미지의 임의 부분을 크롭하고 크기를 조정한 다음, 이미지 평균과 표준 편차로 정규화하세요:",C,Y,W,Z,F="그런 다음 전처리 함수를 만들어 변환을 적용하고 이미지의 <code>pixel_values</code>(모델에 대한 입력)를 반환하세요:",I,V,R,$,x="전체 데이터 세트에 전처리 기능을 적용하려면 🤗 Datasets <code>with_transform</code>을 사용합니다. 데이터 세트의 요소를 가져올 때 변환이 즉시 적용됩니다:",r,U,N,G,z='이제 <a href="/docs/transformers/pr_22105/ko/main_classes/data_collator#transformers.DefaultDataCollator">DefaultDataCollator</a>를 사용하여 예제 배치를 만듭니다. 🤗 Transformers의 다른 데이터 콜레이터와 달리, <code>DefaultDataCollator</code>는 패딩과 같은 추가적인 전처리를 적용하지 않습니다.',p,J,E;return Y=new v({props:{code:"ZnJvbSUyMHRvcmNodmlzaW9uLnRyYW5zZm9ybXMlMjBpbXBvcnQlMjBSYW5kb21SZXNpemVkQ3JvcCUyQyUyMENvbXBvc2UlMkMlMjBOb3JtYWxpemUlMkMlMjBUb1RlbnNvciUwQSUwQW5vcm1hbGl6ZSUyMCUzRCUyME5vcm1hbGl6ZShtZWFuJTNEaW1hZ2VfcHJvY2Vzc29yLmltYWdlX21lYW4lMkMlMjBzdGQlM0RpbWFnZV9wcm9jZXNzb3IuaW1hZ2Vfc3RkKSUwQXNpemUlMjAlM0QlMjAoJTBBJTIwJTIwJTIwJTIwaW1hZ2VfcHJvY2Vzc29yLnNpemUlNUIlMjJzaG9ydGVzdF9lZGdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwaWYlMjAlMjJzaG9ydGVzdF9lZGdlJTIyJTIwaW4lMjBpbWFnZV9wcm9jZXNzb3Iuc2l6ZSUwQSUyMCUyMCUyMCUyMGVsc2UlMjAoaW1hZ2VfcHJvY2Vzc29yLnNpemUlNUIlMjJoZWlnaHQlMjIlNUQlMkMlMjBpbWFnZV9wcm9jZXNzb3Iuc2l6ZSU1QiUyMndpZHRoJTIyJTVEKSUwQSklMEFfdHJhbnNmb3JtcyUyMCUzRCUyMENvbXBvc2UoJTVCUmFuZG9tUmVzaXplZENyb3Aoc2l6ZSklMkMlMjBUb1RlbnNvcigpJTJDJTIwbm9ybWFsaXplJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torchvision.transforms <span class="hljs-keyword">import</span> RandomResizedCrop, Compose, Normalize, ToTensor

<span class="hljs-meta">&gt;&gt;&gt; </span>normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)
<span class="hljs-meta">&gt;&gt;&gt; </span>size = (
<span class="hljs-meta">... </span>    image_processor.size[<span class="hljs-string">&quot;shortest_edge&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;shortest_edge&quot;</span> <span class="hljs-keyword">in</span> image_processor.size
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span> (image_processor.size[<span class="hljs-string">&quot;height&quot;</span>], image_processor.size[<span class="hljs-string">&quot;width&quot;</span>])
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>_transforms = Compose([RandomResizedCrop(size), ToTensor(), normalize])`,wrap:!1}}),V=new v({props:{code:"ZGVmJTIwdHJhbnNmb3JtcyhleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBleGFtcGxlcyU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1Ql90cmFuc2Zvcm1zKGltZy5jb252ZXJ0KCUyMlJHQiUyMikpJTIwZm9yJTIwaW1nJTIwaW4lMjBleGFtcGxlcyU1QiUyMmltYWdlJTIyJTVEJTVEJTBBJTIwJTIwJTIwJTIwZGVsJTIwZXhhbXBsZXMlNUIlMjJpbWFnZSUyMiU1RCUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGV4YW1wbGVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">transforms</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    examples[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [_transforms(img.convert(<span class="hljs-string">&quot;RGB&quot;</span>)) <span class="hljs-keyword">for</span> img <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;image&quot;</span>]]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">del</span> examples[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> examples`,wrap:!1}}),U=new v({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2Qud2l0aF90cmFuc2Zvcm0odHJhbnNmb3Jtcyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.with_transform(transforms)',wrap:!1}}),J=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator()`,wrap:!1}}),{c(){t=w("p"),t.innerHTML=M,e=m(),i=w("p"),i.textContent=T,C=m(),h(Y.$$.fragment),W=m(),Z=w("p"),Z.innerHTML=F,I=m(),h(V.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),G=w("p"),G.innerHTML=z,p=m(),h(J.$$.fragment)},l(f){t=d(f,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1vagpvi"&&(t.innerHTML=M),e=c(f),i=d(f,"P",{"data-svelte-h":!0}),_(i)!=="svelte-10faf4m"&&(i.textContent=T),C=c(f),y(Y.$$.fragment,f),W=c(f),Z=d(f,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-1d0gj87"&&(Z.innerHTML=F),I=c(f),y(V.$$.fragment,f),R=c(f),$=d(f,"P",{"data-svelte-h":!0}),_($)!=="svelte-aqavc3"&&($.innerHTML=x),r=c(f),y(U.$$.fragment,f),N=c(f),G=d(f,"P",{"data-svelte-h":!0}),_(G)!=="svelte-19o1q40"&&(G.innerHTML=z),p=c(f),y(J.$$.fragment,f)},m(f,B){l(f,t,B),l(f,e,B),l(f,i,B),l(f,C,B),j(Y,f,B),l(f,W,B),l(f,Z,B),l(f,I,B),j(V,f,B),l(f,R,B),l(f,$,B),l(f,r,B),j(U,f,B),l(f,N,B),l(f,G,B),l(f,p,B),j(J,f,B),E=!0},p:Ms,i(f){E||(u(Y.$$.fragment,f),u(V.$$.fragment,f),u(U.$$.fragment,f),u(J.$$.fragment,f),E=!0)},o(f){g(Y.$$.fragment,f),g(V.$$.fragment,f),g(U.$$.fragment,f),g(J.$$.fragment,f),E=!1},d(f){f&&(a(t),a(e),a(i),a(C),a(W),a(Z),a(I),a(R),a($),a(r),a(N),a(G),a(p)),b(Y,f),b(V,f),b(U,f),b(J,f)}}}function ml(X){let t,M;return t=new zs({props:{$$slots:{default:[rl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function cl(X){let t,M=`과적합을 방지하고 모델을 보다 견고하게 만들기 위해 데이터 세트의 훈련 부분에 데이터 증강을 추가합니다.
여기서 Keras 전처리 레이어로 훈련 데이터에 대한 변환(데이터 증강 포함)과
검증 데이터에 대한 변환(중앙 크로핑, 크기 조정, 정규화만)을 정의합니다.
<code>tf.image</code> 또는 다른 원하는 라이브러리를 사용할 수 있습니다.`,e,i,T,C,Y="다음으로 한 번에 하나의 이미지가 아니라 이미지 배치에 적절한 변환을 적용하는 함수를 만듭니다.",W,Z,F,I,V="🤗 Datasets <code>set_transform</code>를 사용하여 즉시 변환을 적용하세요:",R,$,x,r,U=`최종 전처리 단계로 <code>DefaultDataCollator</code>를 사용하여 예제 배치를 만듭니다. 🤗 Transformers의 다른 데이터 콜레이터와 달리
<code>DefaultDataCollator</code>는 패딩과 같은 추가 전처리를 적용하지 않습니다.`,N,G,z;return i=new v({props:{code:"ZnJvbSUyMHRlbnNvcmZsb3clMjBpbXBvcnQlMjBrZXJhcyUwQWZyb20lMjB0ZW5zb3JmbG93LmtlcmFzJTIwaW1wb3J0JTIwbGF5ZXJzJTBBJTBBc2l6ZSUyMCUzRCUyMChpbWFnZV9wcm9jZXNzb3Iuc2l6ZSU1QiUyMmhlaWdodCUyMiU1RCUyQyUyMGltYWdlX3Byb2Nlc3Nvci5zaXplJTVCJTIyd2lkdGglMjIlNUQpJTBBJTBBdHJhaW5fZGF0YV9hdWdtZW50YXRpb24lMjAlM0QlMjBrZXJhcy5TZXF1ZW50aWFsKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxheWVycy5SYW5kb21Dcm9wKHNpemUlNUIwJTVEJTJDJTIwc2l6ZSU1QjElNUQpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJlc2NhbGluZyhzY2FsZSUzRDEuMCUyMCUyRiUyMDEyNy41JTJDJTIwb2Zmc2V0JTNELTEpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJhbmRvbUZsaXAoJTIyaG9yaXpvbnRhbCUyMiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYXllcnMuUmFuZG9tUm90YXRpb24oZmFjdG9yJTNEMC4wMiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYXllcnMuUmFuZG9tWm9vbShoZWlnaHRfZmFjdG9yJTNEMC4yJTJDJTIwd2lkdGhfZmFjdG9yJTNEMC4yKSUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMG5hbWUlM0QlMjJ0cmFpbl9kYXRhX2F1Z21lbnRhdGlvbiUyMiUyQyUwQSklMEElMEF2YWxfZGF0YV9hdWdtZW50YXRpb24lMjAlM0QlMjBrZXJhcy5TZXF1ZW50aWFsKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxheWVycy5DZW50ZXJDcm9wKHNpemUlNUIwJTVEJTJDJTIwc2l6ZSU1QjElNUQpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJlc2NhbGluZyhzY2FsZSUzRDEuMCUyMCUyRiUyMDEyNy41JTJDJTIwb2Zmc2V0JTNELTEpJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMnZhbF9kYXRhX2F1Z21lbnRhdGlvbiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow <span class="hljs-keyword">import</span> keras
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow.keras <span class="hljs-keyword">import</span> layers

<span class="hljs-meta">&gt;&gt;&gt; </span>size = (image_processor.size[<span class="hljs-string">&quot;height&quot;</span>], image_processor.size[<span class="hljs-string">&quot;width&quot;</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>train_data_augmentation = keras.Sequential(
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        layers.RandomCrop(size[<span class="hljs-number">0</span>], size[<span class="hljs-number">1</span>]),
<span class="hljs-meta">... </span>        layers.Rescaling(scale=<span class="hljs-number">1.0</span> / <span class="hljs-number">127.5</span>, offset=-<span class="hljs-number">1</span>),
<span class="hljs-meta">... </span>        layers.RandomFlip(<span class="hljs-string">&quot;horizontal&quot;</span>),
<span class="hljs-meta">... </span>        layers.RandomRotation(factor=<span class="hljs-number">0.02</span>),
<span class="hljs-meta">... </span>        layers.RandomZoom(height_factor=<span class="hljs-number">0.2</span>, width_factor=<span class="hljs-number">0.2</span>),
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>    name=<span class="hljs-string">&quot;train_data_augmentation&quot;</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>val_data_augmentation = keras.Sequential(
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        layers.CenterCrop(size[<span class="hljs-number">0</span>], size[<span class="hljs-number">1</span>]),
<span class="hljs-meta">... </span>        layers.Rescaling(scale=<span class="hljs-number">1.0</span> / <span class="hljs-number">127.5</span>, offset=-<span class="hljs-number">1</span>),
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>    name=<span class="hljs-string">&quot;val_data_augmentation&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Z=new v({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEElMEFkZWYlMjBjb252ZXJ0X3RvX3RmX3RlbnNvcihpbWFnZSUzQSUyMEltYWdlKSUzQSUwQSUyMCUyMCUyMCUyMG5wX2ltYWdlJTIwJTNEJTIwbnAuYXJyYXkoaW1hZ2UpJTBBJTIwJTIwJTIwJTIwdGZfaW1hZ2UlMjAlM0QlMjB0Zi5jb252ZXJ0X3RvX3RlbnNvcihucF9pbWFnZSklMEElMjAlMjAlMjAlMjAlMjMlMjAlNjBleHBhbmRfZGltcygpJTYwJTIwaXMlMjB1c2VkJTIwdG8lMjBhZGQlMjBhJTIwYmF0Y2glMjBkaW1lbnNpb24lMjBzaW5jZSUwQSUyMCUyMCUyMCUyMCUyMyUyMHRoZSUyMFRGJTIwYXVnbWVudGF0aW9uJTIwbGF5ZXJzJTIwb3BlcmF0ZXMlMjBvbiUyMGJhdGNoZWQlMjBpbnB1dHMuJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdGYuZXhwYW5kX2RpbXModGZfaW1hZ2UlMkMlMjAwKSUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfdHJhaW4oZXhhbXBsZV9iYXRjaCklM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJBcHBseSUyMHRyYWluX3RyYW5zZm9ybXMlMjBhY3Jvc3MlMjBhJTIwYmF0Y2guJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwaW1hZ2VzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHJhaW5fZGF0YV9hdWdtZW50YXRpb24oY29udmVydF90b190Zl90ZW5zb3IoaW1hZ2UuY29udmVydCglMjJSR0IlMjIpKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZV9iYXRjaCU1QiUyMmltYWdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwZXhhbXBsZV9iYXRjaCU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRmLnRyYW5zcG9zZSh0Zi5zcXVlZXplKGltYWdlKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwaW1hZ2VzJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZV9iYXRjaCUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfdmFsKGV4YW1wbGVfYmF0Y2gpJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyQXBwbHklMjB2YWxfdHJhbnNmb3JtcyUyMGFjcm9zcyUyMGElMjBiYXRjaC4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB2YWxfZGF0YV9hdWdtZW50YXRpb24oY29udmVydF90b190Zl90ZW5zb3IoaW1hZ2UuY29udmVydCglMjJSR0IlMjIpKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZV9iYXRjaCU1QiUyMmltYWdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwZXhhbXBsZV9iYXRjaCU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRmLnRyYW5zcG9zZSh0Zi5zcXVlZXplKGltYWdlKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwaW1hZ2VzJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZV9iYXRjaA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">convert_to_tf_tensor</span>(<span class="hljs-params">image: Image</span>):
<span class="hljs-meta">... </span>    np_image = np.array(image)
<span class="hljs-meta">... </span>    tf_image = tf.convert_to_tensor(np_image)
<span class="hljs-meta">... </span>    <span class="hljs-comment"># \`expand_dims()\` is used to add a batch dimension since</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># the TF augmentation layers operates on batched inputs.</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tf.expand_dims(tf_image, <span class="hljs-number">0</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_train</span>(<span class="hljs-params">example_batch</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;Apply train_transforms across a batch.&quot;&quot;&quot;</span>
<span class="hljs-meta">... </span>    images = [
<span class="hljs-meta">... </span>        train_data_augmentation(convert_to_tf_tensor(image.convert(<span class="hljs-string">&quot;RGB&quot;</span>))) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> example_batch[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>    example_batch[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [tf.transpose(tf.squeeze(image)) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> example_batch


<span class="hljs-meta">... </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_val</span>(<span class="hljs-params">example_batch</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;Apply val_transforms across a batch.&quot;&quot;&quot;</span>
<span class="hljs-meta">... </span>    images = [
<span class="hljs-meta">... </span>        val_data_augmentation(convert_to_tf_tensor(image.convert(<span class="hljs-string">&quot;RGB&quot;</span>))) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> example_batch[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>    example_batch[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [tf.transpose(tf.squeeze(image)) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> example_batch`,wrap:!1}}),$=new v({props:{code:"Zm9vZCU1QiUyMnRyYWluJTIyJTVELnNldF90cmFuc2Zvcm0ocHJlcHJvY2Vzc190cmFpbiklMEFmb29kJTVCJTIydGVzdCUyMiU1RC5zZXRfdHJhbnNmb3JtKHByZXByb2Nlc3NfdmFsKQ==",highlighted:`food[<span class="hljs-string">&quot;train&quot;</span>].set_transform(preprocess_train)
food[<span class="hljs-string">&quot;test&quot;</span>].set_transform(preprocess_val)`,wrap:!1}}),G=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcihyZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator(return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){t=w("p"),t.innerHTML=M,e=m(),h(i.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(G.$$.fragment)},l(p){t=d(p,"P",{"data-svelte-h":!0}),_(t)!=="svelte-184q600"&&(t.innerHTML=M),e=c(p),y(i.$$.fragment,p),T=c(p),C=d(p,"P",{"data-svelte-h":!0}),_(C)!=="svelte-gi5xdk"&&(C.textContent=Y),W=c(p),y(Z.$$.fragment,p),F=c(p),I=d(p,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1yygzze"&&(I.innerHTML=V),R=c(p),y($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-1cqrr7b"&&(r.innerHTML=U),N=c(p),y(G.$$.fragment,p)},m(p,J){l(p,t,J),l(p,e,J),j(i,p,J),l(p,T,J),l(p,C,J),l(p,W,J),j(Z,p,J),l(p,F,J),l(p,I,J),l(p,R,J),j($,p,J),l(p,x,J),l(p,r,J),l(p,N,J),j(G,p,J),z=!0},p:Ms,i(p){z||(u(i.$$.fragment,p),u(Z.$$.fragment,p),u($.$$.fragment,p),u(G.$$.fragment,p),z=!0)},o(p){g(i.$$.fragment,p),g(Z.$$.fragment,p),g($.$$.fragment,p),g(G.$$.fragment,p),z=!1},d(p){p&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R),a(x),a(r),a(N)),b(i,p),b(Z,p),b($,p),b(G,p)}}}function ol(X){let t,M;return t=new zs({props:{$$slots:{default:[cl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function il(X){let t,M='<a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.Trainer">Trainer</a>를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않은 경우, <a href="../training#train-with-pytorch-trainer">여기</a>에서 기본 튜토리얼을 확인하세요!';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-12ln59k"&&(t.innerHTML=M)},m(e,i){l(e,t,i)},p:Ms,d(e){e&&a(t)}}}function Ml(X){let t,M,e,i='이제 모델을 훈련시킬 준비가 되었습니다! <a href="/docs/transformers/pr_22105/ko/model_doc/auto#transformers.AutoModelForImageClassification">AutoModelForImageClassification</a>로 ViT를 가져옵니다. 예상되는 레이블 수, 레이블 매핑 및 레이블 수를 지정하세요:',T,C,Y,W,Z="이제 세 단계만 거치면 끝입니다:",F,I,V='<li><a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>에서 훈련 하이퍼파라미터를 정의하세요. <code>image</code> 열이 삭제되기 때문에 미사용 열을 제거하지 않는 것이 중요합니다. <code>image</code> 열이 없으면 <code>pixel_values</code>을 생성할 수 없습니다. 이 동작을 방지하려면 <code>remove_unused_columns=False</code>로 설정하세요! 다른 유일한 필수 매개변수는 모델 저장 위치를 지정하는 <code>output_dir</code>입니다. <code>push_to_hub=True</code>로 설정하면 이 모델을 허브에 푸시합니다(모델을 업로드하려면 Hugging Face에 로그인해야 합니다). 각 에폭이 끝날 때마다, <a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.Trainer">Trainer</a>가 정확도를 평가하고 훈련 체크포인트를 저장합니다.</li> <li><a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.Trainer">Trainer</a>에 모델, 데이터 세트, 토크나이저, 데이터 콜레이터 및 <code>compute_metrics</code> 함수와 함께 훈련 인수를 전달하세요.</li> <li><a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.Trainer.train">train()</a>을 호출하여 모델을 미세 조정하세요.</li>',R,$,x,r,U='훈련이 완료되면, 모든 사람이 모델을 사용할 수 있도록 <a href="/docs/transformers/pr_22105/ko/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> 메소드로 모델을 허브에 공유하세요:',N,G,z;return t=new _a({props:{$$slots:{default:[il]},$$scope:{ctx:X}}}),C=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMkMlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFRyYWluZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMGNoZWNrcG9pbnQlMkMlMEElMjAlMjAlMjAlMjBudW1fbGFiZWxzJTNEbGVuKGxhYmVscyklMkMlMEElMjAlMjAlMjAlMjBpZDJsYWJlbCUzRGlkMmxhYmVsJTJDJTBBJTIwJTIwJTIwJTIwbGFiZWwyaWQlM0RsYWJlbDJpZCUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(
<span class="hljs-meta">... </span>    checkpoint,
<span class="hljs-meta">... </span>    num_labels=<span class="hljs-built_in">len</span>(labels),
<span class="hljs-meta">... </span>    id2label=id2label,
<span class="hljs-meta">... </span>    label2id=label2id,
<span class="hljs-meta">... </span>)`,wrap:!1}}),$=new v({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfdW51c2VkX2NvbHVtbnMlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QzJTJDJTBBJTIwJTIwJTIwJTIwd2FybXVwX3JhdGlvJTNEMC4xJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwbG9hZF9iZXN0X21vZGVsX2F0X2VuZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtZXRyaWNfZm9yX2Jlc3RfbW9kZWwlM0QlMjJhY2N1cmFjeSUyMiUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0Rmb29kJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0Rmb29kJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHByb2Nlc3NpbmdfY2xhc3MlM0RpbWFnZV9wcm9jZXNzb3IlMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>,
<span class="hljs-meta">... </span>    remove_unused_columns=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    eval_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">5e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    gradient_accumulation_steps=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    warmup_ratio=<span class="hljs-number">0.1</span>,
<span class="hljs-meta">... </span>    logging_steps=<span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    metric_for_best_model=<span class="hljs-string">&quot;accuracy&quot;</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    train_dataset=food[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=food[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    processing_class=image_processor,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),G=new v({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){h(t.$$.fragment),M=m(),e=w("p"),e.innerHTML=i,T=m(),h(C.$$.fragment),Y=m(),W=w("p"),W.textContent=Z,F=m(),I=w("ol"),I.innerHTML=V,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(G.$$.fragment)},l(p){y(t.$$.fragment,p),M=c(p),e=d(p,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ozi07j"&&(e.innerHTML=i),T=c(p),y(C.$$.fragment,p),Y=c(p),W=d(p,"P",{"data-svelte-h":!0}),_(W)!=="svelte-14zzcxs"&&(W.textContent=Z),F=c(p),I=d(p,"OL",{"data-svelte-h":!0}),_(I)!=="svelte-1cztu91"&&(I.innerHTML=V),R=c(p),y($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-1herf5s"&&(r.innerHTML=U),N=c(p),y(G.$$.fragment,p)},m(p,J){j(t,p,J),l(p,M,J),l(p,e,J),l(p,T,J),j(C,p,J),l(p,Y,J),l(p,W,J),l(p,F,J),l(p,I,J),l(p,R,J),j($,p,J),l(p,x,J),l(p,r,J),l(p,N,J),j(G,p,J),z=!0},p(p,J){const E={};J&2&&(E.$$scope={dirty:J,ctx:p}),t.$set(E)},i(p){z||(u(t.$$.fragment,p),u(C.$$.fragment,p),u($.$$.fragment,p),u(G.$$.fragment,p),z=!0)},o(p){g(t.$$.fragment,p),g(C.$$.fragment,p),g($.$$.fragment,p),g(G.$$.fragment,p),z=!1},d(p){p&&(a(M),a(e),a(T),a(Y),a(W),a(F),a(I),a(R),a(x),a(r),a(N)),b(t,p),b(C,p),b($,p),b(G,p)}}}function fl(X){let t,M;return t=new zs({props:{$$slots:{default:[Ml]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function hl(X){let t,M='Keras를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않은 경우, 먼저 <a href="./training#train-a-tensorflow-model-with-keras">기본 튜토리얼</a>을 확인하세요!';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-qz0oqm"&&(t.innerHTML=M)},m(e,i){l(e,t,i)},p:Ms,d(e){e&&a(t)}}}function yl(X){let t,M,e,i="TensorFlow에서 모델을 미세 조정하려면 다음 단계를 따르세요:",T,C,Y="<li>훈련 하이퍼파라미터를 정의하고 옵티마이저와 학습률 스케쥴을 설정합니다.</li> <li>사전 훈련된 모델을 인스턴스화합니다.</li> <li>🤗 Dataset을 <code>tf.data.Dataset</code>으로 변환합니다.</li> <li>모델을 컴파일합니다.</li> <li>콜백을 추가하고 훈련을 수행하기 위해 <code>fit()</code> 메소드를 사용합니다.</li> <li>커뮤니티와 공유하기 위해 모델을 🤗 Hub에 업로드합니다.</li>",W,Z,F="하이퍼파라미터, 옵티마이저 및 학습률 스케쥴을 정의하는 것으로 시작합니다:",I,V,R,$,x="그런 다음 레이블 매핑과 함께 <code>TFAuto ModelForImageClassification</code>으로 ViT를 가져옵니다:",r,U,N,G,z="데이터 세트를 <code>to_tf_dataset</code>와 <code>data_collator</code>를 사용하여 <code>tf.data.Dataset</code> 형식으로 변환하세요:",p,J,E,f,B="<code>compile()</code>를 사용하여 훈련 모델을 구성하세요:",K,H,fs,L,D=`예측에서 정확도를 계산하고 모델을 🤗 Hub로 푸시하려면 <a href="../main_classes/keras_callbacks">Keras callbacks</a>를 사용하세요.
<code>compute_metrics</code> 함수를 <a href="../main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>에 전달하고,
<a href="../main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>을 사용하여 모델을 업로드합니다:`,O,Q,ss,S,Ns=`이제 모델을 훈련할 준비가 되었습니다! 훈련 및 검증 데이터 세트, 에폭 수와 함께 <code>fit()</code>을 호출하고,
콜백을 사용하여 모델을 미세 조정합니다:`,as,q,ls,A,Es="축하합니다! 모델을 미세 조정하고 🤗 Hub에 공유했습니다. 이제 추론에 사용할 수 있습니다!",ts;return t=new _a({props:{$$slots:{default:[hl]},$$scope:{ctx:X}}}),V=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fZXBvY2hzJTIwJTNEJTIwNSUwQW51bV90cmFpbl9zdGVwcyUyMCUzRCUyMGxlbihmb29kJTVCJTIydHJhaW4lMjIlNUQpJTIwKiUyMG51bV9lcG9jaHMlMEFsZWFybmluZ19yYXRlJTIwJTNEJTIwM2UtNSUwQXdlaWdodF9kZWNheV9yYXRlJTIwJTNEJTIwMC4wMSUwQSUwQW9wdGltaXplciUyQyUyMGxyX3NjaGVkdWxlJTIwJTNEJTIwY3JlYXRlX29wdGltaXplciglMEElMjAlMjAlMjAlMjBpbml0X2xyJTNEbGVhcm5pbmdfcmF0ZSUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9zdGVwcyUzRG51bV90cmFpbl9zdGVwcyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheV9yYXRlJTNEd2VpZ2h0X2RlY2F5X3JhdGUlMkMlMEElMjAlMjAlMjAlMjBudW1fd2FybXVwX3N0ZXBzJTNEMCUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_epochs = <span class="hljs-number">5</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_train_steps = <span class="hljs-built_in">len</span>(food[<span class="hljs-string">&quot;train&quot;</span>]) * num_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>learning_rate = <span class="hljs-number">3e-5</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>weight_decay_rate = <span class="hljs-number">0.01</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, lr_schedule = create_optimizer(
<span class="hljs-meta">... </span>    init_lr=learning_rate,
<span class="hljs-meta">... </span>    num_train_steps=num_train_steps,
<span class="hljs-meta">... </span>    weight_decay_rate=weight_decay_rate,
<span class="hljs-meta">... </span>    num_warmup_steps=<span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),U=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBjaGVja3BvaW50JTJDJTBBJTIwJTIwJTIwJTIwaWQybGFiZWwlM0RpZDJsYWJlbCUyQyUwQSUyMCUyMCUyMCUyMGxhYmVsMmlkJTNEbGFiZWwyaWQlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForImageClassification.from_pretrained(
<span class="hljs-meta">... </span>    checkpoint,
<span class="hljs-meta">... </span>    id2label=id2label,
<span class="hljs-meta">... </span>    label2id=label2id,
<span class="hljs-meta">... </span>)`,wrap:!1}}),J=new v({props:{code:"JTIzJTIwY29udmVydGluZyUyMG91ciUyMHRyYWluJTIwZGF0YXNldCUyMHRvJTIwdGYuZGF0YS5EYXRhc2V0JTBBdGZfdHJhaW5fZGF0YXNldCUyMCUzRCUyMGZvb2QlNUIlMjJ0cmFpbiUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlMjJwaXhlbF92YWx1ZXMlMjIlMkMlMjBsYWJlbF9jb2xzJTNEJTIybGFiZWwlMjIlMkMlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUyMGJhdGNoX3NpemUlM0RiYXRjaF9zaXplJTJDJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMEEpJTBBJTBBJTIzJTIwY29udmVydGluZyUyMG91ciUyMHRlc3QlMjBkYXRhc2V0JTIwdG8lMjB0Zi5kYXRhLkRhdGFzZXQlMEF0Zl9ldmFsX2RhdGFzZXQlMjAlM0QlMjBmb29kJTVCJTIydGVzdCUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlMjJwaXhlbF92YWx1ZXMlMjIlMkMlMjBsYWJlbF9jb2xzJTNEJTIybGFiZWwlMjIlMkMlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUyMGJhdGNoX3NpemUlM0RiYXRjaF9zaXplJTJDJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># converting our train dataset to tf.data.Dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_dataset = food[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=<span class="hljs-string">&quot;pixel_values&quot;</span>, label_cols=<span class="hljs-string">&quot;label&quot;</span>, shuffle=<span class="hljs-literal">True</span>, batch_size=batch_size, collate_fn=data_collator
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># converting our test dataset to tf.data.Dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_eval_dataset = food[<span class="hljs-string">&quot;test&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=<span class="hljs-string">&quot;pixel_values&quot;</span>, label_cols=<span class="hljs-string">&quot;label&quot;</span>, shuffle=<span class="hljs-literal">True</span>, batch_size=batch_size, collate_fn=data_collator
<span class="hljs-meta">... </span>)`,wrap:!1}}),H=new v({props:{code:"ZnJvbSUyMHRlbnNvcmZsb3cua2VyYXMubG9zc2VzJTIwaW1wb3J0JTIwU3BhcnNlQ2F0ZWdvcmljYWxDcm9zc2VudHJvcHklMEElMEFsb3NzJTIwJTNEJTIwdGYua2VyYXMubG9zc2VzLlNwYXJzZUNhdGVnb3JpY2FsQ3Jvc3NlbnRyb3B5KGZyb21fbG9naXRzJTNEVHJ1ZSklMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciUyQyUyMGxvc3MlM0Rsb3NzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow.keras.losses <span class="hljs-keyword">import</span> SparseCategoricalCrossentropy

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer, loss=loss)`,wrap:!1}}),Q=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTJDJTIwUHVzaFRvSHViQ2FsbGJhY2slMEElMEFtZXRyaWNfY2FsbGJhY2slMjAlM0QlMjBLZXJhc01ldHJpY0NhbGxiYWNrKG1ldHJpY19mbiUzRGNvbXB1dGVfbWV0cmljcyUyQyUyMGV2YWxfZGF0YXNldCUzRHRmX2V2YWxfZGF0YXNldCklMEFwdXNoX3RvX2h1Yl9jYWxsYmFjayUyMCUzRCUyMFB1c2hUb0h1YkNhbGxiYWNrKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJmb29kX2NsYXNzaWZpZXIlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0RpbWFnZV9wcm9jZXNzb3IlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIybm8lMjIlMkMlMEEpJTBBY2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback, PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_eval_dataset)
<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;food_classifier&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=image_processor,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;no&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]`,wrap:!1}}),q=new v({props:{code:"bW9kZWwuZml0KHRmX3RyYWluX2RhdGFzZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl9ldmFsX2RhdGFzZXQlMkMlMjBlcG9jaHMlM0RudW1fZXBvY2hzJTJDJTIwY2FsbGJhY2tzJTNEY2FsbGJhY2tzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(tf_train_dataset, validation_data=tf_eval_dataset, epochs=num_epochs, callbacks=callbacks)
Epoch <span class="hljs-number">1</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 313s 1s/step - loss: <span class="hljs-number">2.5623</span> - val_loss: <span class="hljs-number">1.4161</span> - accuracy: <span class="hljs-number">0.9290</span>
Epoch <span class="hljs-number">2</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 265s 1s/step - loss: <span class="hljs-number">0.9181</span> - val_loss: <span class="hljs-number">0.6808</span> - accuracy: <span class="hljs-number">0.9690</span>
Epoch <span class="hljs-number">3</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 252s 1s/step - loss: <span class="hljs-number">0.3910</span> - val_loss: <span class="hljs-number">0.4303</span> - accuracy: <span class="hljs-number">0.9820</span>
Epoch <span class="hljs-number">4</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 251s 1s/step - loss: <span class="hljs-number">0.2028</span> - val_loss: <span class="hljs-number">0.3191</span> - accuracy: <span class="hljs-number">0.9900</span>
Epoch <span class="hljs-number">5</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 238s 949ms/step - loss: <span class="hljs-number">0.1232</span> - val_loss: <span class="hljs-number">0.3259</span> - accuracy: <span class="hljs-number">0.9890</span>`,wrap:!1}}),{c(){h(t.$$.fragment),M=m(),e=w("p"),e.textContent=i,T=m(),C=w("ol"),C.innerHTML=Y,W=m(),Z=w("p"),Z.textContent=F,I=m(),h(V.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),G=w("p"),G.innerHTML=z,p=m(),h(J.$$.fragment),E=m(),f=w("p"),f.innerHTML=B,K=m(),h(H.$$.fragment),fs=m(),L=w("p"),L.innerHTML=D,O=m(),h(Q.$$.fragment),ss=m(),S=w("p"),S.innerHTML=Ns,as=m(),h(q.$$.fragment),ls=m(),A=w("p"),A.textContent=Es},l(o){y(t.$$.fragment,o),M=c(o),e=d(o,"P",{"data-svelte-h":!0}),_(e)!=="svelte-um2evk"&&(e.textContent=i),T=c(o),C=d(o,"OL",{"data-svelte-h":!0}),_(C)!=="svelte-4o84bf"&&(C.innerHTML=Y),W=c(o),Z=d(o,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-17oxi9w"&&(Z.textContent=F),I=c(o),y(V.$$.fragment,o),R=c(o),$=d(o,"P",{"data-svelte-h":!0}),_($)!=="svelte-1s8k4gq"&&($.innerHTML=x),r=c(o),y(U.$$.fragment,o),N=c(o),G=d(o,"P",{"data-svelte-h":!0}),_(G)!=="svelte-f9923k"&&(G.innerHTML=z),p=c(o),y(J.$$.fragment,o),E=c(o),f=d(o,"P",{"data-svelte-h":!0}),_(f)!=="svelte-18yjhtp"&&(f.innerHTML=B),K=c(o),y(H.$$.fragment,o),fs=c(o),L=d(o,"P",{"data-svelte-h":!0}),_(L)!=="svelte-g7d2ol"&&(L.innerHTML=D),O=c(o),y(Q.$$.fragment,o),ss=c(o),S=d(o,"P",{"data-svelte-h":!0}),_(S)!=="svelte-uh3niq"&&(S.innerHTML=Ns),as=c(o),y(q.$$.fragment,o),ls=c(o),A=d(o,"P",{"data-svelte-h":!0}),_(A)!=="svelte-1trgvwr"&&(A.textContent=Es)},m(o,k){j(t,o,k),l(o,M,k),l(o,e,k),l(o,T,k),l(o,C,k),l(o,W,k),l(o,Z,k),l(o,I,k),j(V,o,k),l(o,R,k),l(o,$,k),l(o,r,k),j(U,o,k),l(o,N,k),l(o,G,k),l(o,p,k),j(J,o,k),l(o,E,k),l(o,f,k),l(o,K,k),j(H,o,k),l(o,fs,k),l(o,L,k),l(o,O,k),j(Q,o,k),l(o,ss,k),l(o,S,k),l(o,as,k),j(q,o,k),l(o,ls,k),l(o,A,k),ts=!0},p(o,k){const P={};k&2&&(P.$$scope={dirty:k,ctx:o}),t.$set(P)},i(o){ts||(u(t.$$.fragment,o),u(V.$$.fragment,o),u(U.$$.fragment,o),u(J.$$.fragment,o),u(H.$$.fragment,o),u(Q.$$.fragment,o),u(q.$$.fragment,o),ts=!0)},o(o){g(t.$$.fragment,o),g(V.$$.fragment,o),g(U.$$.fragment,o),g(J.$$.fragment,o),g(H.$$.fragment,o),g(Q.$$.fragment,o),g(q.$$.fragment,o),ts=!1},d(o){o&&(a(M),a(e),a(T),a(C),a(W),a(Z),a(I),a(R),a($),a(r),a(N),a(G),a(p),a(E),a(f),a(K),a(fs),a(L),a(O),a(ss),a(S),a(as),a(ls),a(A)),b(t,o),b(V,o),b(U,o),b(J,o),b(H,o),b(Q,o),b(q,o)}}}function jl(X){let t,M;return t=new zs({props:{$$slots:{default:[yl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function ul(X){let t,M='이미지 분류를 위한 모델을 미세 조정하는 자세한 예제는 다음 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">PyTorch notebook</a>을 참조하세요.';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-16trkry"&&(t.innerHTML=M)},m(e,i){l(e,t,i)},p:Ms,d(e){e&&a(t)}}}function gl(X){let t,M="이미지를 전처리하기 위해 이미지 프로세서를 가져오고 <code>input</code>을 PyTorch 텐서로 반환합니다:",e,i,T,C,Y="입력을 모델에 전달하고 logits을 반환합니다:",W,Z,F,I,V="확률이 가장 높은 예측 레이블을 가져오고, 모델의 <code>id2label</code> 매핑을 사용하여 레이블로 변환합니다:",R,$,x;return i=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQWltcG9ydCUyMHRvcmNoJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),Z=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfZm9vZF9tb2RlbCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits`,wrap:!1}}),$=new v({props:{code:"cHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_label]
<span class="hljs-string">&#x27;beignets&#x27;</span>`,wrap:!1}}),{c(){t=w("p"),t.innerHTML=M,e=m(),h(i.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment)},l(r){t=d(r,"P",{"data-svelte-h":!0}),_(t)!=="svelte-13azkkh"&&(t.innerHTML=M),e=c(r),y(i.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-b607m1"&&(C.textContent=Y),W=c(r),y(Z.$$.fragment,r),F=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-uzshui"&&(I.innerHTML=V),R=c(r),y($.$$.fragment,r)},m(r,U){l(r,t,U),l(r,e,U),j(i,r,U),l(r,T,U),l(r,C,U),l(r,W,U),j(Z,r,U),l(r,F,U),l(r,I,U),l(r,R,U),j($,r,U),x=!0},p:Ms,i(r){x||(u(i.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),x=!0)},o(r){g(i.$$.fragment,r),g(Z.$$.fragment,r),g($.$$.fragment,r),x=!1},d(r){r&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(i,r),b(Z,r),b($,r)}}}function bl(X){let t,M;return t=new zs({props:{$$slots:{default:[gl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function Jl(X){let t,M="이미지를 전처리하기 위해 이미지 프로세서를 가져오고 <code>input</code>을 TensorFlow 텐서로 반환합니다:",e,i,T,C,Y="입력을 모델에 전달하고 logits을 반환합니다:",W,Z,F,I,V="확률이 가장 높은 예측 레이블을 가져오고, 모델의 <code>id2label</code> 매핑을 사용하여 레이블로 변환합니다:",R,$,x;return i=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyTWFyaWFLJTJGZm9vZF9jbGFzc2lmaWVyJTIyKSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;MariaK/food_classifier&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),Z=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJNYXJpYUslMkZmb29kX2NsYXNzaWZpZXIlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;MariaK/food_classifier&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits`,wrap:!1}}),$=new v({props:{code:"cHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;beignets&#x27;</span>`,wrap:!1}}),{c(){t=w("p"),t.innerHTML=M,e=m(),h(i.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment)},l(r){t=d(r,"P",{"data-svelte-h":!0}),_(t)!=="svelte-dkxdqj"&&(t.innerHTML=M),e=c(r),y(i.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-b607m1"&&(C.textContent=Y),W=c(r),y(Z.$$.fragment,r),F=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-uzshui"&&(I.innerHTML=V),R=c(r),y($.$$.fragment,r)},m(r,U){l(r,t,U),l(r,e,U),j(i,r,U),l(r,T,U),l(r,C,U),l(r,W,U),j(Z,r,U),l(r,F,U),l(r,I,U),l(r,R,U),j($,r,U),x=!0},p:Ms,i(r){x||(u(i.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),x=!0)},o(r){g(i.$$.fragment,r),g(Z.$$.fragment,r),g($.$$.fragment,r),x=!1},d(r){r&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(i,r),b(Z,r),b($,r)}}}function wl(X){let t,M;return t=new zs({props:{$$slots:{default:[Jl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,i){j(t,e,i),M=!0},p(e,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function dl(X){let t,M,e,i,T,C,Y,W,Z,F,I,V=`이미지 분류는 이미지에 레이블 또는 클래스를 할당합니다. 텍스트 또는 오디오 분류와 달리 입력은
이미지를 구성하는 픽셀 값입니다. 이미지 분류에는 자연재해 후 피해 감지, 농작물 건강 모니터링, 의료 이미지에서 질병의 징후 검사 지원 등
다양한 응용 사례가 있습니다.`,R,$,x="이 가이드에서는 다음을 설명합니다:",r,U,N='<li><a href="https://huggingface.co/datasets/food101" rel="nofollow">Food-101</a> 데이터 세트에서 <a href="model_doc/vit">ViT</a>를 미세 조정하여 이미지에서 식품 항목을 분류합니다.</li> <li>추론을 위해 미세 조정 모델을 사용합니다.</li>',G,z,p,J,E="시작하기 전에, 필요한 모든 라이브러리가 설치되어 있는지 확인하세요:",f,B,K,H,fs="Hugging Face 계정에 로그인하여 모델을 업로드하고 커뮤니티에 공유하는 것을 권장합니다. 메시지가 표시되면, 토큰을 입력하여 로그인하세요:",L,D,O,Q,ss,S,Ns=`🤗 Datasets 라이브러리에서 Food-101 데이터 세트의 더 작은 부분 집합을 가져오는 것으로 시작합니다. 이렇게 하면 전체 데이터 세트에 대한
훈련에 많은 시간을 할애하기 전에 실험을 통해 모든 것이 제대로 작동하는지 확인할 수 있습니다.`,as,q,ls,A,Es="데이터 세트의 <code>train</code>을 <code>train_test_split</code> 메소드를 사용하여 훈련 및 테스트 세트로 분할하세요:",ts,o,k,P,Ca="그리고 예시를 살펴보세요:",Qs,hs,Ss,ys,Ia="데이터 세트의 각 예제에는 두 개의 필드가 있습니다:",qs,js,ka="<li><code>image</code>: 식품 항목의 PIL 이미지</li> <li><code>label</code>: 식품 항목의 레이블 클래스</li>",As,us,Wa=`모델이 레이블 ID에서 레이블 이름을 쉽게 가져올 수 있도록
레이블 이름을 정수로 매핑하고, 정수를 레이블 이름으로 매핑하는 사전을 만드세요:`,Ls,gs,Ds,bs,Ga="이제 레이블 ID를 레이블 이름으로 변환할 수 있습니다:",Ps,Js,Ks,ws,Os,ds,va="다음 단계는 이미지를 텐서로 처리하기 위해 ViT 이미지 프로세서를 가져오는 것입니다:",sa,$s,aa,es,la,ns,ta,Ts,ea,Us,Xa=`훈련 중에 평가 지표를 포함하면 모델의 성능을 평가하는 데 도움이 되는 경우가 많습니다.
🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> 라이브러리로 평가 방법을 빠르게 가져올 수 있습니다. 이 작업에서는
<a href="https://huggingface.co/spaces/evaluate-metric/accuracy" rel="nofollow">accuracy</a> 평가 지표를 가져옵니다. (🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">빠른 둘러보기</a>를 참조하여 평가 지표를 가져오고 계산하는 방법에 대해 자세히 알아보세요):`,na,_s,pa,Zs,Ra="그런 다음 예측과 레이블을 <code>compute</code>에 전달하여 정확도를 계산하는 함수를 만듭니다:",ra,Cs,ma,Is,Ya="이제 <code>compute_metrics</code> 함수를 사용할 준비가 되었으며, 훈련을 설정하면 이 함수로 되돌아올 것입니다.",ca,ks,oa,ps,ia,rs,Ma,ms,fa,Ws,ha,Gs,Fa="좋아요, 이제 모델을 미세 조정했으니 추론에 사용할 수 있습니다!",ya,vs,Va="추론을 수행하고자 하는 이미지를 가져와봅시다:",ja,Xs,ua,cs,xa='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png" alt="image of beignets"/>',ga,Rs,Ba="미세 조정 모델로 추론을 시도하는 가장 간단한 방법은 <code>pipeline()</code>을 사용하는 것입니다. 모델로 이미지 분류를 위한 <code>pipeline</code>을 인스턴스화하고 이미지를 전달합니다:",ba,Ys,Ja,Fs,za="원한다면, <code>pipeline</code>의 결과를 수동으로 복제할 수도 있습니다:",wa,os,da,is,$a,Vs,Ta,Hs,Ua;return T=new Bs({props:{title:"이미지 분류",local:"image-classification",headingTag:"h1"}}),Y=new el({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/image_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/image_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/image_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/image_classification.ipynb"}]}}),Z=new tl({props:{id:"tjAIM7BOYhw"}}),z=new _a({props:{$$slots:{default:[pl]},$$scope:{ctx:X}}}),B=new v({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),D=new v({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),Q=new Bs({props:{title:"Food-101 데이터 세트 가져오기",local:"load-food101-dataset",headingTag:"h2"}}),q=new v({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZm9vZCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJmb29kMTAxJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiU1QiUzQTUwMDAlNUQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>food = load_dataset(<span class="hljs-string">&quot;food101&quot;</span>, split=<span class="hljs-string">&quot;train[:5000]&quot;</span>)`,wrap:!1}}),o=new v({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2QudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),hs=new v({props:{code:"Zm9vZCU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>food[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;image&#x27;</span>: &lt;PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=512x512 at <span class="hljs-number">0x7F52AFC8AC50</span>&gt;,
 <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-number">79</span>}`,wrap:!1}}),gs=new v({props:{code:"bGFiZWxzJTIwJTNEJTIwZm9vZCU1QiUyMnRyYWluJTIyJTVELmZlYXR1cmVzJTVCJTIybGFiZWwlMjIlNUQubmFtZXMlMEFsYWJlbDJpZCUyQyUyMGlkMmxhYmVsJTIwJTNEJTIwZGljdCgpJTJDJTIwZGljdCgpJTBBZm9yJTIwaSUyQyUyMGxhYmVsJTIwaW4lMjBlbnVtZXJhdGUobGFiZWxzKSUzQSUwQSUyMCUyMCUyMCUyMGxhYmVsMmlkJTVCbGFiZWwlNUQlMjAlM0QlMjBzdHIoaSklMEElMjAlMjAlMjAlMjBpZDJsYWJlbCU1QnN0cihpKSU1RCUyMCUzRCUyMGxhYmVs",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>labels = food[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">&quot;label&quot;</span>].names
<span class="hljs-meta">&gt;&gt;&gt; </span>label2id, id2label = <span class="hljs-built_in">dict</span>(), <span class="hljs-built_in">dict</span>()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(labels):
<span class="hljs-meta">... </span>    label2id[label] = <span class="hljs-built_in">str</span>(i)
<span class="hljs-meta">... </span>    id2label[<span class="hljs-built_in">str</span>(i)] = label`,wrap:!1}}),Js=new v({props:{code:"aWQybGFiZWwlNUJzdHIoNzkpJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>id2label[<span class="hljs-built_in">str</span>(<span class="hljs-number">79</span>)]
<span class="hljs-string">&#x27;prime_rib&#x27;</span>`,wrap:!1}}),ws=new Bs({props:{title:"전처리",local:"preprocess",headingTag:"h2"}}),$s=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(checkpoint)`,wrap:!1}}),es=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[ml]},$$scope:{ctx:X}}}),ns=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ol]},$$scope:{ctx:X}}}),Ts=new Bs({props:{title:"평가",local:"evaluate",headingTag:"h2"}}),_s=new v({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFhY2N1cmFjeSUyMCUzRCUyMGV2YWx1YXRlLmxvYWQoJTIyYWNjdXJhY3klMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>accuracy = evaluate.load(<span class="hljs-string">&quot;accuracy&quot;</span>)`,wrap:!1}}),Cs=new v({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMHByZWRpY3Rpb25zJTIwJTNEJTIwbnAuYXJnbWF4KHByZWRpY3Rpb25zJTJDJTIwYXhpcyUzRDEpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYWNjdXJhY3kuY29tcHV0ZShwcmVkaWN0aW9ucyUzRHByZWRpY3Rpb25zJTJDJTIwcmVmZXJlbmNlcyUzRGxhYmVscyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions, labels = eval_pred
<span class="hljs-meta">... </span>    predictions = np.argmax(predictions, axis=<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> accuracy.compute(predictions=predictions, references=labels)`,wrap:!1}}),ks=new Bs({props:{title:"훈련",local:"train",headingTag:"h2"}}),ps=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[fl]},$$scope:{ctx:X}}}),rs=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[jl]},$$scope:{ctx:X}}}),ms=new _a({props:{$$slots:{default:[ul]},$$scope:{ctx:X}}}),Ws=new Bs({props:{title:"추론",local:"inference",headingTag:"h2"}}),Xs=new v({props:{code:"ZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyZm9vZDEwMSUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiU1QiUzQTEwJTVEJTIyKSUwQWltYWdlJTIwJTNEJTIwZHMlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;food101&quot;</span>, split=<span class="hljs-string">&quot;validation[:10]&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = ds[<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]`,wrap:!1}}),Ys=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMmltYWdlLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIpJTBBY2xhc3NpZmllcihpbWFnZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;image-classification&quot;</span>, model=<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(image)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.31856709718704224</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;beignets&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.015232225880026817</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;bruschetta&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.01519392803311348</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;chicken_wings&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.013022331520915031</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;pork_chop&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.012728818692266941</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;prime_rib&#x27;</span>}]`,wrap:!1}}),os=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[bl]},$$scope:{ctx:X}}}),is=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wl]},$$scope:{ctx:X}}}),Vs=new nl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/tasks/image_classification.md"}}),{c(){t=w("meta"),M=m(),e=w("p"),i=m(),h(T.$$.fragment),C=m(),h(Y.$$.fragment),W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.textContent=V,R=m(),$=w("p"),$.textContent=x,r=m(),U=w("ol"),U.innerHTML=N,G=m(),h(z.$$.fragment),p=m(),J=w("p"),J.textContent=E,f=m(),h(B.$$.fragment),K=m(),H=w("p"),H.textContent=fs,L=m(),h(D.$$.fragment),O=m(),h(Q.$$.fragment),ss=m(),S=w("p"),S.textContent=Ns,as=m(),h(q.$$.fragment),ls=m(),A=w("p"),A.innerHTML=Es,ts=m(),h(o.$$.fragment),k=m(),P=w("p"),P.textContent=Ca,Qs=m(),h(hs.$$.fragment),Ss=m(),ys=w("p"),ys.textContent=Ia,qs=m(),js=w("ul"),js.innerHTML=ka,As=m(),us=w("p"),us.textContent=Wa,Ls=m(),h(gs.$$.fragment),Ds=m(),bs=w("p"),bs.textContent=Ga,Ps=m(),h(Js.$$.fragment),Ks=m(),h(ws.$$.fragment),Os=m(),ds=w("p"),ds.textContent=va,sa=m(),h($s.$$.fragment),aa=m(),h(es.$$.fragment),la=m(),h(ns.$$.fragment),ta=m(),h(Ts.$$.fragment),ea=m(),Us=w("p"),Us.innerHTML=Xa,na=m(),h(_s.$$.fragment),pa=m(),Zs=w("p"),Zs.innerHTML=Ra,ra=m(),h(Cs.$$.fragment),ma=m(),Is=w("p"),Is.innerHTML=Ya,ca=m(),h(ks.$$.fragment),oa=m(),h(ps.$$.fragment),ia=m(),h(rs.$$.fragment),Ma=m(),h(ms.$$.fragment),fa=m(),h(Ws.$$.fragment),ha=m(),Gs=w("p"),Gs.textContent=Fa,ya=m(),vs=w("p"),vs.textContent=Va,ja=m(),h(Xs.$$.fragment),ua=m(),cs=w("div"),cs.innerHTML=xa,ga=m(),Rs=w("p"),Rs.innerHTML=Ba,ba=m(),h(Ys.$$.fragment),Ja=m(),Fs=w("p"),Fs.innerHTML=za,wa=m(),h(os.$$.fragment),da=m(),h(is.$$.fragment),$a=m(),h(Vs.$$.fragment),Ta=m(),Hs=w("p"),this.h()},l(s){const n=al("svelte-u9bgzb",document.head);t=d(n,"META",{name:!0,content:!0}),n.forEach(a),M=c(s),e=d(s,"P",{}),Da(e).forEach(a),i=c(s),y(T.$$.fragment,s),C=c(s),y(Y.$$.fragment,s),W=c(s),y(Z.$$.fragment,s),F=c(s),I=d(s,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1op3s0b"&&(I.textContent=V),R=c(s),$=d(s,"P",{"data-svelte-h":!0}),_($)!=="svelte-19dumbs"&&($.textContent=x),r=c(s),U=d(s,"OL",{"data-svelte-h":!0}),_(U)!=="svelte-93mkx2"&&(U.innerHTML=N),G=c(s),y(z.$$.fragment,s),p=c(s),J=d(s,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1bc8bfk"&&(J.textContent=E),f=c(s),y(B.$$.fragment,s),K=c(s),H=d(s,"P",{"data-svelte-h":!0}),_(H)!=="svelte-1hhyu5y"&&(H.textContent=fs),L=c(s),y(D.$$.fragment,s),O=c(s),y(Q.$$.fragment,s),ss=c(s),S=d(s,"P",{"data-svelte-h":!0}),_(S)!=="svelte-k4g7mc"&&(S.textContent=Ns),as=c(s),y(q.$$.fragment,s),ls=c(s),A=d(s,"P",{"data-svelte-h":!0}),_(A)!=="svelte-1amyql0"&&(A.innerHTML=Es),ts=c(s),y(o.$$.fragment,s),k=c(s),P=d(s,"P",{"data-svelte-h":!0}),_(P)!=="svelte-1rb3v2y"&&(P.textContent=Ca),Qs=c(s),y(hs.$$.fragment,s),Ss=c(s),ys=d(s,"P",{"data-svelte-h":!0}),_(ys)!=="svelte-7crmck"&&(ys.textContent=Ia),qs=c(s),js=d(s,"UL",{"data-svelte-h":!0}),_(js)!=="svelte-yxm734"&&(js.innerHTML=ka),As=c(s),us=d(s,"P",{"data-svelte-h":!0}),_(us)!=="svelte-1lustc3"&&(us.textContent=Wa),Ls=c(s),y(gs.$$.fragment,s),Ds=c(s),bs=d(s,"P",{"data-svelte-h":!0}),_(bs)!=="svelte-135k07i"&&(bs.textContent=Ga),Ps=c(s),y(Js.$$.fragment,s),Ks=c(s),y(ws.$$.fragment,s),Os=c(s),ds=d(s,"P",{"data-svelte-h":!0}),_(ds)!=="svelte-1x7s0ft"&&(ds.textContent=va),sa=c(s),y($s.$$.fragment,s),aa=c(s),y(es.$$.fragment,s),la=c(s),y(ns.$$.fragment,s),ta=c(s),y(Ts.$$.fragment,s),ea=c(s),Us=d(s,"P",{"data-svelte-h":!0}),_(Us)!=="svelte-h5ivt1"&&(Us.innerHTML=Xa),na=c(s),y(_s.$$.fragment,s),pa=c(s),Zs=d(s,"P",{"data-svelte-h":!0}),_(Zs)!=="svelte-tpx6n8"&&(Zs.innerHTML=Ra),ra=c(s),y(Cs.$$.fragment,s),ma=c(s),Is=d(s,"P",{"data-svelte-h":!0}),_(Is)!=="svelte-1tfmmd0"&&(Is.innerHTML=Ya),ca=c(s),y(ks.$$.fragment,s),oa=c(s),y(ps.$$.fragment,s),ia=c(s),y(rs.$$.fragment,s),Ma=c(s),y(ms.$$.fragment,s),fa=c(s),y(Ws.$$.fragment,s),ha=c(s),Gs=d(s,"P",{"data-svelte-h":!0}),_(Gs)!=="svelte-1annmqf"&&(Gs.textContent=Fa),ya=c(s),vs=d(s,"P",{"data-svelte-h":!0}),_(vs)!=="svelte-gvr8fy"&&(vs.textContent=Va),ja=c(s),y(Xs.$$.fragment,s),ua=c(s),cs=d(s,"DIV",{class:!0,"data-svelte-h":!0}),_(cs)!=="svelte-pnh0xy"&&(cs.innerHTML=xa),ga=c(s),Rs=d(s,"P",{"data-svelte-h":!0}),_(Rs)!=="svelte-7ivah3"&&(Rs.innerHTML=Ba),ba=c(s),y(Ys.$$.fragment,s),Ja=c(s),Fs=d(s,"P",{"data-svelte-h":!0}),_(Fs)!=="svelte-1smgeha"&&(Fs.innerHTML=za),wa=c(s),y(os.$$.fragment,s),da=c(s),y(is.$$.fragment,s),$a=c(s),y(Vs.$$.fragment,s),Ta=c(s),Hs=d(s,"P",{}),Da(Hs).forEach(a),this.h()},h(){Za(t,"name","hf:doc:metadata"),Za(t,"content",$l),Za(cs,"class","flex justify-center")},m(s,n){ll(document.head,t),l(s,M,n),l(s,e,n),l(s,i,n),j(T,s,n),l(s,C,n),j(Y,s,n),l(s,W,n),j(Z,s,n),l(s,F,n),l(s,I,n),l(s,R,n),l(s,$,n),l(s,r,n),l(s,U,n),l(s,G,n),j(z,s,n),l(s,p,n),l(s,J,n),l(s,f,n),j(B,s,n),l(s,K,n),l(s,H,n),l(s,L,n),j(D,s,n),l(s,O,n),j(Q,s,n),l(s,ss,n),l(s,S,n),l(s,as,n),j(q,s,n),l(s,ls,n),l(s,A,n),l(s,ts,n),j(o,s,n),l(s,k,n),l(s,P,n),l(s,Qs,n),j(hs,s,n),l(s,Ss,n),l(s,ys,n),l(s,qs,n),l(s,js,n),l(s,As,n),l(s,us,n),l(s,Ls,n),j(gs,s,n),l(s,Ds,n),l(s,bs,n),l(s,Ps,n),j(Js,s,n),l(s,Ks,n),j(ws,s,n),l(s,Os,n),l(s,ds,n),l(s,sa,n),j($s,s,n),l(s,aa,n),j(es,s,n),l(s,la,n),j(ns,s,n),l(s,ta,n),j(Ts,s,n),l(s,ea,n),l(s,Us,n),l(s,na,n),j(_s,s,n),l(s,pa,n),l(s,Zs,n),l(s,ra,n),j(Cs,s,n),l(s,ma,n),l(s,Is,n),l(s,ca,n),j(ks,s,n),l(s,oa,n),j(ps,s,n),l(s,ia,n),j(rs,s,n),l(s,Ma,n),j(ms,s,n),l(s,fa,n),j(Ws,s,n),l(s,ha,n),l(s,Gs,n),l(s,ya,n),l(s,vs,n),l(s,ja,n),j(Xs,s,n),l(s,ua,n),l(s,cs,n),l(s,ga,n),l(s,Rs,n),l(s,ba,n),j(Ys,s,n),l(s,Ja,n),l(s,Fs,n),l(s,wa,n),j(os,s,n),l(s,da,n),j(is,s,n),l(s,$a,n),j(Vs,s,n),l(s,Ta,n),l(s,Hs,n),Ua=!0},p(s,[n]){const Na={};n&2&&(Na.$$scope={dirty:n,ctx:s}),z.$set(Na);const Ea={};n&2&&(Ea.$$scope={dirty:n,ctx:s}),es.$set(Ea);const Ha={};n&2&&(Ha.$$scope={dirty:n,ctx:s}),ns.$set(Ha);const Qa={};n&2&&(Qa.$$scope={dirty:n,ctx:s}),ps.$set(Qa);const Sa={};n&2&&(Sa.$$scope={dirty:n,ctx:s}),rs.$set(Sa);const qa={};n&2&&(qa.$$scope={dirty:n,ctx:s}),ms.$set(qa);const Aa={};n&2&&(Aa.$$scope={dirty:n,ctx:s}),os.$set(Aa);const La={};n&2&&(La.$$scope={dirty:n,ctx:s}),is.$set(La)},i(s){Ua||(u(T.$$.fragment,s),u(Y.$$.fragment,s),u(Z.$$.fragment,s),u(z.$$.fragment,s),u(B.$$.fragment,s),u(D.$$.fragment,s),u(Q.$$.fragment,s),u(q.$$.fragment,s),u(o.$$.fragment,s),u(hs.$$.fragment,s),u(gs.$$.fragment,s),u(Js.$$.fragment,s),u(ws.$$.fragment,s),u($s.$$.fragment,s),u(es.$$.fragment,s),u(ns.$$.fragment,s),u(Ts.$$.fragment,s),u(_s.$$.fragment,s),u(Cs.$$.fragment,s),u(ks.$$.fragment,s),u(ps.$$.fragment,s),u(rs.$$.fragment,s),u(ms.$$.fragment,s),u(Ws.$$.fragment,s),u(Xs.$$.fragment,s),u(Ys.$$.fragment,s),u(os.$$.fragment,s),u(is.$$.fragment,s),u(Vs.$$.fragment,s),Ua=!0)},o(s){g(T.$$.fragment,s),g(Y.$$.fragment,s),g(Z.$$.fragment,s),g(z.$$.fragment,s),g(B.$$.fragment,s),g(D.$$.fragment,s),g(Q.$$.fragment,s),g(q.$$.fragment,s),g(o.$$.fragment,s),g(hs.$$.fragment,s),g(gs.$$.fragment,s),g(Js.$$.fragment,s),g(ws.$$.fragment,s),g($s.$$.fragment,s),g(es.$$.fragment,s),g(ns.$$.fragment,s),g(Ts.$$.fragment,s),g(_s.$$.fragment,s),g(Cs.$$.fragment,s),g(ks.$$.fragment,s),g(ps.$$.fragment,s),g(rs.$$.fragment,s),g(ms.$$.fragment,s),g(Ws.$$.fragment,s),g(Xs.$$.fragment,s),g(Ys.$$.fragment,s),g(os.$$.fragment,s),g(is.$$.fragment,s),g(Vs.$$.fragment,s),Ua=!1},d(s){s&&(a(M),a(e),a(i),a(C),a(W),a(F),a(I),a(R),a($),a(r),a(U),a(G),a(p),a(J),a(f),a(K),a(H),a(L),a(O),a(ss),a(S),a(as),a(ls),a(A),a(ts),a(k),a(P),a(Qs),a(Ss),a(ys),a(qs),a(js),a(As),a(us),a(Ls),a(Ds),a(bs),a(Ps),a(Ks),a(Os),a(ds),a(sa),a(aa),a(la),a(ta),a(ea),a(Us),a(na),a(pa),a(Zs),a(ra),a(ma),a(Is),a(ca),a(oa),a(ia),a(Ma),a(fa),a(ha),a(Gs),a(ya),a(vs),a(ja),a(ua),a(cs),a(ga),a(Rs),a(ba),a(Ja),a(Fs),a(wa),a(da),a($a),a(Ta),a(Hs)),a(t),b(T,s),b(Y,s),b(Z,s),b(z,s),b(B,s),b(D,s),b(Q,s),b(q,s),b(o,s),b(hs,s),b(gs,s),b(Js,s),b(ws,s),b($s,s),b(es,s),b(ns,s),b(Ts,s),b(_s,s),b(Cs,s),b(ks,s),b(ps,s),b(rs,s),b(ms,s),b(Ws,s),b(Xs,s),b(Ys,s),b(os,s),b(is,s),b(Vs,s)}}}const $l='{"title":"이미지 분류","local":"image-classification","sections":[{"title":"Food-101 데이터 세트 가져오기","local":"load-food101-dataset","sections":[],"depth":2},{"title":"전처리","local":"preprocess","sections":[],"depth":2},{"title":"평가","local":"evaluate","sections":[],"depth":2},{"title":"훈련","local":"train","sections":[],"depth":2},{"title":"추론","local":"inference","sections":[],"depth":2}],"depth":1}';function Tl(X){return Ka(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vl extends Oa{constructor(t){super(),sl(this,t,Tl,dl,Pa,{})}}export{vl as component};
