import{s as lt,o as pt,n as be}from"../chunks/scheduler.25b97de1.js";import{S as mt,i as it,g as c,s as r,r as g,A as ct,h as d,f as n,c as o,j as F,u as f,x as j,k as E,y as m,a as i,v as h,d as u,t as b,w as M}from"../chunks/index.d9030fc9.js";import{T as ot}from"../chunks/Tip.baa67368.js";import{D as ne}from"../chunks/Docstring.ffac8efa.js";import{C as Ue}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Le}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as he,E as dt}from"../chunks/EditOnGithub.91d95064.js";function gt(W){let t,_="Example:",l,p,w;return p=new Ue({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRpbW1XcmFwcGVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwdGltbSUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBUaW1tV3JhcHBlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJ0aW1tJTJGcmVzbmV0MTguYTFfaW4xayUyMiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TimmWrapperModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a timm model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TimmWrapperModel.from_pretrained(<span class="hljs-string">&quot;timm/resnet18.a1_in1k&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){t=c("p"),t.textContent=_,l=r(),g(p.$$.fragment)},l(s){t=d(s,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=_),l=o(s),f(p.$$.fragment,s)},m(s,y){i(s,t,y),i(s,l,y),h(p,s,y),w=!0},p:be,i(s){w||(u(p.$$.fragment,s),w=!0)},o(s){b(p.$$.fragment,s),w=!1},d(s){s&&(n(t),n(l)),M(p,s)}}}function ft(W){let t,_=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=_},l(l){t=d(l,"P",{"data-svelte-h":!0}),j(t)!=="svelte-fincs2"&&(t.innerHTML=_)},m(l,p){i(l,t,p)},p:be,d(l){l&&n(t)}}}function ht(W){let t,_="Examples:",l,p,w;return p=new Ue({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwdXJsbGliLnJlcXVlc3QlMjBpbXBvcnQlMjB1cmxvcGVuJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUyQyUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQSUyMyUyMExvYWQlMjBpbWFnZSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3Blbih1cmxvcGVuKCUwQSUyMCUyMCUyMCUyMCdodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZiZWlnbmV0cy10YXNrLWd1aWRlLnBuZyclMEEpKSUwQSUwQSUyMyUyMExvYWQlMjBtb2RlbCUyMGFuZCUyMGltYWdlJTIwcHJvY2Vzc29yJTBBY2hlY2twb2ludCUyMCUzRCUyMCUyMnRpbW0lMkZyZXNuZXQ1MC5hMV9pbjFrJTIyJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KS5ldmFsKCklMEElMEElMjMlMjBQcmVwcm9jZXNzJTIwaW1hZ2UlMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UpJTBBJTBBJTIzJTIwRm9yd2FyZCUyMHBhc3MlMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyMEdldCUyMHBvb2xlZCUyMG91dHB1dCUwQXBvb2xlZF9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQlMEElMEElMjMlMjBHZXQlMjBsYXN0JTIwaGlkZGVuJTIwc3RhdGUlMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel, AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(urlopen(
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png&#x27;</span>
<span class="hljs-meta">... </span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load model and image processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;timm/resnet50.a1_in1k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(checkpoint)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(checkpoint).<span class="hljs-built_in">eval</span>()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Preprocess image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Get pooled output</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Get last hidden state</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state`,wrap:!1}}),{c(){t=c("p"),t.textContent=_,l=r(),g(p.$$.fragment)},l(s){t=d(s,"P",{"data-svelte-h":!0}),j(t)!=="svelte-kvfsh7"&&(t.textContent=_),l=o(s),f(p.$$.fragment,s)},m(s,y){i(s,t,y),i(s,l,y),h(p,s,y),w=!0},p:be,i(s){w||(u(p.$$.fragment,s),w=!0)},o(s){b(p.$$.fragment,s),w=!1},d(s){s&&(n(t),n(l)),M(p,s)}}}function ut(W){let t,_=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=c("p"),t.innerHTML=_},l(l){t=d(l,"P",{"data-svelte-h":!0}),j(t)!=="svelte-fincs2"&&(t.innerHTML=_)},m(l,p){i(l,t,p)},p:be,d(l){l&&n(t)}}}function bt(W){let t,_="Examples:",l,p,w;return p=new Ue({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwdXJsbGliLnJlcXVlc3QlMjBpbXBvcnQlMjB1cmxvcGVuJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMkMlMjBBdXRvSW1hZ2VQcm9jZXNzb3IlMEElMEElMjMlMjBMb2FkJTIwaW1hZ2UlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4odXJsb3BlbiglMEElMjAlMjAlMjAlMjAnaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGYmVpZ25ldHMtdGFzay1ndWlkZS5wbmcnJTBBKSklMEElMEElMjMlMjBMb2FkJTIwbW9kZWwlMjBhbmQlMjBpbWFnZSUyMHByb2Nlc3NvciUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJ0aW1tJTJGcmVzbmV0NTAuYTFfaW4xayUyMiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpLmV2YWwoKSUwQSUwQSUyMyUyMFByZXByb2Nlc3MlMjBpbWFnZSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSklMEElMEElMjMlMjBGb3J3YXJkJTIwcGFzcyUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwR2V0JTIwdG9wJTIwNSUyMHByZWRpY3Rpb25zJTBBdG9wNV9wcm9iYWJpbGl0aWVzJTJDJTIwdG9wNV9jbGFzc19pbmRpY2VzJTIwJTNEJTIwdG9yY2gudG9wayhsb2dpdHMuc29mdG1heChkaW0lM0QxKSUyMColMjAxMDAlMkMlMjBrJTNENSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification, AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(urlopen(
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png&#x27;</span>
<span class="hljs-meta">... </span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load model and image processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;timm/resnet50.a1_in1k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(checkpoint)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(checkpoint).<span class="hljs-built_in">eval</span>()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Preprocess image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Forward pass</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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Get top 5 predictions</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>top5_probabilities, top5_class_indices = torch.topk(logits.softmax(dim=<span class="hljs-number">1</span>) * <span class="hljs-number">100</span>, k=<span class="hljs-number">5</span>)`,wrap:!1}}),{c(){t=c("p"),t.textContent=_,l=r(),g(p.$$.fragment)},l(s){t=d(s,"P",{"data-svelte-h":!0}),j(t)!=="svelte-kvfsh7"&&(t.textContent=_),l=o(s),f(p.$$.fragment,s)},m(s,y){i(s,t,y),i(s,l,y),h(p,s,y),w=!0},p:be,i(s){w||(u(p.$$.fragment,s),w=!0)},o(s){b(p.$$.fragment,s),w=!1},d(s){s&&(n(t),n(l)),M(p,s)}}}function Mt(W){let t,_,l,p,w,s,y,Me,P,qe="Helper class to enable loading timm models to be used with the transformers library and its autoclasses.",we,Q,_e,X,ye,T,H,Ze,re,De="This is the configuration class to store the configuration for a timm backbone <code>TimmWrapper</code>.",xe,oe,Oe="It is used to instantiate a timm model according to the specified arguments, defining the model.",Fe,le,Ke=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ee,B,Te,S,je,C,A,Be,pe,et="Wrapper class for timm models to be used within transformers.",Ge,G,L,Ne,me,tt="Preprocess an image or batch of images.",$e,q,We,I,D,Re,ie,st="Wrapper class for timm models to be used in transformers.",Ve,v,O,Ye,ce,at='The <a href="/docs/transformers/main/en/model_doc/timm_wrapper#transformers.TimmWrapperModel">TimmWrapperModel</a> forward method, overrides the <code>__call__</code> special method.',ze,N,Pe,R,ve,K,Je,k,ee,Qe,de,nt="Wrapper class for timm models to be used in transformers for image classification.",Xe,J,te,He,ge,rt='The <a href="/docs/transformers/main/en/model_doc/timm_wrapper#transformers.TimmWrapperForImageClassification">TimmWrapperForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',Se,V,Ae,Y,Ce,se,Ie,ue,ke;return w=new he({props:{title:"TimmWrapper",local:"timmwrapper",headingTag:"h1"}}),y=new he({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Q=new Ue({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwdXJsbGliLnJlcXVlc3QlMjBpbXBvcnQlMjB1cmxvcGVuJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMkMlMjBBdXRvSW1hZ2VQcm9jZXNzb3IlMEElMEElMjMlMjBMb2FkJTIwaW1hZ2UlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4odXJsb3BlbiglMEElMjAlMjAlMjAlMjAnaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGYmVpZ25ldHMtdGFzay1ndWlkZS5wbmcnJTBBKSklMEElMEElMjMlMjBMb2FkJTIwbW9kZWwlMjBhbmQlMjBpbWFnZSUyMHByb2Nlc3NvciUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJ0aW1tJTJGcmVzbmV0NTAuYTFfaW4xayUyMiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpLmV2YWwoKSUwQSUwQSUyMyUyMFByZXByb2Nlc3MlMjBpbWFnZSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSklMEElMEElMjMlMjBGb3J3YXJkJTIwcGFzcyUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwR2V0JTIwdG9wJTIwNSUyMHByZWRpY3Rpb25zJTBBdG9wNV9wcm9iYWJpbGl0aWVzJTJDJTIwdG9wNV9jbGFzc19pbmRpY2VzJTIwJTNEJTIwdG9yY2gudG9wayhsb2dpdHMuc29mdG1heChkaW0lM0QxKSUyMColMjAxMDAlMkMlMjBrJTNENSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification, AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(urlopen(
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png&#x27;</span>
<span class="hljs-meta">... </span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load model and image processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;timm/resnet50.a1_in1k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(checkpoint)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(checkpoint).<span class="hljs-built_in">eval</span>()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Preprocess image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Forward pass</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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Get top 5 predictions</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>top5_probabilities, top5_class_indices = torch.topk(logits.softmax(dim=<span class="hljs-number">1</span>) * <span class="hljs-number">100</span>, k=<span class="hljs-number">5</span>)`,wrap:!1}}),X=new he({props:{title:"TimmWrapperConfig",local:"transformers.TimmWrapperConfig",headingTag:"h2"}}),H=new ne({props:{name:"class transformers.TimmWrapperConfig",anchor:"transformers.TimmWrapperConfig",parameters:[{name:"initializer_range",val:": float = 0.02"},{name:"do_pooling",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimmWrapperConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.TimmWrapperConfig.do_pooling",description:`<strong>do_pooling</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to do pooling for the last_hidden_state in <code>TimmWrapperModel</code> or not.`,name:"do_pooling"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/configuration_timm_wrapper.py#L27"}}),B=new Le({props:{anchor:"transformers.TimmWrapperConfig.example",$$slots:{default:[gt]},$$scope:{ctx:W}}}),S=new he({props:{title:"TimmWrapperImageProcessor",local:"transformers.TimmWrapperImageProcessor",headingTag:"h2"}}),A=new ne({props:{name:"class transformers.TimmWrapperImageProcessor",anchor:"transformers.TimmWrapperImageProcessor",parameters:[{name:"pretrained_cfg",val:": typing.Dict[str, typing.Any]"},{name:"architecture",val:": typing.Optional[str] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimmWrapperImageProcessor.pretrained_cfg",description:`<strong>pretrained_cfg</strong> (<code>Dict[str, Any]</code>) &#x2014;
The configuration of the pretrained model used to resolve evaluation and
training transforms.`,name:"pretrained_cfg"},{anchor:"transformers.TimmWrapperImageProcessor.architecture",description:`<strong>architecture</strong> (<code>Optional[str]</code>, <em>optional</em>) &#x2014;
Name of the architecture of the model.`,name:"architecture"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/image_processing_timm_wrapper.py#L38"}}),L=new ne({props:{name:"preprocess",anchor:"transformers.TimmWrapperImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = 'pt'"}],parametersDescription:[{anchor:"transformers.TimmWrapperImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images`,name:"images"},{anchor:"transformers.TimmWrapperImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return.`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/image_processing_timm_wrapper.py#L96"}}),q=new he({props:{title:"TimmWrapperModel",local:"transformers.TimmWrapperModel",headingTag:"h2"}}),D=new ne({props:{name:"class transformers.TimmWrapperModel",anchor:"transformers.TimmWrapperModel",parameters:[{name:"config",val:": TimmWrapperConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py#L127"}}),O=new ne({props:{name:"forward",anchor:"transformers.TimmWrapperModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Union[bool, typing.List[int], NoneType] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"do_pooling",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimmWrapperModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/timm_wrapper#transformers.TimmWrapperImageProcessor.preprocess">TimmWrapperImageProcessor.preprocess()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TimmWrapperModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. Not compatible with timm wrapped models.`,name:"output_attentions"},{anchor:"transformers.TimmWrapperModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. Not compatible with timm wrapped models.`,name:"output_hidden_states"},{anchor:"transformers.TimmWrapperModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TimmWrapperModel.forward.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments passed along to the <code>timm</code> model forward.`,name:"*kwargs"},{anchor:"transformers.TimmWrapperModel.forward.do_pooling",description:`<strong>do_pooling</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to do pooling for the last_hidden_state in <code>TimmWrapperModel</code> or not. If <code>None</code> is passed, the
<code>do_pooling</code> value from the config is used.`,name:"do_pooling"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py#L138",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.timm_wrapper.modeling_timm_wrapper.TimmWrapperModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.timm_wrapper.configuration_timm_wrapper.TimmWrapperConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code>) — The last hidden state of the model, output before applying the classification head.</li>
<li><strong>pooler_output</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — The pooled output derived from the last hidden state, if applicable.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) — A tuple containing the intermediate hidden states of the model at the output of each layer or specified layers.
Returned if <code>output_hidden_states=True</code> is set or if <code>config.output_hidden_states=True</code>.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) — A tuple containing the intermediate attention weights of the model at the output of each layer.
Returned if <code>output_attentions=True</code> is set or if <code>config.output_attentions=True</code>.
Note: Currently, Timm models do not support attentions output.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.timm_wrapper.modeling_timm_wrapper.TimmWrapperModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),N=new ot({props:{$$slots:{default:[ft]},$$scope:{ctx:W}}}),R=new Le({props:{anchor:"transformers.TimmWrapperModel.forward.example",$$slots:{default:[ht]},$$scope:{ctx:W}}}),K=new he({props:{title:"TimmWrapperForImageClassification",local:"transformers.TimmWrapperForImageClassification",headingTag:"h2"}}),ee=new ne({props:{name:"class transformers.TimmWrapperForImageClassification",anchor:"transformers.TimmWrapperForImageClassification",parameters:[{name:"config",val:": TimmWrapperConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py#L234"}}),te=new ne({props:{name:"forward",anchor:"transformers.TimmWrapperForImageClassification.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Union[bool, typing.List[int], NoneType] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimmWrapperForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/timm_wrapper#transformers.TimmWrapperImageProcessor.preprocess">TimmWrapperImageProcessor.preprocess()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TimmWrapperForImageClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. Not compatible with timm wrapped models.`,name:"output_attentions"},{anchor:"transformers.TimmWrapperForImageClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. Not compatible with timm wrapped models.`,name:"output_hidden_states"},{anchor:"transformers.TimmWrapperForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TimmWrapperForImageClassification.forward.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments passed along to the <code>timm</code> model forward.`,name:"*kwargs"},{anchor:"transformers.TimmWrapperForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timm_wrapper/modeling_timm_wrapper.py#L253",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.timm_wrapper.configuration_timm_wrapper.TimmWrapperConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new ot({props:{$$slots:{default:[ut]},$$scope:{ctx:W}}}),Y=new Le({props:{anchor:"transformers.TimmWrapperForImageClassification.forward.example",$$slots:{default:[bt]},$$scope:{ctx:W}}}),se=new dt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/timm_wrapper.md"}}),{c(){t=c("meta"),_=r(),l=c("p"),p=r(),g(w.$$.fragment),s=r(),g(y.$$.fragment),Me=r(),P=c("p"),P.textContent=qe,we=r(),g(Q.$$.fragment),_e=r(),g(X.$$.fragment),ye=r(),T=c("div"),g(H.$$.fragment),Ze=r(),re=c("p"),re.innerHTML=De,xe=r(),oe=c("p"),oe.textContent=Oe,Fe=r(),le=c("p"),le.innerHTML=Ke,Ee=r(),g(B.$$.fragment),Te=r(),g(S.$$.fragment),je=r(),C=c("div"),g(A.$$.fragment),Be=r(),pe=c("p"),pe.textContent=et,Ge=r(),G=c("div"),g(L.$$.fragment),Ne=r(),me=c("p"),me.textContent=tt,$e=r(),g(q.$$.fragment),We=r(),I=c("div"),g(D.$$.fragment),Re=r(),ie=c("p"),ie.textContent=st,Ve=r(),v=c("div"),g(O.$$.fragment),Ye=r(),ce=c("p"),ce.innerHTML=at,ze=r(),g(N.$$.fragment),Pe=r(),g(R.$$.fragment),ve=r(),g(K.$$.fragment),Je=r(),k=c("div"),g(ee.$$.fragment),Qe=r(),de=c("p"),de.textContent=nt,Xe=r(),J=c("div"),g(te.$$.fragment),He=r(),ge=c("p"),ge.innerHTML=rt,Se=r(),g(V.$$.fragment),Ae=r(),g(Y.$$.fragment),Ce=r(),g(se.$$.fragment),Ie=r(),ue=c("p"),this.h()},l(e){const a=ct("svelte-u9bgzb",document.head);t=d(a,"META",{name:!0,content:!0}),a.forEach(n),_=o(e),l=d(e,"P",{}),F(l).forEach(n),p=o(e),f(w.$$.fragment,e),s=o(e),f(y.$$.fragment,e),Me=o(e),P=d(e,"P",{"data-svelte-h":!0}),j(P)!=="svelte-1d2nr32"&&(P.textContent=qe),we=o(e),f(Q.$$.fragment,e),_e=o(e),f(X.$$.fragment,e),ye=o(e),T=d(e,"DIV",{class:!0});var $=F(T);f(H.$$.fragment,$),Ze=o($),re=d($,"P",{"data-svelte-h":!0}),j(re)!=="svelte-gylkd1"&&(re.innerHTML=De),xe=o($),oe=d($,"P",{"data-svelte-h":!0}),j(oe)!=="svelte-1yhg4yu"&&(oe.textContent=Oe),Fe=o($),le=d($,"P",{"data-svelte-h":!0}),j(le)!=="svelte-o55m63"&&(le.innerHTML=Ke),Ee=o($),f(B.$$.fragment,$),$.forEach(n),Te=o(e),f(S.$$.fragment,e),je=o(e),C=d(e,"DIV",{class:!0});var Z=F(C);f(A.$$.fragment,Z),Be=o(Z),pe=d(Z,"P",{"data-svelte-h":!0}),j(pe)!=="svelte-89wik1"&&(pe.textContent=et),Ge=o(Z),G=d(Z,"DIV",{class:!0});var ae=F(G);f(L.$$.fragment,ae),Ne=o(ae),me=d(ae,"P",{"data-svelte-h":!0}),j(me)!=="svelte-1x3yxsa"&&(me.textContent=tt),ae.forEach(n),Z.forEach(n),$e=o(e),f(q.$$.fragment,e),We=o(e),I=d(e,"DIV",{class:!0});var x=F(I);f(D.$$.fragment,x),Re=o(x),ie=d(x,"P",{"data-svelte-h":!0}),j(ie)!=="svelte-1w306ql"&&(ie.textContent=st),Ve=o(x),v=d(x,"DIV",{class:!0});var U=F(v);f(O.$$.fragment,U),Ye=o(U),ce=d(U,"P",{"data-svelte-h":!0}),j(ce)!=="svelte-1t8kbdq"&&(ce.innerHTML=at),ze=o(U),f(N.$$.fragment,U),Pe=o(U),f(R.$$.fragment,U),U.forEach(n),x.forEach(n),ve=o(e),f(K.$$.fragment,e),Je=o(e),k=d(e,"DIV",{class:!0});var fe=F(k);f(ee.$$.fragment,fe),Qe=o(fe),de=d(fe,"P",{"data-svelte-h":!0}),j(de)!=="svelte-drqqzb"&&(de.textContent=nt),Xe=o(fe),J=d(fe,"DIV",{class:!0});var z=F(J);f(te.$$.fragment,z),He=o(z),ge=d(z,"P",{"data-svelte-h":!0}),j(ge)!=="svelte-u01sfo"&&(ge.innerHTML=rt),Se=o(z),f(V.$$.fragment,z),Ae=o(z),f(Y.$$.fragment,z),z.forEach(n),fe.forEach(n),Ce=o(e),f(se.$$.fragment,e),Ie=o(e),ue=d(e,"P",{}),F(ue).forEach(n),this.h()},h(){E(t,"name","hf:doc:metadata"),E(t,"content",wt),E(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,a){m(document.head,t),i(e,_,a),i(e,l,a),i(e,p,a),h(w,e,a),i(e,s,a),h(y,e,a),i(e,Me,a),i(e,P,a),i(e,we,a),h(Q,e,a),i(e,_e,a),h(X,e,a),i(e,ye,a),i(e,T,a),h(H,T,null),m(T,Ze),m(T,re),m(T,xe),m(T,oe),m(T,Fe),m(T,le),m(T,Ee),h(B,T,null),i(e,Te,a),h(S,e,a),i(e,je,a),i(e,C,a),h(A,C,null),m(C,Be),m(C,pe),m(C,Ge),m(C,G),h(L,G,null),m(G,Ne),m(G,me),i(e,$e,a),h(q,e,a),i(e,We,a),i(e,I,a),h(D,I,null),m(I,Re),m(I,ie),m(I,Ve),m(I,v),h(O,v,null),m(v,Ye),m(v,ce),m(v,ze),h(N,v,null),m(v,Pe),h(R,v,null),i(e,ve,a),h(K,e,a),i(e,Je,a),i(e,k,a),h(ee,k,null),m(k,Qe),m(k,de),m(k,Xe),m(k,J),h(te,J,null),m(J,He),m(J,ge),m(J,Se),h(V,J,null),m(J,Ae),h(Y,J,null),i(e,Ce,a),h(se,e,a),i(e,Ie,a),i(e,ue,a),ke=!0},p(e,[a]){const $={};a&2&&($.$$scope={dirty:a,ctx:e}),B.$set($);const Z={};a&2&&(Z.$$scope={dirty:a,ctx:e}),N.$set(Z);const ae={};a&2&&(ae.$$scope={dirty:a,ctx:e}),R.$set(ae);const x={};a&2&&(x.$$scope={dirty:a,ctx:e}),V.$set(x);const U={};a&2&&(U.$$scope={dirty:a,ctx:e}),Y.$set(U)},i(e){ke||(u(w.$$.fragment,e),u(y.$$.fragment,e),u(Q.$$.fragment,e),u(X.$$.fragment,e),u(H.$$.fragment,e),u(B.$$.fragment,e),u(S.$$.fragment,e),u(A.$$.fragment,e),u(L.$$.fragment,e),u(q.$$.fragment,e),u(D.$$.fragment,e),u(O.$$.fragment,e),u(N.$$.fragment,e),u(R.$$.fragment,e),u(K.$$.fragment,e),u(ee.$$.fragment,e),u(te.$$.fragment,e),u(V.$$.fragment,e),u(Y.$$.fragment,e),u(se.$$.fragment,e),ke=!0)},o(e){b(w.$$.fragment,e),b(y.$$.fragment,e),b(Q.$$.fragment,e),b(X.$$.fragment,e),b(H.$$.fragment,e),b(B.$$.fragment,e),b(S.$$.fragment,e),b(A.$$.fragment,e),b(L.$$.fragment,e),b(q.$$.fragment,e),b(D.$$.fragment,e),b(O.$$.fragment,e),b(N.$$.fragment,e),b(R.$$.fragment,e),b(K.$$.fragment,e),b(ee.$$.fragment,e),b(te.$$.fragment,e),b(V.$$.fragment,e),b(Y.$$.fragment,e),b(se.$$.fragment,e),ke=!1},d(e){e&&(n(_),n(l),n(p),n(s),n(Me),n(P),n(we),n(_e),n(ye),n(T),n(Te),n(je),n(C),n($e),n(We),n(I),n(ve),n(Je),n(k),n(Ce),n(Ie),n(ue)),n(t),M(w,e),M(y,e),M(Q,e),M(X,e),M(H),M(B),M(S,e),M(A),M(L),M(q,e),M(D),M(O),M(N),M(R),M(K,e),M(ee),M(te),M(V),M(Y),M(se,e)}}}const wt='{"title":"TimmWrapper","local":"timmwrapper","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"TimmWrapperConfig","local":"transformers.TimmWrapperConfig","sections":[],"depth":2},{"title":"TimmWrapperImageProcessor","local":"transformers.TimmWrapperImageProcessor","sections":[],"depth":2},{"title":"TimmWrapperModel","local":"transformers.TimmWrapperModel","sections":[],"depth":2},{"title":"TimmWrapperForImageClassification","local":"transformers.TimmWrapperForImageClassification","sections":[],"depth":2}],"depth":1}';function _t(W){return pt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ct extends mt{constructor(t){super(),it(this,t,_t,Mt,lt,{})}}export{Ct as component};
