Buckets:
| import{s as vt,A as bt,o as xt,n as xe}from"../chunks/scheduler.01eeda35.js";import{S as yt,i as Ct,g as m,s as i,r as b,A as Tt,h as p,f as s,c as l,j as se,u as x,x as w,k as S,y as g,a as r,v as y,d as C,t as T,w as $}from"../chunks/index.6dd51b66.js";import{T as Se}from"../chunks/Tip.de9bae2b.js";import{D as me}from"../chunks/Docstring.cb556860.js";import{C as Qe}from"../chunks/CodeBlock.19ec9b8c.js";import{F as $t,M as _t}from"../chunks/Markdown.3138439e.js";import{E as Ae}from"../chunks/ExampleCodeBlock.69db56ad.js";import{P as wt}from"../chunks/PipelineTag.5efc345e.js";import{H as be,E as Mt}from"../chunks/index.58fe8f9d.js";function Nt(z){let t,h="Example:",o,a,_;return a=new Qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvbnZOZXh0Q29uZmlnJTJDJTIwQ29udk5leHRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDb252TmV4dCUyMGNvbnZuZXh0LXRpbnktMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMENvbnZOZXh0Q29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGNvbnZuZXh0LXRpbnktMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBDb252TmV4dE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ConvNextConfig, ConvNextModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a ConvNext convnext-tiny-224 style configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = ConvNextConfig() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a model (with random weights) from the convnext-tiny-224 style configuration</span> | |
| <span class="hljs-meta">>>> </span>model = ConvNextModel(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,wrap:!1}}),{c(){t=m("p"),t.textContent=h,o=i(),b(a.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=h),o=l(n),x(a.$$.fragment,n)},m(n,v){r(n,t,v),r(n,o,v),y(a,n,v),_=!0},p:xe,i(n){_||(C(a.$$.fragment,n),_=!0)},o(n){T(a.$$.fragment,n),_=!1},d(n){n&&(s(t),s(o)),$(a,n)}}}function It(z){let t,h=`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=m("p"),t.innerHTML=h},l(o){t=p(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=h)},m(o,a){r(o,t,a)},p:xe,d(o){o&&s(t)}}}function Ft(z){let t,h="Example:",o,a,_;return a=new Qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMENvbnZOZXh0TW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGY29udm5leHQtdGlueS0yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBDb252TmV4dE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmNvbnZuZXh0LXRpbnktMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ConvNextModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset | |
| <span class="hljs-meta">>>> </span>dataset = load_dataset(<span class="hljs-string">"huggingface/cats-image"</span>, trust_remote_code=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>image = dataset[<span class="hljs-string">"test"</span>][<span class="hljs-string">"image"</span>][<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>model = ConvNextModel.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">list</span>(last_hidden_states.shape) | |
| [<span class="hljs-number">1</span>, <span class="hljs-number">768</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`,wrap:!1}}),{c(){t=m("p"),t.textContent=h,o=i(),b(a.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=h),o=l(n),x(a.$$.fragment,n)},m(n,v){r(n,t,v),r(n,o,v),y(a,n,v),_=!0},p:xe,i(n){_||(C(a.$$.fragment,n),_=!0)},o(n){T(a.$$.fragment,n),_=!1},d(n){n&&(s(t),s(o)),$(a,n)}}}function jt(z){let t,h=`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=m("p"),t.innerHTML=h},l(o){t=p(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=h)},m(o,a){r(o,t,a)},p:xe,d(o){o&&s(t)}}}function zt(z){let t,h="Example:",o,a,_;return a=new Qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMENvbnZOZXh0Rm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZjb252bmV4dC10aW55LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMENvbnZOZXh0Rm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZjb252bmV4dC10aW55LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9sYWJlbCU1RCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ConvNextForImageClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset | |
| <span class="hljs-meta">>>> </span>dataset = load_dataset(<span class="hljs-string">"huggingface/cats-image"</span>, trust_remote_code=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>image = dataset[<span class="hljs-string">"test"</span>][<span class="hljs-string">"image"</span>][<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>model = ConvNextForImageClassification.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span> | |
| <span class="hljs-meta">>>> </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item() | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label]) | |
| tabby, tabby cat`,wrap:!1}}),{c(){t=m("p"),t.textContent=h,o=i(),b(a.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=h),o=l(n),x(a.$$.fragment,n)},m(n,v){r(n,t,v),r(n,o,v),y(a,n,v),_=!0},p:xe,i(n){_||(C(a.$$.fragment,n),_=!0)},o(n){T(a.$$.fragment,n),_=!1},d(n){n&&(s(t),s(o)),$(a,n)}}}function Ut(z){let t,h,o,a,_,n,v=`The bare ConvNext model outputting raw features without any specific head on top. | |
| This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it | |
| as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and | |
| behavior.`,ee,N,I,Q,j,R='The <a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextModel">ConvNextModel</a> forward method, overrides the <code>__call__</code> special method.',P,c,U,H,ae,ce,O,k,V,pe,L,ye=`ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for | |
| ImageNet.`,Z,J,Te=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it | |
| as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and | |
| behavior.`,re,q,te,Y,ge,he='The <a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextForImageClassification">ConvNextForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',K,oe,ie,E,fe;return t=new be({props:{title:"ConvNextModel",local:"transformers.ConvNextModel",headingTag:"h2"}}),a=new me({props:{name:"class transformers.ConvNextModel",anchor:"transformers.ConvNextModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ConvNextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig">ConvNextConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_convnext.py#L322"}}),I=new me({props:{name:"forward",anchor:"transformers.ConvNextModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ConvNextModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — | |
| Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_37396/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See | |
| <a href="/docs/transformers/pr_37396/en/model_doc/glpn#transformers.GLPNFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ConvNextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.ConvNextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_37396/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_convnext.py#L340",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</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 (<a | |
| href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig" | |
| >ConvNextConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> | |
| </li> | |
| <li> | |
| <p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state after a pooling operation on the spatial dimensions.</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 layer) of shape <code>(batch_size, num_channels, height, width)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),c=new Se({props:{$$slots:{default:[It]},$$scope:{ctx:z}}}),H=new Ae({props:{anchor:"transformers.ConvNextModel.forward.example",$$slots:{default:[Ft]},$$scope:{ctx:z}}}),ce=new be({props:{title:"ConvNextForImageClassification",local:"transformers.ConvNextForImageClassification",headingTag:"h2"}}),V=new me({props:{name:"class transformers.ConvNextForImageClassification",anchor:"transformers.ConvNextForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ConvNextForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig">ConvNextConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_convnext.py#L385"}}),te=new me({props:{name:"forward",anchor:"transformers.ConvNextForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ConvNextForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — | |
| Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_37396/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See | |
| <a href="/docs/transformers/pr_37396/en/model_doc/glpn#transformers.GLPNFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ConvNextForImageClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.ConvNextForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_37396/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ConvNextForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_convnext.py#L407",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_37396/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention" | |
| >transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</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 (<a | |
| href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig" | |
| >ConvNextConfig</a>) and inputs.</p> | |
| <ul> | |
| <li><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.</li> | |
| <li><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).</li> | |
| <li><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, num_channels, height, width)</code>. Hidden-states (also | |
| called feature maps) of the model at the output of each stage.</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_37396/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention" | |
| >transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),oe=new Se({props:{$$slots:{default:[jt]},$$scope:{ctx:z}}}),E=new Ae({props:{anchor:"transformers.ConvNextForImageClassification.forward.example",$$slots:{default:[zt]},$$scope:{ctx:z}}}),{c(){b(t.$$.fragment),h=i(),o=m("div"),b(a.$$.fragment),_=i(),n=m("p"),n.innerHTML=v,ee=i(),N=m("div"),b(I.$$.fragment),Q=i(),j=m("p"),j.innerHTML=R,P=i(),b(c.$$.fragment),U=i(),b(H.$$.fragment),ae=i(),b(ce.$$.fragment),O=i(),k=m("div"),b(V.$$.fragment),pe=i(),L=m("p"),L.textContent=ye,Z=i(),J=m("p"),J.innerHTML=Te,re=i(),q=m("div"),b(te.$$.fragment),Y=i(),ge=m("p"),ge.innerHTML=he,K=i(),b(oe.$$.fragment),ie=i(),b(E.$$.fragment),this.h()},l(d){x(t.$$.fragment,d),h=l(d),o=p(d,"DIV",{class:!0});var F=se(o);x(a.$$.fragment,F),_=l(F),n=p(F,"P",{"data-svelte-h":!0}),w(n)!=="svelte-22827l"&&(n.innerHTML=v),ee=l(F),N=p(F,"DIV",{class:!0});var B=se(N);x(I.$$.fragment,B),Q=l(B),j=p(B,"P",{"data-svelte-h":!0}),w(j)!=="svelte-lqf2f6"&&(j.innerHTML=R),P=l(B),x(c.$$.fragment,B),U=l(B),x(H.$$.fragment,B),B.forEach(s),F.forEach(s),ae=l(d),x(ce.$$.fragment,d),O=l(d),k=p(d,"DIV",{class:!0});var W=se(k);x(V.$$.fragment,W),pe=l(W),L=p(W,"P",{"data-svelte-h":!0}),w(L)!=="svelte-xy24s5"&&(L.textContent=ye),Z=l(W),J=p(W,"P",{"data-svelte-h":!0}),w(J)!=="svelte-1gjh92c"&&(J.innerHTML=Te),re=l(W),q=p(W,"DIV",{class:!0});var D=se(q);x(te.$$.fragment,D),Y=l(D),ge=p(D,"P",{"data-svelte-h":!0}),w(ge)!=="svelte-1mws4yk"&&(ge.innerHTML=he),K=l(D),x(oe.$$.fragment,D),ie=l(D),x(E.$$.fragment,D),D.forEach(s),W.forEach(s),this.h()},h(){S(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(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(d,F){y(t,d,F),r(d,h,F),r(d,o,F),y(a,o,null),g(o,_),g(o,n),g(o,ee),g(o,N),y(I,N,null),g(N,Q),g(N,j),g(N,P),y(c,N,null),g(N,U),y(H,N,null),r(d,ae,F),y(ce,d,F),r(d,O,F),r(d,k,F),y(V,k,null),g(k,pe),g(k,L),g(k,Z),g(k,J),g(k,re),g(k,q),y(te,q,null),g(q,Y),g(q,ge),g(q,K),y(oe,q,null),g(q,ie),y(E,q,null),fe=!0},p(d,F){const B={};F&2&&(B.$$scope={dirty:F,ctx:d}),c.$set(B);const W={};F&2&&(W.$$scope={dirty:F,ctx:d}),H.$set(W);const D={};F&2&&(D.$$scope={dirty:F,ctx:d}),oe.$set(D);const X={};F&2&&(X.$$scope={dirty:F,ctx:d}),E.$set(X)},i(d){fe||(C(t.$$.fragment,d),C(a.$$.fragment,d),C(I.$$.fragment,d),C(c.$$.fragment,d),C(H.$$.fragment,d),C(ce.$$.fragment,d),C(V.$$.fragment,d),C(te.$$.fragment,d),C(oe.$$.fragment,d),C(E.$$.fragment,d),fe=!0)},o(d){T(t.$$.fragment,d),T(a.$$.fragment,d),T(I.$$.fragment,d),T(c.$$.fragment,d),T(H.$$.fragment,d),T(ce.$$.fragment,d),T(V.$$.fragment,d),T(te.$$.fragment,d),T(oe.$$.fragment,d),T(E.$$.fragment,d),fe=!1},d(d){d&&(s(h),s(o),s(ae),s(O),s(k)),$(t,d),$(a),$(I),$(c),$(H),$(ce,d),$(V),$(te),$(oe),$(E)}}}function Pt(z){let t,h;return t=new _t({props:{$$slots:{default:[Ut]},$$scope:{ctx:z}}}),{c(){b(t.$$.fragment)},l(o){x(t.$$.fragment,o)},m(o,a){y(t,o,a),h=!0},p(o,a){const _={};a&2&&(_.$$scope={dirty:a,ctx:o}),t.$set(_)},i(o){h||(C(t.$$.fragment,o),h=!0)},o(o){T(t.$$.fragment,o),h=!1},d(o){$(t,o)}}}function kt(z){let t,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",o,a,_="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",n,v,ee=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,I,Q=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})</code></li>`,j,R,P=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){t=m("p"),t.innerHTML=h,o=i(),a=m("ul"),a.innerHTML=_,n=i(),v=m("p"),v.innerHTML=ee,N=i(),I=m("ul"),I.innerHTML=Q,j=i(),R=m("p"),R.innerHTML=P},l(c){t=p(c,"P",{"data-svelte-h":!0}),w(t)!=="svelte-1ajbfxg"&&(t.innerHTML=h),o=l(c),a=p(c,"UL",{"data-svelte-h":!0}),w(a)!=="svelte-qm1t26"&&(a.innerHTML=_),n=l(c),v=p(c,"P",{"data-svelte-h":!0}),w(v)!=="svelte-1v9qsc5"&&(v.innerHTML=ee),N=l(c),I=p(c,"UL",{"data-svelte-h":!0}),w(I)!=="svelte-99h8aq"&&(I.innerHTML=Q),j=l(c),R=p(c,"P",{"data-svelte-h":!0}),w(R)!=="svelte-1an3odd"&&(R.innerHTML=P)},m(c,U){r(c,t,U),r(c,o,U),r(c,a,U),r(c,n,U),r(c,v,U),r(c,N,U),r(c,I,U),r(c,j,U),r(c,R,U)},p:xe,d(c){c&&(s(t),s(o),s(a),s(n),s(v),s(N),s(I),s(j),s(R))}}}function Zt(z){let t,h=`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=m("p"),t.innerHTML=h},l(o){t=p(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=h)},m(o,a){r(o,t,a)},p:xe,d(o){o&&s(t)}}}function Wt(z){let t,h="Examples:",o,a,_;return a=new Qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGQ29udk5leHRNb2RlbCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZjb252bmV4dC10aW55LTIyNCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGQ29udk5leHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZjb252bmV4dC10aW55LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFConvNextModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> requests | |
| <span class="hljs-meta">>>> </span>url = <span class="hljs-string">"http://images.cocodataset.org/val2017/000000039769.jpg"</span> | |
| <span class="hljs-meta">>>> </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) | |
| <span class="hljs-meta">>>> </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFConvNextModel.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){t=m("p"),t.textContent=h,o=i(),b(a.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),w(t)!=="svelte-kvfsh7"&&(t.textContent=h),o=l(n),x(a.$$.fragment,n)},m(n,v){r(n,t,v),r(n,o,v),y(a,n,v),_=!0},p:xe,i(n){_||(C(a.$$.fragment,n),_=!0)},o(n){T(a.$$.fragment,n),_=!1},d(n){n&&(s(t),s(o)),$(a,n)}}}function Rt(z){let t,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",o,a,_="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",n,v,ee=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,I,Q=`<li>a single Tensor with <code>pixel_values</code> only and nothing else: <code>model(pixel_values)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([pixel_values, attention_mask])</code> or <code>model([pixel_values, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})</code></li>`,j,R,P=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){t=m("p"),t.innerHTML=h,o=i(),a=m("ul"),a.innerHTML=_,n=i(),v=m("p"),v.innerHTML=ee,N=i(),I=m("ul"),I.innerHTML=Q,j=i(),R=m("p"),R.innerHTML=P},l(c){t=p(c,"P",{"data-svelte-h":!0}),w(t)!=="svelte-1ajbfxg"&&(t.innerHTML=h),o=l(c),a=p(c,"UL",{"data-svelte-h":!0}),w(a)!=="svelte-qm1t26"&&(a.innerHTML=_),n=l(c),v=p(c,"P",{"data-svelte-h":!0}),w(v)!=="svelte-1v9qsc5"&&(v.innerHTML=ee),N=l(c),I=p(c,"UL",{"data-svelte-h":!0}),w(I)!=="svelte-99h8aq"&&(I.innerHTML=Q),j=l(c),R=p(c,"P",{"data-svelte-h":!0}),w(R)!=="svelte-1an3odd"&&(R.innerHTML=P)},m(c,U){r(c,t,U),r(c,o,U),r(c,a,U),r(c,n,U),r(c,v,U),r(c,N,U),r(c,I,U),r(c,j,U),r(c,R,U)},p:xe,d(c){c&&(s(t),s(o),s(a),s(n),s(v),s(N),s(I),s(j),s(R))}}}function qt(z){let t,h=`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=m("p"),t.innerHTML=h},l(o){t=p(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=h)},m(o,a){r(o,t,a)},p:xe,d(o){o&&s(t)}}}function Lt(z){let t,h="Examples:",o,a,_;return a=new Qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGQ29udk5leHRGb3JJbWFnZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGY29udm5leHQtdGlueS0yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkNvbnZOZXh0Rm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZjb252bmV4dC10aW55LTIyNCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cyUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfY2xhc3NfaWR4JTIwJTNEJTIwdGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQlMEFwcmludCglMjJQcmVkaWN0ZWQlMjBjbGFzcyUzQSUyMiUyQyUyMG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QmludChwcmVkaWN0ZWRfY2xhc3NfaWR4KSU1RCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFConvNextForImageClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> requests | |
| <span class="hljs-meta">>>> </span>url = <span class="hljs-string">"http://images.cocodataset.org/val2017/000000039769.jpg"</span> | |
| <span class="hljs-meta">>>> </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) | |
| <span class="hljs-meta">>>> </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFConvNextForImageClassification.from_pretrained(<span class="hljs-string">"facebook/convnext-tiny-224"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span> | |
| <span class="hljs-meta">>>> </span>predicted_class_idx = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(<span class="hljs-string">"Predicted class:"</span>, model.config.id2label[<span class="hljs-built_in">int</span>(predicted_class_idx)])`,wrap:!1}}),{c(){t=m("p"),t.textContent=h,o=i(),b(a.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),w(t)!=="svelte-kvfsh7"&&(t.textContent=h),o=l(n),x(a.$$.fragment,n)},m(n,v){r(n,t,v),r(n,o,v),y(a,n,v),_=!0},p:xe,i(n){_||(C(a.$$.fragment,n),_=!0)},o(n){T(a.$$.fragment,n),_=!1},d(n){n&&(s(t),s(o)),$(a,n)}}}function Jt(z){let t,h,o,a,_,n,v=`The bare ConvNext model outputting raw features without any specific head on top. | |
| This model inherits from <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,ee,N,I=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Q,j,R,P,c,U,H,ae='The <a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.TFConvNextModel">TFConvNextModel</a> forward method, overrides the <code>__call__</code> special method.',ce,O,k,V,pe,L,ye,Z,J,Te,re,q=`ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for | |
| ImageNet.`,te,Y,ge=`This model inherits from <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,he,K,oe=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,ie,E,fe,d,F,B,W,D='The <a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.TFConvNextForImageClassification">TFConvNextForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',X,ne,Ne,le,Ie;return t=new be({props:{title:"TFConvNextModel",local:"transformers.TFConvNextModel",headingTag:"h2"}}),a=new me({props:{name:"class transformers.TFConvNextModel",anchor:"transformers.TFConvNextModel",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"add_pooling_layer",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFConvNextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig">ConvNextConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_tf_convnext.py#L491"}}),j=new Se({props:{$$slots:{default:[kt]},$$scope:{ctx:z}}}),c=new me({props:{name:"call",anchor:"transformers.TFConvNextModel.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFConvNextModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) — | |
| Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_37396/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See | |
| <a href="/docs/transformers/pr_37396/en/model_doc/glpn#transformers.GLPNFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFConvNextModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFConvNextModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_37396/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_tf_convnext.py#L500",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_37396/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig" | |
| >ConvNextConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> | |
| </li> | |
| <li> | |
| <p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a | |
| Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence | |
| prediction (classification) objective during pretraining.</p> | |
| <p>This output is usually <em>not</em> a good summary of the semantic content of the input, you’re often better with | |
| averaging or pooling the sequence of hidden-states for the whole input sequence.</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, 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/pr_37396/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),O=new Se({props:{$$slots:{default:[Zt]},$$scope:{ctx:z}}}),V=new Ae({props:{anchor:"transformers.TFConvNextModel.call.example",$$slots:{default:[Wt]},$$scope:{ctx:z}}}),L=new be({props:{title:"TFConvNextForImageClassification",local:"transformers.TFConvNextForImageClassification",headingTag:"h2"}}),J=new me({props:{name:"class transformers.TFConvNextForImageClassification",anchor:"transformers.TFConvNextForImageClassification",parameters:[{name:"config",val:": ConvNextConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFConvNextForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig">ConvNextConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_37396/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_tf_convnext.py#L563"}}),E=new Se({props:{$$slots:{default:[Rt]},$$scope:{ctx:z}}}),F=new me({props:{name:"call",anchor:"transformers.TFConvNextForImageClassification.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFConvNextForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) — | |
| Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_37396/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See | |
| <a href="/docs/transformers/pr_37396/en/model_doc/glpn#transformers.GLPNFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFConvNextForImageClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFConvNextForImageClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_37396/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFConvNextForImageClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/modeling_tf_convnext.py#L586",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_37396/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextConfig" | |
| >ConvNextConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, 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/pr_37396/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),ne=new Se({props:{$$slots:{default:[qt]},$$scope:{ctx:z}}}),le=new Ae({props:{anchor:"transformers.TFConvNextForImageClassification.call.example",$$slots:{default:[Lt]},$$scope:{ctx:z}}}),{c(){b(t.$$.fragment),h=i(),o=m("div"),b(a.$$.fragment),_=i(),n=m("p"),n.innerHTML=v,ee=i(),N=m("p"),N.innerHTML=I,Q=i(),b(j.$$.fragment),R=i(),P=m("div"),b(c.$$.fragment),U=i(),H=m("p"),H.innerHTML=ae,ce=i(),b(O.$$.fragment),k=i(),b(V.$$.fragment),pe=i(),b(L.$$.fragment),ye=i(),Z=m("div"),b(J.$$.fragment),Te=i(),re=m("p"),re.textContent=q,te=i(),Y=m("p"),Y.innerHTML=ge,he=i(),K=m("p"),K.innerHTML=oe,ie=i(),b(E.$$.fragment),fe=i(),d=m("div"),b(F.$$.fragment),B=i(),W=m("p"),W.innerHTML=D,X=i(),b(ne.$$.fragment),Ne=i(),b(le.$$.fragment),this.h()},l(u){x(t.$$.fragment,u),h=l(u),o=p(u,"DIV",{class:!0});var M=se(o);x(a.$$.fragment,M),_=l(M),n=p(M,"P",{"data-svelte-h":!0}),w(n)!=="svelte-1m5mihl"&&(n.innerHTML=v),ee=l(M),N=p(M,"P",{"data-svelte-h":!0}),w(N)!=="svelte-1be7e3c"&&(N.innerHTML=I),Q=l(M),x(j.$$.fragment,M),R=l(M),P=p(M,"DIV",{class:!0});var de=se(P);x(c.$$.fragment,de),U=l(de),H=p(de,"P",{"data-svelte-h":!0}),w(H)!=="svelte-42b37e"&&(H.innerHTML=ae),ce=l(de),x(O.$$.fragment,de),k=l(de),x(V.$$.fragment,de),de.forEach(s),M.forEach(s),pe=l(u),x(L.$$.fragment,u),ye=l(u),Z=p(u,"DIV",{class:!0});var A=se(Z);x(J.$$.fragment,A),Te=l(A),re=p(A,"P",{"data-svelte-h":!0}),w(re)!=="svelte-xy24s5"&&(re.textContent=q),te=l(A),Y=p(A,"P",{"data-svelte-h":!0}),w(Y)!=="svelte-1nhje98"&&(Y.innerHTML=ge),he=l(A),K=p(A,"P",{"data-svelte-h":!0}),w(K)!=="svelte-1be7e3c"&&(K.innerHTML=oe),ie=l(A),x(E.$$.fragment,A),fe=l(A),d=p(A,"DIV",{class:!0});var G=se(d);x(F.$$.fragment,G),B=l(G),W=p(G,"P",{"data-svelte-h":!0}),w(W)!=="svelte-1nipfo0"&&(W.innerHTML=D),X=l(G),x(ne.$$.fragment,G),Ne=l(G),x(le.$$.fragment,G),G.forEach(s),A.forEach(s),this.h()},h(){S(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(u,M){y(t,u,M),r(u,h,M),r(u,o,M),y(a,o,null),g(o,_),g(o,n),g(o,ee),g(o,N),g(o,Q),y(j,o,null),g(o,R),g(o,P),y(c,P,null),g(P,U),g(P,H),g(P,ce),y(O,P,null),g(P,k),y(V,P,null),r(u,pe,M),y(L,u,M),r(u,ye,M),r(u,Z,M),y(J,Z,null),g(Z,Te),g(Z,re),g(Z,te),g(Z,Y),g(Z,he),g(Z,K),g(Z,ie),y(E,Z,null),g(Z,fe),g(Z,d),y(F,d,null),g(d,B),g(d,W),g(d,X),y(ne,d,null),g(d,Ne),y(le,d,null),Ie=!0},p(u,M){const de={};M&2&&(de.$$scope={dirty:M,ctx:u}),j.$set(de);const A={};M&2&&(A.$$scope={dirty:M,ctx:u}),O.$set(A);const G={};M&2&&(G.$$scope={dirty:M,ctx:u}),V.$set(G);const Fe={};M&2&&(Fe.$$scope={dirty:M,ctx:u}),E.$set(Fe);const Ce={};M&2&&(Ce.$$scope={dirty:M,ctx:u}),ne.$set(Ce);const je={};M&2&&(je.$$scope={dirty:M,ctx:u}),le.$set(je)},i(u){Ie||(C(t.$$.fragment,u),C(a.$$.fragment,u),C(j.$$.fragment,u),C(c.$$.fragment,u),C(O.$$.fragment,u),C(V.$$.fragment,u),C(L.$$.fragment,u),C(J.$$.fragment,u),C(E.$$.fragment,u),C(F.$$.fragment,u),C(ne.$$.fragment,u),C(le.$$.fragment,u),Ie=!0)},o(u){T(t.$$.fragment,u),T(a.$$.fragment,u),T(j.$$.fragment,u),T(c.$$.fragment,u),T(O.$$.fragment,u),T(V.$$.fragment,u),T(L.$$.fragment,u),T(J.$$.fragment,u),T(E.$$.fragment,u),T(F.$$.fragment,u),T(ne.$$.fragment,u),T(le.$$.fragment,u),Ie=!1},d(u){u&&(s(h),s(o),s(pe),s(ye),s(Z)),$(t,u),$(a),$(j),$(c),$(O),$(V),$(L,u),$(J),$(E),$(F),$(ne),$(le)}}}function Ht(z){let t,h;return t=new _t({props:{$$slots:{default:[Jt]},$$scope:{ctx:z}}}),{c(){b(t.$$.fragment)},l(o){x(t.$$.fragment,o)},m(o,a){y(t,o,a),h=!0},p(o,a){const _={};a&2&&(_.$$scope={dirty:a,ctx:o}),t.$set(_)},i(o){h||(C(t.$$.fragment,o),h=!0)},o(o){T(t.$$.fragment,o),h=!1},d(o){$(t,o)}}}function Et(z){let t,h,o,a,_,n,v,ee='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&logo=pytorch&logoColor=white"/> <img alt="TensorFlow" src="https://img.shields.io/badge/TensorFlow-FF6F00?style=flat&logo=tensorflow&logoColor=white"/>',N,I,Q,j,R=`The ConvNeXT model was proposed in <a href="https://arxiv.org/abs/2201.03545" rel="nofollow">A ConvNet for the 2020s</a> by Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie. | |
| ConvNeXT is a pure convolutional model (ConvNet), inspired by the design of Vision Transformers, that claims to outperform them.`,P,c,U="The abstract from the paper is the following:",H,ae,ce=`<em>The “Roaring 20s” of visual recognition began with the introduction of Vision Transformers (ViTs), which quickly superseded ConvNets as the state-of-the-art image classification model. | |
| A vanilla ViT, on the other hand, faces difficulties when applied to general computer vision tasks such as object detection and semantic segmentation. It is the hierarchical Transformers | |
| (e.g., Swin Transformers) that reintroduced several ConvNet priors, making Transformers practically viable as a generic vision backbone and demonstrating remarkable performance on a wide | |
| variety of vision tasks. However, the effectiveness of such hybrid approaches is still largely credited to the intrinsic superiority of Transformers, rather than the inherent inductive | |
| biases of convolutions. In this work, we reexamine the design spaces and test the limits of what a pure ConvNet can achieve. We gradually “modernize” a standard ResNet toward the design | |
| of a vision Transformer, and discover several key components that contribute to the performance difference along the way. The outcome of this exploration is a family of pure ConvNet models | |
| dubbed ConvNeXt. Constructed entirely from standard ConvNet modules, ConvNeXts compete favorably with Transformers in terms of accuracy and scalability, achieving 87.8% ImageNet top-1 accuracy | |
| and outperforming Swin Transformers on COCO detection and ADE20K segmentation, while maintaining the simplicity and efficiency of standard ConvNets.</em>`,O,k,V,pe,L,ye='ConvNeXT architecture. Taken from the <a href="https://arxiv.org/abs/2201.03545">original paper</a>.',Z,J,Te=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>. TensorFlow version of the model was contributed by <a href="https://github.com/ariG23498" rel="nofollow">ariG23498</a>, | |
| <a href="https://github.com/gante" rel="nofollow">gante</a>, and <a href="https://github.com/sayakpaul" rel="nofollow">sayakpaul</a> (equal contribution). The original code can be found <a href="https://github.com/facebookresearch/ConvNeXt" rel="nofollow">here</a>.`,re,q,te,Y,ge="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ConvNeXT.",he,K,oe,ie,E='<li><a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextForImageClassification">ConvNextForImageClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">notebook</a>.</li> <li>See also: <a href="../tasks/image_classification">Image classification task guide</a></li>',fe,d,F="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",B,W,D,X,ne,Ne,le,Ie=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_37396/en/model_doc/convnext#transformers.ConvNextModel">ConvNextModel</a>. It is used to instantiate an | |
| ConvNeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration | |
| with the defaults will yield a similar configuration to that of the ConvNeXT | |
| <a href="https://huggingface.co/facebook/convnext-tiny-224" rel="nofollow">facebook/convnext-tiny-224</a> architecture.`,u,M,de=`Configuration objects inherit from <a href="/docs/transformers/pr_37396/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/pr_37396/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,A,G,Fe,Ce,je,ze,Ue,Oe,Pe,Ye,ue,ke,it,Je,ft="Constructs a ConvNeXT image processor.",lt,$e,Ze,ct,He,gt="Preprocess an image or batch of images.",Ke,We,et,_e,Re,dt,Ee,ht="Constructs a fast ConvNeXT image processor.",mt,we,qe,pt,Be,ut="Preprocess an image or batch of images.",tt,Me,ot,Le,nt,Ve,st;return _=new be({props:{title:"ConvNeXT",local:"convnext",headingTag:"h1"}}),I=new be({props:{title:"Overview",local:"overview",headingTag:"h2"}}),q=new be({props:{title:"Resources",local:"resources",headingTag:"h2"}}),K=new wt({props:{pipeline:"image-classification"}}),W=new be({props:{title:"ConvNextConfig",local:"transformers.ConvNextConfig",headingTag:"h2"}}),ne=new me({props:{name:"class transformers.ConvNextConfig",anchor:"transformers.ConvNextConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"patch_size",val:" = 4"},{name:"num_stages",val:" = 4"},{name:"hidden_sizes",val:" = None"},{name:"depths",val:" = None"},{name:"hidden_act",val:" = 'gelu'"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"layer_scale_init_value",val:" = 1e-06"},{name:"drop_path_rate",val:" = 0.0"},{name:"image_size",val:" = 224"},{name:"out_features",val:" = None"},{name:"out_indices",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ConvNextConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) — | |
| The number of input channels.`,name:"num_channels"},{anchor:"transformers.ConvNextConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) — | |
| Patch size to use in the patch embedding layer.`,name:"patch_size"},{anchor:"transformers.ConvNextConfig.num_stages",description:`<strong>num_stages</strong> (<code>int</code>, <em>optional</em>, defaults to 4) — | |
| The number of stages in the model.`,name:"num_stages"},{anchor:"transformers.ConvNextConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [96, 192, 384, 768]) — | |
| Dimensionality (hidden size) at each stage.`,name:"hidden_sizes"},{anchor:"transformers.ConvNextConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [3, 3, 9, 3]) — | |
| Depth (number of blocks) for each stage.`,name:"depths"},{anchor:"transformers.ConvNextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>"gelu"</code>) — | |
| The non-linear activation function (function or string) in each block. If string, <code>"gelu"</code>, <code>"relu"</code>, | |
| <code>"selu"</code> and <code>"gelu_new"</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ConvNextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ConvNextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) — | |
| The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ConvNextConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) — | |
| The initial value for the layer scale.`,name:"layer_scale_init_value"},{anchor:"transformers.ConvNextConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) — | |
| The drop rate for stochastic depth.`,name:"drop_path_rate"},{anchor:"transformers.ConvNextConfig.out_features",description:`<strong>out_features</strong> (<code>List[str]</code>, <em>optional</em>) — | |
| If used as backbone, list of features to output. Can be any of <code>"stem"</code>, <code>"stage1"</code>, <code>"stage2"</code>, etc. | |
| (depending on how many stages the model has). If unset and <code>out_indices</code> is set, will default to the | |
| corresponding stages. If unset and <code>out_indices</code> is unset, will default to the last stage. Must be in the | |
| same order as defined in the <code>stage_names</code> attribute.`,name:"out_features"},{anchor:"transformers.ConvNextConfig.out_indices",description:`<strong>out_indices</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how | |
| many stages the model has). If unset and <code>out_features</code> is set, will default to the corresponding stages. | |
| If unset and <code>out_features</code> is unset, will default to the last stage. Must be in the | |
| same order as defined in the <code>stage_names</code> attribute.`,name:"out_indices"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/configuration_convnext.py#L31"}}),G=new Ae({props:{anchor:"transformers.ConvNextConfig.example",$$slots:{default:[Nt]},$$scope:{ctx:z}}}),Ce=new be({props:{title:"ConvNextFeatureExtractor",local:"transformers.ConvNextFeatureExtractor",headingTag:"h2"}}),Ue=new me({props:{name:"class transformers.ConvNextFeatureExtractor",anchor:"transformers.ConvNextFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/feature_extraction_convnext.py#L26"}}),Pe=new be({props:{title:"ConvNextImageProcessor",local:"transformers.ConvNextImageProcessor",headingTag:"h2"}}),ke=new me({props:{name:"class transformers.ConvNextImageProcessor",anchor:"transformers.ConvNextImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"crop_pct",val:": typing.Optional[float] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ConvNextImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Controls whether to resize the image’s (height, width) dimensions to the specified <code>size</code>. Can be overriden | |
| by <code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.ConvNextImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{"shortest_edge" -- 384}</code>): | |
| Resolution of the output image after <code>resize</code> is applied. If <code>size["shortest_edge"]</code> >= 384, the image is | |
| resized to <code>(size["shortest_edge"], size["shortest_edge"])</code>. Otherwise, the smaller edge of the image will | |
| be matched to <code>int(size["shortest_edge"]/crop_pct)</code>, after which the image is cropped to | |
| <code>(size["shortest_edge"], size["shortest_edge"])</code>. Only has an effect if <code>do_resize</code> is set to <code>True</code>. Can | |
| be overriden by <code>size</code> in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.ConvNextImageProcessor.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code> <em>optional</em>, defaults to 224 / 256) — | |
| Percentage of the image to crop. Only has an effect if <code>do_resize</code> is <code>True</code> and size < 384. Can be | |
| overriden by <code>crop_pct</code> in the <code>preprocess</code> method.`,name:"crop_pct"},{anchor:"transformers.ConvNextImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BILINEAR</code>) — | |
| Resampling filter to use if resizing the image. Can be overriden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.ConvNextImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overriden by <code>do_rescale</code> in | |
| the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.ConvNextImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) — | |
| Scale factor to use if rescaling the image. Can be overriden by <code>rescale_factor</code> in the <code>preprocess</code> | |
| method.`,name:"rescale_factor"},{anchor:"transformers.ConvNextImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> | |
| method.`,name:"do_normalize"},{anchor:"transformers.ConvNextImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) — | |
| Mean to use if normalizing the image. This is a float or list of floats the length of the number of | |
| channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.ConvNextImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) — | |
| Standard deviation to use if normalizing the image. This is a float or list of floats the length of the | |
| number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/image_processing_convnext.py#L51"}}),Ze=new me({props:{name:"preprocess",anchor:"transformers.ConvNextImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"crop_pct",val:": typing.Optional[float] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],parametersDescription:[{anchor:"transformers.ConvNextImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) — | |
| Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If | |
| passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.ConvNextImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.ConvNextImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) — | |
| Size of the output image after <code>resize</code> has been applied. If <code>size["shortest_edge"]</code> >= 384, the image | |
| is resized to <code>(size["shortest_edge"], size["shortest_edge"])</code>. Otherwise, the smaller edge of the | |
| image will be matched to <code>int(size["shortest_edge"]/ crop_pct)</code>, after which the image is cropped to | |
| <code>(size["shortest_edge"], size["shortest_edge"])</code>. Only has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"size"},{anchor:"transformers.ConvNextImageProcessor.preprocess.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.crop_pct</code>) — | |
| Percentage of the image to crop if size < 384.`,name:"crop_pct"},{anchor:"transformers.ConvNextImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) — | |
| Resampling filter to use if resizing the image. This can be one of <code>PILImageResampling</code>, filters. Only | |
| has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ConvNextImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) — | |
| Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.ConvNextImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.ConvNextImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.ConvNextImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) — | |
| Image mean.`,name:"image_mean"},{anchor:"transformers.ConvNextImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) — | |
| Image standard deviation.`,name:"image_std"},{anchor:"transformers.ConvNextImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) — | |
| The type of tensors to return. Can be one of:<ul> | |
| <li>Unset: Return a list of <code>np.ndarray</code>.</li> | |
| <li><code>TensorType.TENSORFLOW</code> or <code>'tf'</code>: Return a batch of type <code>tf.Tensor</code>.</li> | |
| <li><code>TensorType.PYTORCH</code> or <code>'pt'</code>: Return a batch of type <code>torch.Tensor</code>.</li> | |
| <li><code>TensorType.NUMPY</code> or <code>'np'</code>: Return a batch of type <code>np.ndarray</code>.</li> | |
| <li><code>TensorType.JAX</code> or <code>'jax'</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li> | |
| </ul>`,name:"return_tensors"},{anchor:"transformers.ConvNextImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) — | |
| The channel dimension format for the output image. Can be one of:<ul> | |
| <li><code>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li>Unset: Use the channel dimension format of the input image.</li> | |
| </ul>`,name:"data_format"},{anchor:"transformers.ConvNextImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) — | |
| The channel dimension format for the input image. If unset, the channel dimension format is inferred | |
| from the input image. Can be one of:<ul> | |
| <li><code>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/image_processing_convnext.py#L186"}}),We=new be({props:{title:"ConvNextImageProcessorFast",local:"transformers.ConvNextImageProcessorFast",headingTag:"h2"}}),Re=new me({props:{name:"class transformers.ConvNextImageProcessorFast",anchor:"transformers.ConvNextImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.convnext.image_processing_convnext_fast.ConvNextFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.ConvNextImageProcessorFast.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) — | |
| Whether to resize the image’s (height, width) dimensions to the specified <code>size</code>. Can be overridden by the | |
| <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.ConvNextImageProcessorFast.size",description:`<strong>size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.size</code>) — | |
| Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code> | |
| method.`,name:"size"},{anchor:"transformers.ConvNextImageProcessorFast.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.default_to_square</code>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.ConvNextImageProcessorFast.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) — | |
| Resampling filter to use if resizing the image. Only has an effect if <code>do_resize</code> is set to <code>True</code>. Can be | |
| overridden by the <code>resample</code> parameter in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.ConvNextImageProcessorFast.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) — | |
| Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the | |
| <code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.ConvNextImageProcessorFast.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>self.crop_size</code>) — | |
| Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code> | |
| method.`,name:"crop_size"},{anchor:"transformers.ConvNextImageProcessorFast.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) — | |
| Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the | |
| <code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.ConvNextImageProcessorFast.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) — | |
| Scale factor to use if rescaling the image. Only has an effect if <code>do_rescale</code> is set to <code>True</code>. Can be | |
| overridden by the <code>rescale_factor</code> parameter in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.ConvNextImageProcessorFast.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) — | |
| Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> | |
| method. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.ConvNextImageProcessorFast.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) — | |
| Mean to use if normalizing the image. This is a float or list of floats the length of the number of | |
| channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method. Can be | |
| overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.ConvNextImageProcessorFast.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) — | |
| Standard deviation to use if normalizing the image. This is a float or list of floats the length of the | |
| number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method. | |
| Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.ConvNextImageProcessorFast.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ConvNextImageProcessorFast.return_tensors",description:"<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to <code>self.return_tensors</code>) —\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.ConvNextImageProcessorFast.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.data_format</code>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.ConvNextImageProcessorFast.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.input_data_format</code>) — | |
| The channel dimension format for the input image. If unset, the channel dimension format is inferred | |
| from the input image. Can be one of:<ul> | |
| <li><code>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.ConvNextImageProcessorFast.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>self.device</code>) — | |
| The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.ConvNextImageProcessorFast.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code>, <em>optional</em>) — | |
| Percentage of the image to crop. Only has an effect if size < 384. Can be | |
| overridden by <code>crop_pct</code> in the<code>preprocess</code> method.`,name:"crop_pct"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/image_processing_convnext_fast.py#L60"}}),qe=new me({props:{name:"preprocess",anchor:"transformers.ConvNextImageProcessorFast.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.convnext.image_processing_convnext_fast.ConvNextFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.ConvNextImageProcessorFast.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) — | |
| Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If | |
| passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) — | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> or <code>InterpolationMode</code>, <em>optional</em>, defaults to <code>self.resample</code>) — | |
| Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only | |
| has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) — | |
| Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) — | |
| Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to | |
| <code>True</code>.`,name:"image_std"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.return_tensors",description:"<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to <code>self.return_tensors</code>) —\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.data_format</code>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.input_data_format</code>) — | |
| The channel dimension format for the input image. If unset, the channel dimension format is inferred | |
| from the input image. Can be one of:<ul> | |
| <li><code>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>self.device</code>) — | |
| The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.ConvNextImageProcessorFast.preprocess.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code>, <em>optional</em>) — | |
| Percentage of the image to crop. Only has an effect if size < 384. Can be | |
| overridden by <code>crop_pct</code> in the<code>preprocess</code> method.`,name:"crop_pct"}],source:"https://github.com/huggingface/transformers/blob/vr_37396/src/transformers/models/convnext/image_processing_convnext_fast.py#L84"}}),Me=new $t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ht],pytorch:[Pt]},$$scope:{ctx:z}}}),Le=new Mt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/convnext.md"}}),{c(){t=m("meta"),h=i(),o=m("p"),a=i(),b(_.$$.fragment),n=i(),v=m("div"),v.innerHTML=ee,N=i(),b(I.$$.fragment),Q=i(),j=m("p"),j.innerHTML=R,P=i(),c=m("p"),c.textContent=U,H=i(),ae=m("p"),ae.innerHTML=ce,O=i(),k=m("img"),pe=i(),L=m("small"),L.innerHTML=ye,Z=i(),J=m("p"),J.innerHTML=Te,re=i(),b(q.$$.fragment),te=i(),Y=m("p"),Y.textContent=ge,he=i(),b(K.$$.fragment),oe=i(),ie=m("ul"),ie.innerHTML=E,fe=i(),d=m("p"),d.textContent=F,B=i(),b(W.$$.fragment),D=i(),X=m("div"),b(ne.$$.fragment),Ne=i(),le=m("p"),le.innerHTML=Ie,u=i(),M=m("p"),M.innerHTML=de,A=i(),b(G.$$.fragment),Fe=i(),b(Ce.$$.fragment),je=i(),ze=m("div"),b(Ue.$$.fragment),Oe=i(),b(Pe.$$.fragment),Ye=i(),ue=m("div"),b(ke.$$.fragment),it=i(),Je=m("p"),Je.textContent=ft,lt=i(),$e=m("div"),b(Ze.$$.fragment),ct=i(),He=m("p"),He.textContent=gt,Ke=i(),b(We.$$.fragment),et=i(),_e=m("div"),b(Re.$$.fragment),dt=i(),Ee=m("p"),Ee.textContent=ht,mt=i(),we=m("div"),b(qe.$$.fragment),pt=i(),Be=m("p"),Be.textContent=ut,tt=i(),b(Me.$$.fragment),ot=i(),b(Le.$$.fragment),nt=i(),Ve=m("p"),this.h()},l(e){const f=Tt("svelte-u9bgzb",document.head);t=p(f,"META",{name:!0,content:!0}),f.forEach(s),h=l(e),o=p(e,"P",{}),se(o).forEach(s),a=l(e),x(_.$$.fragment,e),n=l(e),v=p(e,"DIV",{class:!0,"data-svelte-h":!0}),w(v)!=="svelte-ltwe0m"&&(v.innerHTML=ee),N=l(e),x(I.$$.fragment,e),Q=l(e),j=p(e,"P",{"data-svelte-h":!0}),w(j)!=="svelte-1m8plns"&&(j.innerHTML=R),P=l(e),c=p(e,"P",{"data-svelte-h":!0}),w(c)!=="svelte-vfdo9a"&&(c.textContent=U),H=l(e),ae=p(e,"P",{"data-svelte-h":!0}),w(ae)!=="svelte-1bctlxd"&&(ae.innerHTML=ce),O=l(e),k=p(e,"IMG",{src:!0,alt:!0,width:!0}),pe=l(e),L=p(e,"SMALL",{"data-svelte-h":!0}),w(L)!=="svelte-dowkk3"&&(L.innerHTML=ye),Z=l(e),J=p(e,"P",{"data-svelte-h":!0}),w(J)!=="svelte-u3e1xt"&&(J.innerHTML=Te),re=l(e),x(q.$$.fragment,e),te=l(e),Y=p(e,"P",{"data-svelte-h":!0}),w(Y)!=="svelte-11wcl3s"&&(Y.textContent=ge),he=l(e),x(K.$$.fragment,e),oe=l(e),ie=p(e,"UL",{"data-svelte-h":!0}),w(ie)!=="svelte-w2ooju"&&(ie.innerHTML=E),fe=l(e),d=p(e,"P",{"data-svelte-h":!0}),w(d)!=="svelte-1xesile"&&(d.textContent=F),B=l(e),x(W.$$.fragment,e),D=l(e),X=p(e,"DIV",{class:!0});var ve=se(X);x(ne.$$.fragment,ve),Ne=l(ve),le=p(ve,"P",{"data-svelte-h":!0}),w(le)!=="svelte-n2pt5q"&&(le.innerHTML=Ie),u=l(ve),M=p(ve,"P",{"data-svelte-h":!0}),w(M)!=="svelte-vdtwl7"&&(M.innerHTML=de),A=l(ve),x(G.$$.fragment,ve),ve.forEach(s),Fe=l(e),x(Ce.$$.fragment,e),je=l(e),ze=p(e,"DIV",{class:!0});var De=se(ze);x(Ue.$$.fragment,De),De.forEach(s),Oe=l(e),x(Pe.$$.fragment,e),Ye=l(e),ue=p(e,"DIV",{class:!0});var Xe=se(ue);x(ke.$$.fragment,Xe),it=l(Xe),Je=p(Xe,"P",{"data-svelte-h":!0}),w(Je)!=="svelte-12gun77"&&(Je.textContent=ft),lt=l(Xe),$e=p(Xe,"DIV",{class:!0});var at=se($e);x(Ze.$$.fragment,at),ct=l(at),He=p(at,"P",{"data-svelte-h":!0}),w(He)!=="svelte-1x3yxsa"&&(He.textContent=gt),at.forEach(s),Xe.forEach(s),Ke=l(e),x(We.$$.fragment,e),et=l(e),_e=p(e,"DIV",{class:!0});var Ge=se(_e);x(Re.$$.fragment,Ge),dt=l(Ge),Ee=p(Ge,"P",{"data-svelte-h":!0}),w(Ee)!=="svelte-1bn0s7p"&&(Ee.textContent=ht),mt=l(Ge),we=p(Ge,"DIV",{class:!0});var rt=se(we);x(qe.$$.fragment,rt),pt=l(rt),Be=p(rt,"P",{"data-svelte-h":!0}),w(Be)!=="svelte-1x3yxsa"&&(Be.textContent=ut),rt.forEach(s),Ge.forEach(s),tt=l(e),x(Me.$$.fragment,e),ot=l(e),x(Le.$$.fragment,e),nt=l(e),Ve=p(e,"P",{}),se(Ve).forEach(s),this.h()},h(){S(t,"name","hf:doc:metadata"),S(t,"content",Bt),S(v,"class","flex flex-wrap space-x-1"),bt(k.src,V="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/convnext_architecture.jpg")||S(k,"src",V),S(k,"alt","drawing"),S(k,"width","600"),S(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(_e,"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,f){g(document.head,t),r(e,h,f),r(e,o,f),r(e,a,f),y(_,e,f),r(e,n,f),r(e,v,f),r(e,N,f),y(I,e,f),r(e,Q,f),r(e,j,f),r(e,P,f),r(e,c,f),r(e,H,f),r(e,ae,f),r(e,O,f),r(e,k,f),r(e,pe,f),r(e,L,f),r(e,Z,f),r(e,J,f),r(e,re,f),y(q,e,f),r(e,te,f),r(e,Y,f),r(e,he,f),y(K,e,f),r(e,oe,f),r(e,ie,f),r(e,fe,f),r(e,d,f),r(e,B,f),y(W,e,f),r(e,D,f),r(e,X,f),y(ne,X,null),g(X,Ne),g(X,le),g(X,u),g(X,M),g(X,A),y(G,X,null),r(e,Fe,f),y(Ce,e,f),r(e,je,f),r(e,ze,f),y(Ue,ze,null),r(e,Oe,f),y(Pe,e,f),r(e,Ye,f),r(e,ue,f),y(ke,ue,null),g(ue,it),g(ue,Je),g(ue,lt),g(ue,$e),y(Ze,$e,null),g($e,ct),g($e,He),r(e,Ke,f),y(We,e,f),r(e,et,f),r(e,_e,f),y(Re,_e,null),g(_e,dt),g(_e,Ee),g(_e,mt),g(_e,we),y(qe,we,null),g(we,pt),g(we,Be),r(e,tt,f),y(Me,e,f),r(e,ot,f),y(Le,e,f),r(e,nt,f),r(e,Ve,f),st=!0},p(e,[f]){const ve={};f&2&&(ve.$$scope={dirty:f,ctx:e}),G.$set(ve);const De={};f&2&&(De.$$scope={dirty:f,ctx:e}),Me.$set(De)},i(e){st||(C(_.$$.fragment,e),C(I.$$.fragment,e),C(q.$$.fragment,e),C(K.$$.fragment,e),C(W.$$.fragment,e),C(ne.$$.fragment,e),C(G.$$.fragment,e),C(Ce.$$.fragment,e),C(Ue.$$.fragment,e),C(Pe.$$.fragment,e),C(ke.$$.fragment,e),C(Ze.$$.fragment,e),C(We.$$.fragment,e),C(Re.$$.fragment,e),C(qe.$$.fragment,e),C(Me.$$.fragment,e),C(Le.$$.fragment,e),st=!0)},o(e){T(_.$$.fragment,e),T(I.$$.fragment,e),T(q.$$.fragment,e),T(K.$$.fragment,e),T(W.$$.fragment,e),T(ne.$$.fragment,e),T(G.$$.fragment,e),T(Ce.$$.fragment,e),T(Ue.$$.fragment,e),T(Pe.$$.fragment,e),T(ke.$$.fragment,e),T(Ze.$$.fragment,e),T(We.$$.fragment,e),T(Re.$$.fragment,e),T(qe.$$.fragment,e),T(Me.$$.fragment,e),T(Le.$$.fragment,e),st=!1},d(e){e&&(s(h),s(o),s(a),s(n),s(v),s(N),s(Q),s(j),s(P),s(c),s(H),s(ae),s(O),s(k),s(pe),s(L),s(Z),s(J),s(re),s(te),s(Y),s(he),s(oe),s(ie),s(fe),s(d),s(B),s(D),s(X),s(Fe),s(je),s(ze),s(Oe),s(Ye),s(ue),s(Ke),s(et),s(_e),s(tt),s(ot),s(nt),s(Ve)),s(t),$(_,e),$(I,e),$(q,e),$(K,e),$(W,e),$(ne),$(G),$(Ce,e),$(Ue),$(Pe,e),$(ke),$(Ze),$(We,e),$(Re),$(qe),$(Me,e),$(Le,e)}}}const Bt='{"title":"ConvNeXT","local":"convnext","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"ConvNextConfig","local":"transformers.ConvNextConfig","sections":[],"depth":2},{"title":"ConvNextFeatureExtractor","local":"transformers.ConvNextFeatureExtractor","sections":[],"depth":2},{"title":"ConvNextImageProcessor","local":"transformers.ConvNextImageProcessor","sections":[],"depth":2},{"title":"ConvNextImageProcessorFast","local":"transformers.ConvNextImageProcessorFast","sections":[],"depth":2},{"title":"ConvNextModel","local":"transformers.ConvNextModel","sections":[],"depth":2},{"title":"ConvNextForImageClassification","local":"transformers.ConvNextForImageClassification","sections":[],"depth":2},{"title":"TFConvNextModel","local":"transformers.TFConvNextModel","sections":[],"depth":2},{"title":"TFConvNextForImageClassification","local":"transformers.TFConvNextForImageClassification","sections":[],"depth":2}],"depth":1}';function Xt(z){return xt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class eo extends yt{constructor(t){super(),Ct(this,t,Xt,Et,vt,{})}}export{eo as component}; | |
Xet Storage Details
- Size:
- 98.1 kB
- Xet hash:
- e077a2037309707d3f340f3fb92d7f51296226aaf35ce73f79c28976391b2d2b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.