import{S as om,i as sm,s as am,e as s,k as d,w,t as r,M as rm,c as a,d as t,m,a as i,x as M,h as n,b as p,G as e,g as f,y as $,q as V,o as E,B as F,v as nm,L as Cs}from"../../chunks/vendor-hf-doc-builder.js";import{T as Jt}from"../../chunks/Tip-hf-doc-builder.js";import{D as ie}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $o}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as mt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ks}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as im}from"../../chunks/PipelineTag-hf-doc-builder.js";function lm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1vYmlsZVZpVENvbmZpZyUyQyUyME1vYmlsZVZpVE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vYmlsZXZpdC1zbWFsbCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBNb2JpbGVWaVRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBtb2JpbGV2aXQtc21hbGwlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyME1vYmlsZVZpVE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MobileViTConfig, MobileViTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a mobilevit-small style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = MobileViTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the mobilevit-small style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileViTModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=s("p"),T=r("Example:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Example:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function cm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function dm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZVZpVE1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJhcHBsZSUyRm1vYmlsZXZpdC1zbWFsbCUyMiklMEFtb2RlbCUyMCUzRCUyME1vYmlsZVZpVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJhcHBsZSUyRm1vYmlsZXZpdC1zbWFsbCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileViTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileViTModel.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">640</span>, <span class="hljs-number">8</span>, <span class="hljs-number">8</span>]`}}),{c(){c=s("p"),T=r("Example:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Example:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function mm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function pm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZVZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmFwcGxlJTJGbW9iaWxldml0LXNtYWxsJTIyKSUwQW1vZGVsJTIwJTNEJTIwTW9iaWxlVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYXBwbGUlMkZtb2JpbGV2aXQtc21hbGwlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileViTForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileViTForImageClassification.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`}}),{c(){c=s("p"),T=r("Example:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Example:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function hm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function fm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZVZpVEZvclNlbWFudGljU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJhcHBsZSUyRmRlZXBsYWJ2My1tb2JpbGV2aXQtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBNb2JpbGVWaVRGb3JTZW1hbnRpY1NlZ21lbnRhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYXBwbGUlMkZkZWVwbGFidjMtbW9iaWxldml0LXNtYWxsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEElMjMlMjBsb2dpdHMlMjBhcmUlMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fbGFiZWxzJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGgpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileViTForSemanticSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/deeplabv3-mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileViTForSemanticSegmentation.from_pretrained(<span class="hljs-string">&quot;apple/deeplabv3-mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># logits are of shape (batch_size, num_labels, height, width)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=s("p"),T=r("Examples:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Examples:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function um(U){let c,T,b,g,v,l,h,I,ke,be,N,ee,te,y,Ce,L,Ie,_e,P,je,oe,O,Ue,ve,R,xe,Te,G,de,Je,se,j,J,ye,x,me,ae,q,re,We,W,Ze,X,ne,Ne,B,Se,Pe,A,pe,z,ze,Y,Z,Re,S,he,H;return{c(){c=s("p"),T=r("TensorFlow models and layers in "),b=s("code"),g=r("transformers"),v=r(" accept two formats as input:"),l=d(),h=s("ul"),I=s("li"),ke=r("having all inputs as keyword arguments (like PyTorch models), or"),be=d(),N=s("li"),ee=r("having all inputs as a list, tuple or dict in the first positional argument."),te=d(),y=s("p"),Ce=r(`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 `),L=s("code"),Ie=r("model.fit()"),_e=r(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=s("code"),je=r("model.fit()"),oe=r(` supports! If, however, you want to use the second
format outside of Keras methods like `),O=s("code"),Ue=r("fit()"),ve=r(" and "),R=s("code"),xe=r("predict()"),Te=r(`, such as when creating your own layers or models with
the Keras `),G=s("code"),de=r("Functional"),Je=r(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),se=d(),j=s("ul"),J=s("li"),ye=r("a single Tensor with "),x=s("code"),me=r("pixel_values"),ae=r(" only and nothing else: "),q=s("code"),re=r("model(pixel_values)"),We=d(),W=s("li"),Ze=r(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=s("code"),ne=r("model([pixel_values, attention_mask])"),Ne=r(" or "),B=s("code"),Se=r("model([pixel_values, attention_mask, token_type_ids])"),Pe=d(),A=s("li"),pe=r(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=s("code"),ze=r('model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),Y=d(),Z=s("p"),Re=r(`Note that when creating models and layers with
`),S=s("a"),he=r("subclassing"),H=r(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){c=a(_,"P",{});var k=i(c);T=n(k,"TensorFlow models and layers in "),b=a(k,"CODE",{});var He=i(b);g=n(He,"transformers"),He.forEach(t),v=n(k," accept two formats as input:"),k.forEach(t),l=m(_),h=a(_,"UL",{});var le=i(h);I=a(le,"LI",{});var we=i(I);ke=n(we,"having all inputs as keyword arguments (like PyTorch models), or"),we.forEach(t),be=m(le),N=a(le,"LI",{});var Qe=i(N);ee=n(Qe,"having all inputs as a list, tuple or dict in the first positional argument."),Qe.forEach(t),le.forEach(t),te=m(_),y=a(_,"P",{});var C=i(y);Ce=n(C,`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 `),L=a(C,"CODE",{});var Ke=i(L);Ie=n(Ke,"model.fit()"),Ke.forEach(t),_e=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=a(C,"CODE",{});var Me=i(P);je=n(Me,"model.fit()"),Me.forEach(t),oe=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),O=a(C,"CODE",{});var $e=i(O);Ue=n($e,"fit()"),$e.forEach(t),ve=n(C," and "),R=a(C,"CODE",{});var et=i(R);xe=n(et,"predict()"),et.forEach(t),Te=n(C,`, such as when creating your own layers or models with
the Keras `),G=a(C,"CODE",{});var Ve=i(G);de=n(Ve,"Functional"),Ve.forEach(t),Je=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),se=m(_),j=a(_,"UL",{});var D=i(j);J=a(D,"LI",{});var Q=i(J);ye=n(Q,"a single Tensor with "),x=a(Q,"CODE",{});var tt=i(x);me=n(tt,"pixel_values"),tt.forEach(t),ae=n(Q," only and nothing else: "),q=a(Q,"CODE",{});var Be=i(q);re=n(Be,"model(pixel_values)"),Be.forEach(t),Q.forEach(t),We=m(D),W=a(D,"LI",{});var K=i(W);Ze=n(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=a(K,"CODE",{});var De=i(X);ne=n(De,"model([pixel_values, attention_mask])"),De.forEach(t),Ne=n(K," or "),B=a(K,"CODE",{});var Ee=i(B);Se=n(Ee,"model([pixel_values, attention_mask, token_type_ids])"),Ee.forEach(t),K.forEach(t),Pe=m(D),A=a(D,"LI",{});var Fe=i(A);pe=n(Fe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=a(Fe,"CODE",{});var fe=i(z);ze=n(fe,'model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),fe.forEach(t),Fe.forEach(t),D.forEach(t),Y=m(_),Z=a(_,"P",{});var ce=i(Z);Re=n(ce,`Note that when creating models and layers with
`),S=a(ce,"A",{href:!0,rel:!0});var Ae=i(S);he=n(Ae,"subclassing"),Ae.forEach(t),H=n(ce,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),ce.forEach(t),this.h()},h(){p(S,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),p(S,"rel","nofollow")},m(_,k){f(_,c,k),e(c,T),e(c,b),e(b,g),e(c,v),f(_,l,k),f(_,h,k),e(h,I),e(I,ke),e(h,be),e(h,N),e(N,ee),f(_,te,k),f(_,y,k),e(y,Ce),e(y,L),e(L,Ie),e(y,_e),e(y,P),e(P,je),e(y,oe),e(y,O),e(O,Ue),e(y,ve),e(y,R),e(R,xe),e(y,Te),e(y,G),e(G,de),e(y,Je),f(_,se,k),f(_,j,k),e(j,J),e(J,ye),e(J,x),e(x,me),e(J,ae),e(J,q),e(q,re),e(j,We),e(j,W),e(W,Ze),e(W,X),e(X,ne),e(W,Ne),e(W,B),e(B,Se),e(j,Pe),e(j,A),e(A,pe),e(A,z),e(z,ze),f(_,Y,k),f(_,Z,k),e(Z,Re),e(Z,S),e(S,he),e(Z,H)},d(_){_&&t(c),_&&t(l),_&&t(h),_&&t(te),_&&t(y),_&&t(se),_&&t(j),_&&t(Y),_&&t(Z)}}}function gm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function bm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGTW9iaWxlVmlUTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJhcHBsZSUyRm1vYmlsZXZpdC1zbWFsbCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGTW9iaWxlVmlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmFwcGxlJTJGbW9iaWxldml0LXNtYWxsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFMobileViTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMobileViTModel.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">640</span>, <span class="hljs-number">8</span>, <span class="hljs-number">8</span>]`}}),{c(){c=s("p"),T=r("Example:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Example:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function _m(U){let c,T,b,g,v,l,h,I,ke,be,N,ee,te,y,Ce,L,Ie,_e,P,je,oe,O,Ue,ve,R,xe,Te,G,de,Je,se,j,J,ye,x,me,ae,q,re,We,W,Ze,X,ne,Ne,B,Se,Pe,A,pe,z,ze,Y,Z,Re,S,he,H;return{c(){c=s("p"),T=r("TensorFlow models and layers in "),b=s("code"),g=r("transformers"),v=r(" accept two formats as input:"),l=d(),h=s("ul"),I=s("li"),ke=r("having all inputs as keyword arguments (like PyTorch models), or"),be=d(),N=s("li"),ee=r("having all inputs as a list, tuple or dict in the first positional argument."),te=d(),y=s("p"),Ce=r(`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 `),L=s("code"),Ie=r("model.fit()"),_e=r(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=s("code"),je=r("model.fit()"),oe=r(` supports! If, however, you want to use the second
format outside of Keras methods like `),O=s("code"),Ue=r("fit()"),ve=r(" and "),R=s("code"),xe=r("predict()"),Te=r(`, such as when creating your own layers or models with
the Keras `),G=s("code"),de=r("Functional"),Je=r(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),se=d(),j=s("ul"),J=s("li"),ye=r("a single Tensor with "),x=s("code"),me=r("pixel_values"),ae=r(" only and nothing else: "),q=s("code"),re=r("model(pixel_values)"),We=d(),W=s("li"),Ze=r(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=s("code"),ne=r("model([pixel_values, attention_mask])"),Ne=r(" or "),B=s("code"),Se=r("model([pixel_values, attention_mask, token_type_ids])"),Pe=d(),A=s("li"),pe=r(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=s("code"),ze=r('model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),Y=d(),Z=s("p"),Re=r(`Note that when creating models and layers with
`),S=s("a"),he=r("subclassing"),H=r(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){c=a(_,"P",{});var k=i(c);T=n(k,"TensorFlow models and layers in "),b=a(k,"CODE",{});var He=i(b);g=n(He,"transformers"),He.forEach(t),v=n(k," accept two formats as input:"),k.forEach(t),l=m(_),h=a(_,"UL",{});var le=i(h);I=a(le,"LI",{});var we=i(I);ke=n(we,"having all inputs as keyword arguments (like PyTorch models), or"),we.forEach(t),be=m(le),N=a(le,"LI",{});var Qe=i(N);ee=n(Qe,"having all inputs as a list, tuple or dict in the first positional argument."),Qe.forEach(t),le.forEach(t),te=m(_),y=a(_,"P",{});var C=i(y);Ce=n(C,`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 `),L=a(C,"CODE",{});var Ke=i(L);Ie=n(Ke,"model.fit()"),Ke.forEach(t),_e=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=a(C,"CODE",{});var Me=i(P);je=n(Me,"model.fit()"),Me.forEach(t),oe=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),O=a(C,"CODE",{});var $e=i(O);Ue=n($e,"fit()"),$e.forEach(t),ve=n(C," and "),R=a(C,"CODE",{});var et=i(R);xe=n(et,"predict()"),et.forEach(t),Te=n(C,`, such as when creating your own layers or models with
the Keras `),G=a(C,"CODE",{});var Ve=i(G);de=n(Ve,"Functional"),Ve.forEach(t),Je=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),se=m(_),j=a(_,"UL",{});var D=i(j);J=a(D,"LI",{});var Q=i(J);ye=n(Q,"a single Tensor with "),x=a(Q,"CODE",{});var tt=i(x);me=n(tt,"pixel_values"),tt.forEach(t),ae=n(Q," only and nothing else: "),q=a(Q,"CODE",{});var Be=i(q);re=n(Be,"model(pixel_values)"),Be.forEach(t),Q.forEach(t),We=m(D),W=a(D,"LI",{});var K=i(W);Ze=n(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=a(K,"CODE",{});var De=i(X);ne=n(De,"model([pixel_values, attention_mask])"),De.forEach(t),Ne=n(K," or "),B=a(K,"CODE",{});var Ee=i(B);Se=n(Ee,"model([pixel_values, attention_mask, token_type_ids])"),Ee.forEach(t),K.forEach(t),Pe=m(D),A=a(D,"LI",{});var Fe=i(A);pe=n(Fe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=a(Fe,"CODE",{});var fe=i(z);ze=n(fe,'model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),fe.forEach(t),Fe.forEach(t),D.forEach(t),Y=m(_),Z=a(_,"P",{});var ce=i(Z);Re=n(ce,`Note that when creating models and layers with
`),S=a(ce,"A",{href:!0,rel:!0});var Ae=i(S);he=n(Ae,"subclassing"),Ae.forEach(t),H=n(ce,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),ce.forEach(t),this.h()},h(){p(S,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),p(S,"rel","nofollow")},m(_,k){f(_,c,k),e(c,T),e(c,b),e(b,g),e(c,v),f(_,l,k),f(_,h,k),e(h,I),e(I,ke),e(h,be),e(h,N),e(N,ee),f(_,te,k),f(_,y,k),e(y,Ce),e(y,L),e(L,Ie),e(y,_e),e(y,P),e(P,je),e(y,oe),e(y,O),e(O,Ue),e(y,ve),e(y,R),e(R,xe),e(y,Te),e(y,G),e(G,de),e(y,Je),f(_,se,k),f(_,j,k),e(j,J),e(J,ye),e(J,x),e(x,me),e(J,ae),e(J,q),e(q,re),e(j,We),e(j,W),e(W,Ze),e(W,X),e(X,ne),e(W,Ne),e(W,B),e(B,Se),e(j,Pe),e(j,A),e(A,pe),e(A,z),e(z,ze),f(_,Y,k),f(_,Z,k),e(Z,Re),e(Z,S),e(S,he),e(Z,H)},d(_){_&&t(c),_&&t(l),_&&t(h),_&&t(te),_&&t(y),_&&t(se),_&&t(j),_&&t(Y),_&&t(Z)}}}function vm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function Tm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGTW9iaWxlVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyYXBwbGUlMkZtb2JpbGV2aXQtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBURk1vYmlsZVZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmFwcGxlJTJGbW9iaWxldml0LXNtYWxsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFMobileViTForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMobileViTForImageClassification.from_pretrained(<span class="hljs-string">&quot;apple/mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`}}),{c(){c=s("p"),T=r("Example:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Example:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function ym(U){let c,T,b,g,v,l,h,I,ke,be,N,ee,te,y,Ce,L,Ie,_e,P,je,oe,O,Ue,ve,R,xe,Te,G,de,Je,se,j,J,ye,x,me,ae,q,re,We,W,Ze,X,ne,Ne,B,Se,Pe,A,pe,z,ze,Y,Z,Re,S,he,H;return{c(){c=s("p"),T=r("TensorFlow models and layers in "),b=s("code"),g=r("transformers"),v=r(" accept two formats as input:"),l=d(),h=s("ul"),I=s("li"),ke=r("having all inputs as keyword arguments (like PyTorch models), or"),be=d(),N=s("li"),ee=r("having all inputs as a list, tuple or dict in the first positional argument."),te=d(),y=s("p"),Ce=r(`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 `),L=s("code"),Ie=r("model.fit()"),_e=r(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=s("code"),je=r("model.fit()"),oe=r(` supports! If, however, you want to use the second
format outside of Keras methods like `),O=s("code"),Ue=r("fit()"),ve=r(" and "),R=s("code"),xe=r("predict()"),Te=r(`, such as when creating your own layers or models with
the Keras `),G=s("code"),de=r("Functional"),Je=r(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),se=d(),j=s("ul"),J=s("li"),ye=r("a single Tensor with "),x=s("code"),me=r("pixel_values"),ae=r(" only and nothing else: "),q=s("code"),re=r("model(pixel_values)"),We=d(),W=s("li"),Ze=r(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=s("code"),ne=r("model([pixel_values, attention_mask])"),Ne=r(" or "),B=s("code"),Se=r("model([pixel_values, attention_mask, token_type_ids])"),Pe=d(),A=s("li"),pe=r(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=s("code"),ze=r('model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),Y=d(),Z=s("p"),Re=r(`Note that when creating models and layers with
`),S=s("a"),he=r("subclassing"),H=r(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){c=a(_,"P",{});var k=i(c);T=n(k,"TensorFlow models and layers in "),b=a(k,"CODE",{});var He=i(b);g=n(He,"transformers"),He.forEach(t),v=n(k," accept two formats as input:"),k.forEach(t),l=m(_),h=a(_,"UL",{});var le=i(h);I=a(le,"LI",{});var we=i(I);ke=n(we,"having all inputs as keyword arguments (like PyTorch models), or"),we.forEach(t),be=m(le),N=a(le,"LI",{});var Qe=i(N);ee=n(Qe,"having all inputs as a list, tuple or dict in the first positional argument."),Qe.forEach(t),le.forEach(t),te=m(_),y=a(_,"P",{});var C=i(y);Ce=n(C,`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 `),L=a(C,"CODE",{});var Ke=i(L);Ie=n(Ke,"model.fit()"),Ke.forEach(t),_e=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),P=a(C,"CODE",{});var Me=i(P);je=n(Me,"model.fit()"),Me.forEach(t),oe=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),O=a(C,"CODE",{});var $e=i(O);Ue=n($e,"fit()"),$e.forEach(t),ve=n(C," and "),R=a(C,"CODE",{});var et=i(R);xe=n(et,"predict()"),et.forEach(t),Te=n(C,`, such as when creating your own layers or models with
the Keras `),G=a(C,"CODE",{});var Ve=i(G);de=n(Ve,"Functional"),Ve.forEach(t),Je=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),se=m(_),j=a(_,"UL",{});var D=i(j);J=a(D,"LI",{});var Q=i(J);ye=n(Q,"a single Tensor with "),x=a(Q,"CODE",{});var tt=i(x);me=n(tt,"pixel_values"),tt.forEach(t),ae=n(Q," only and nothing else: "),q=a(Q,"CODE",{});var Be=i(q);re=n(Be,"model(pixel_values)"),Be.forEach(t),Q.forEach(t),We=m(D),W=a(D,"LI",{});var K=i(W);Ze=n(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),X=a(K,"CODE",{});var De=i(X);ne=n(De,"model([pixel_values, attention_mask])"),De.forEach(t),Ne=n(K," or "),B=a(K,"CODE",{});var Ee=i(B);Se=n(Ee,"model([pixel_values, attention_mask, token_type_ids])"),Ee.forEach(t),K.forEach(t),Pe=m(D),A=a(D,"LI",{});var Fe=i(A);pe=n(Fe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),z=a(Fe,"CODE",{});var fe=i(z);ze=n(fe,'model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})'),fe.forEach(t),Fe.forEach(t),D.forEach(t),Y=m(_),Z=a(_,"P",{});var ce=i(Z);Re=n(ce,`Note that when creating models and layers with
`),S=a(ce,"A",{href:!0,rel:!0});var Ae=i(S);he=n(Ae,"subclassing"),Ae.forEach(t),H=n(ce,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),ce.forEach(t),this.h()},h(){p(S,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),p(S,"rel","nofollow")},m(_,k){f(_,c,k),e(c,T),e(c,b),e(b,g),e(c,v),f(_,l,k),f(_,h,k),e(h,I),e(I,ke),e(h,be),e(h,N),e(N,ee),f(_,te,k),f(_,y,k),e(y,Ce),e(y,L),e(L,Ie),e(y,_e),e(y,P),e(P,je),e(y,oe),e(y,O),e(O,Ue),e(y,ve),e(y,R),e(R,xe),e(y,Te),e(y,G),e(G,de),e(y,Je),f(_,se,k),f(_,j,k),e(j,J),e(J,ye),e(J,x),e(x,me),e(J,ae),e(J,q),e(q,re),e(j,We),e(j,W),e(W,Ze),e(W,X),e(X,ne),e(W,Ne),e(W,B),e(B,Se),e(j,Pe),e(j,A),e(A,pe),e(A,z),e(z,ze),f(_,Y,k),f(_,Z,k),e(Z,Re),e(Z,S),e(S,he),e(Z,H)},d(_){_&&t(c),_&&t(l),_&&t(h),_&&t(te),_&&t(y),_&&t(se),_&&t(j),_&&t(Y),_&&t(Z)}}}function wm(U){let c,T,b,g,v;return{c(){c=s("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),b=s("code"),g=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),b=a(h,"CODE",{});var I=i(b);g=n(I,"Module"),I.forEach(t),v=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,c,h),e(c,T),e(c,b),e(b,g),e(c,v)},d(l){l&&t(c)}}}function Mm(U){let c,T,b,g,v;return g=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFRGTW9iaWxlVmlURm9yU2VtYW50aWNTZWdtZW50YXRpb24lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmFwcGxlJTJGZGVlcGxhYnYzLW1vYmlsZXZpdC1zbWFsbCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGTW9iaWxlVmlURm9yU2VtYW50aWNTZWdtZW50YXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmFwcGxlJTJGZGVlcGxhYnYzLW1vYmlsZXZpdC1zbWFsbCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEElMjMlMjBsb2dpdHMlMjBhcmUlMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fbGFiZWxzJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGgpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFMobileViTForSemanticSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;apple/deeplabv3-mobilevit-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMobileViTForSemanticSegmentation.from_pretrained(<span class="hljs-string">&quot;apple/deeplabv3-mobilevit-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># logits are of shape (batch_size, num_labels, height, width)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=s("p"),T=r("Examples:"),b=d(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var h=i(c);T=n(h,"Examples:"),h.forEach(t),b=m(l),M(g.$$.fragment,l)},m(l,h){f(l,c,h),e(c,T),f(l,b,h),$(g,l,h),v=!0},p:Cs,i(l){v||(V(g.$$.fragment,l),v=!0)},o(l){E(g.$$.fragment,l),v=!1},d(l){l&&t(c),l&&t(b),F(g,l)}}}function $m(U){let c,T,b,g,v,l,h,I,ke,be,N,ee,te,y,Ce,L,Ie,_e,P,je,oe,O,Ue,ve,R,xe,Te,G,de,Je,se,j,J,ye,x,me,ae,q,re,We,W,Ze,X,ne,Ne,B,Se,Pe,A,pe,z,ze,Y,Z,Re,S,he,H,_,k,He,le,we,Qe,C,Ke,Me,$e,et,Ve,D,Q,tt,Be,K,De,Ee,Fe,fe,ce,Ae,ln,cn,or,ot,dn,Vo,mn,pn,Eo,hn,fn,Fo,un,gn,sr,gt,Wt,ca,ko,bn,da,_n,ar,Is,vn,rr,Co,nr,Zt,ft,js,Tn,yn,Io,wn,Mn,jo,$n,Vn,En,Us,Fn,xs,kn,ir,Js,ma,Cn,lr,Ws,pa,Zs,In,cr,Ns,jn,dr,bt,Nt,ha,Uo,Un,fa,xn,mr,Le,xo,Jn,_t,Wn,Ss,Zn,Nn,Jo,Sn,Pn,zn,vt,Rn,Ps,Gn,Bn,zs,An,Dn,Ln,St,pr,Tt,Pt,ua,Wo,Xn,ga,Yn,hr,pt,Zo,On,zt,No,qn,ba,Hn,Qn,Rt,So,Kn,Po,ei,Rs,ti,oi,fr,yt,Gt,_a,zo,si,va,ai,ur,Xe,Ro,ri,Ta,ni,ii,Bt,Go,li,ya,ci,di,At,Bo,mi,Ao,pi,Gs,hi,fi,gr,wt,Dt,wa,Do,ui,Ma,gi,br,ht,Lo,bi,Xo,_i,Yo,vi,Ti,yi,st,Oo,wi,Mt,Mi,Bs,$i,Vi,$a,Ei,Fi,ki,Lt,Ci,Xt,_r,$t,Yt,Va,qo,Ii,Ea,ji,vr,Ye,Ho,Ui,Fa,xi,Ji,Qo,Wi,Ko,Zi,Ni,Si,at,es,Pi,Vt,zi,As,Ri,Gi,ka,Bi,Ai,Di,Ot,Li,qt,Tr,Et,Ht,Ca,ts,Xi,Ia,Yi,yr,Oe,os,Oi,ja,qi,Hi,ss,Qi,as,Ki,el,tl,rt,rs,ol,Ft,sl,Ds,al,rl,Ua,nl,il,ll,Qt,cl,Kt,wr,kt,eo,xa,ns,dl,Ja,ml,Mr,Ge,is,pl,ls,hl,Ls,fl,ul,gl,cs,bl,ds,_l,vl,Tl,to,yl,nt,ms,wl,Ct,Ml,Xs,$l,Vl,Wa,El,Fl,kl,oo,Cl,so,$r,It,ao,Za,ps,Il,Na,jl,Vr,ue,hs,Ul,Sa,xl,Jl,fs,Wl,Ys,Zl,Nl,Sl,us,Pl,gs,zl,Rl,Gl,ro,Bl,it,bs,Al,jt,Dl,Os,Ll,Xl,Pa,Yl,Ol,ql,no,Hl,io,Er,Ut,lo,za,_s,Ql,Ra,Kl,Fr,ge,vs,ec,Ga,tc,oc,Ts,sc,qs,ac,rc,nc,ys,ic,ws,lc,cc,dc,co,mc,lt,Ms,pc,xt,hc,Hs,fc,uc,Ba,gc,bc,_c,mo,vc,po,kr;return l=new mt({}),y=new mt({}),Ee=new $o({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGTW9iaWxlVmlURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBJTBBbW9kZWxfY2twdCUyMCUzRCUyMCUyMmFwcGxlJTJGbW9iaWxldml0LXh4LXNtYWxsJTIyJTBBbW9kZWwlMjAlM0QlMjBURk1vYmlsZVZpVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2NrcHQpJTBBJTBBY29udmVydGVyJTIwJTNEJTIwdGYubGl0ZS5URkxpdGVDb252ZXJ0ZXIuZnJvbV9rZXJhc19tb2RlbChtb2RlbCklMEFjb252ZXJ0ZXIub3B0aW1pemF0aW9ucyUyMCUzRCUyMCU1QnRmLmxpdGUuT3B0aW1pemUuREVGQVVMVCU1RCUwQWNvbnZlcnRlci50YXJnZXRfc3BlYy5zdXBwb3J0ZWRfb3BzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwdGYubGl0ZS5PcHNTZXQuVEZMSVRFX0JVSUxUSU5TJTJDJTBBJTIwJTIwJTIwJTIwdGYubGl0ZS5PcHNTZXQuU0VMRUNUX1RGX09QUyUyQyUwQSU1RCUwQXRmbGl0ZV9tb2RlbCUyMCUzRCUyMGNvbnZlcnRlci5jb252ZXJ0KCklMEF0ZmxpdGVfZmlsZW5hbWUlMjAlM0QlMjBtb2RlbF9ja3B0LnNwbGl0KCUyMiUyRiUyMiklNUItMSU1RCUyMCUyQiUyMCUyMi50ZmxpdGUlMjIlMEF3aXRoJTIwb3Blbih0ZmxpdGVfZmlsZW5hbWUlMkMlMjAlMjJ3YiUyMiklMjBhcyUyMGYlM0ElMEElMjAlMjAlMjAlMjBmLndyaXRlKHRmbGl0ZV9tb2RlbCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFMobileViTForImageClassification
<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf


model_ckpt = <span class="hljs-string">&quot;apple/mobilevit-xx-small&quot;</span>
model = TFMobileViTForImageClassification.from_pretrained(model_ckpt)

converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_ops = [
    tf.lite.OpsSet.TFLITE_BUILTINS,
    tf.lite.OpsSet.SELECT_TF_OPS,
]
tflite_model = converter.convert()
tflite_filename = model_ckpt.split(<span class="hljs-string">&quot;/&quot;</span>)[-<span class="hljs-number">1</span>] + <span class="hljs-string">&quot;.tflite&quot;</span>
<span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(tflite_filename, <span class="hljs-string">&quot;wb&quot;</span>) <span class="hljs-keyword">as</span> f:
    f.write(tflite_model)`}}),ko=new mt({}),Co=new im({props:{pipeline:"image-classification"}}),Uo=new mt({}),xo=new ie({props:{name:"class transformers.MobileViTConfig",anchor:"transformers.MobileViTConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 256"},{name:"patch_size",val:" = 2"},{name:"hidden_sizes",val:" = [144, 192, 240]"},{name:"neck_hidden_sizes",val:" = [16, 32, 64, 96, 128, 160, 640]"},{name:"num_attention_heads",val:" = 4"},{name:"mlp_ratio",val:" = 2.0"},{name:"expand_ratio",val:" = 4.0"},{name:"hidden_act",val:" = 'silu'"},{name:"conv_kernel_size",val:" = 3"},{name:"output_stride",val:" = 32"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"classifier_dropout_prob",val:" = 0.1"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"qkv_bias",val:" = True"},{name:"aspp_out_channels",val:" = 256"},{name:"atrous_rates",val:" = [6, 12, 18]"},{name:"aspp_dropout_prob",val:" = 0.1"},{name:"semantic_loss_ignore_index",val:" = 255"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileViTConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.MobileViTConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.MobileViTConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.MobileViTConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[144, 192, 240]</code>) &#x2014;
Dimensionality (hidden size) of the Transformer encoders at each stage.`,name:"hidden_sizes"},{anchor:"transformers.MobileViTConfig.neck_hidden_sizes",description:`<strong>neck_hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[16, 32, 64, 96, 128, 160, 640]</code>) &#x2014;
The number of channels for the feature maps of the backbone.`,name:"neck_hidden_sizes"},{anchor:"transformers.MobileViTConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.MobileViTConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 2.0) &#x2014;
The ratio of the number of channels in the output of the MLP to the number of channels in the input.`,name:"mlp_ratio"},{anchor:"transformers.MobileViTConfig.expand_ratio",description:`<strong>expand_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Expansion factor for the MobileNetv2 layers.`,name:"expand_ratio"},{anchor:"transformers.MobileViTConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the Transformer encoder and convolution layers.`,name:"hidden_act"},{anchor:"transformers.MobileViTConfig.conv_kernel_size",description:`<strong>conv_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The size of the convolutional kernel in the MobileViT layer.`,name:"conv_kernel_size"},{anchor:"transformers.MobileViTConfig.output_stride",description:`<strong>output_stride</strong> (<code>int</code>, <code>optional</code>, defaults to 32) &#x2014;
The ratio of the spatial resolution of the output to the resolution of the input image.`,name:"output_stride"},{anchor:"transformers.MobileViTConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the Transformer encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.MobileViTConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.MobileViTConfig.classifier_dropout_prob",description:`<strong>classifier_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for attached classifiers.`,name:"classifier_dropout_prob"},{anchor:"transformers.MobileViTConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.MobileViTConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.MobileViTConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.MobileViTConfig.aspp_out_channels",description:`<strong>aspp_out_channels</strong> (<code>int</code>, <code>optional</code>, defaults to 256) &#x2014;
Number of output channels used in the ASPP layer for semantic segmentation.`,name:"aspp_out_channels"},{anchor:"transformers.MobileViTConfig.atrous_rates",description:`<strong>atrous_rates</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[6, 12, 18]</code>) &#x2014;
Dilation (atrous) factors used in the ASPP layer for semantic segmentation.`,name:"atrous_rates"},{anchor:"transformers.MobileViTConfig.aspp_dropout_prob",description:`<strong>aspp_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the ASPP layer for semantic segmentation.`,name:"aspp_dropout_prob"},{anchor:"transformers.MobileViTConfig.semantic_loss_ignore_index",description:`<strong>semantic_loss_ignore_index</strong> (<code>int</code>, <em>optional</em>, defaults to 255) &#x2014;
The index that is ignored by the loss function of the semantic segmentation model.`,name:"semantic_loss_ignore_index"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/configuration_mobilevit.py#L46"}}),St=new ks({props:{anchor:"transformers.MobileViTConfig.example",$$slots:{default:[lm]},$$scope:{ctx:U}}}),Wo=new mt({}),Zo=new ie({props:{name:"class transformers.MobileViTFeatureExtractor",anchor:"transformers.MobileViTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/feature_extraction_mobilevit.py#L26"}}),No=new ie({props:{name:"__call__",anchor:"transformers.MobileViTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/image_processing_utils.py#L462"}}),So=new ie({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MobileViTFeatureExtractor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple] = None"}],parametersDescription:[{anchor:"transformers.MobileViTFeatureExtractor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForSemanticSegmentation">MobileViTForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MobileViTFeatureExtractor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
A list of length <code>batch_size</code>, where each item is a <code>Tuple[int, int]</code> corresponding to the requested
final size (height, width) of each prediction. If left to None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/image_processing_mobilevit.py#L300",returnDescription:`
<p>A list of length <code>batch_size</code>, where each item is a semantic segmentation map of shape (height, width)
corresponding to the target_sizes entry (if <code>target_sizes</code> is specified). Each entry of each
<code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`
<p><code>List[torch.Tensor]</code></p>
`}}),zo=new mt({}),Ro=new ie({props:{name:"class transformers.MobileViTImageProcessor",anchor:"transformers.MobileViTImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = 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_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_flip_channel_order",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileViTImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;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.MobileViTImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Controls the 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.MobileViTImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Defines the resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter
in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.MobileViTImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
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.MobileViTImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.MobileViTImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to crop the input at the center. If the input size is smaller than <code>crop_size</code> along any edge, the
image is padded with 0&#x2019;s and then center cropped. Can be overridden by the <code>do_center_crop</code> parameter in
the <code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.MobileViTImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 256, &quot;width&quot;: 256}</code>):
Desired output size <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code> when applying center-cropping. Can be overridden by
the <code>crop_size</code> parameter in the <code>preprocess</code> method.`,name:"crop_size"},{anchor:"transformers.MobileViTImageProcessor.do_flip_channel_order",description:`<strong>do_flip_channel_order</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to flip the color channels from RGB to BGR. Can be overridden by the <code>do_flip_channel_order</code>
parameter in the <code>preprocess</code> method.`,name:"do_flip_channel_order"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/image_processing_mobilevit.py#L51"}}),Go=new ie({props:{name:"preprocess",anchor:"transformers.MobileViTImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_flip_channel_order",val:": bool = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileViTImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.MobileViTImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.MobileViTImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing.`,name:"size"},{anchor:"transformers.MobileViTImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
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.MobileViTImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image by rescale factor.`,name:"do_rescale"},{anchor:"transformers.MobileViTImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.MobileViTImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.MobileViTImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.MobileViTImageProcessor.preprocess.do_flip_channel_order",description:`<strong>do_flip_channel_order</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_flip_channel_order</code>) &#x2014;
Whether to flip the channel order of the image.`,name:"do_flip_channel_order"},{anchor:"transformers.MobileViTImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.MobileViTImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/image_processing_mobilevit.py#L198"}}),Bo=new ie({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MobileViTImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple] = None"}],parametersDescription:[{anchor:"transformers.MobileViTImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForSemanticSegmentation">MobileViTForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MobileViTImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
A list of length <code>batch_size</code>, where each item is a <code>Tuple[int, int]</code> corresponding to the requested
final size (height, width) of each prediction. If left to None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/image_processing_mobilevit.py#L300",returnDescription:`
<p>A list of length <code>batch_size</code>, where each item is a semantic segmentation map of shape (height, width)
corresponding to the target_sizes entry (if <code>target_sizes</code> is specified). Each entry of each
<code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`
<p><code>List[torch.Tensor]</code></p>
`}}),Do=new mt({}),Lo=new ie({props:{name:"class transformers.MobileViTModel",anchor:"transformers.MobileViTModel",parameters:[{name:"config",val:": MobileViTConfig"},{name:"expand_output",val:": bool = True"}],parametersDescription:[{anchor:"transformers.MobileViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L708"}}),Oo=new ie({props:{name:"forward",anchor:"transformers.MobileViTModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MobileViTModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileViTModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.MobileViTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L745",returnDescription:`
<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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Lt=new Jt({props:{$$slots:{default:[cm]},$$scope:{ctx:U}}}),Xt=new ks({props:{anchor:"transformers.MobileViTModel.forward.example",$$slots:{default:[dm]},$$scope:{ctx:U}}}),qo=new mt({}),Ho=new ie({props:{name:"class transformers.MobileViTForImageClassification",anchor:"transformers.MobileViTForImageClassification",parameters:[{name:"config",val:": MobileViTConfig"}],parametersDescription:[{anchor:"transformers.MobileViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L802"}}),es=new ie({props:{name:"forward",anchor:"transformers.MobileViTForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MobileViTForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileViTForImageClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.MobileViTForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MobileViTForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss). If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L818",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</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) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ot=new Jt({props:{$$slots:{default:[mm]},$$scope:{ctx:U}}}),qt=new ks({props:{anchor:"transformers.MobileViTForImageClassification.forward.example",$$slots:{default:[pm]},$$scope:{ctx:U}}}),ts=new mt({}),os=new ie({props:{name:"class transformers.MobileViTForSemanticSegmentation",anchor:"transformers.MobileViTForSemanticSegmentation",parameters:[{name:"config",val:": MobileViTConfig"}],parametersDescription:[{anchor:"transformers.MobileViTForSemanticSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L997"}}),rs=new ie({props:{name:"forward",anchor:"transformers.MobileViTForSemanticSegmentation.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MobileViTForSemanticSegmentation.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileViTForSemanticSegmentation.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.MobileViTForSemanticSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MobileViTForSemanticSegmentation.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Ground truth semantic segmentation maps for computing the loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels &gt; 1</code>, a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/modeling_mobilevit.py#L1008",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels, logits_height, logits_width)</code>) \u2014 Classification scores for each pixel.</p>
<Tip warning={true}>
<p>The logits returned do not necessarily have the same size as the <code>pixel_values</code> passed as inputs. This is
to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the
original image size as post-processing. You should always check your logits shape and resize as needed.</p>
</Tip>
</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>) \u2014 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, patch_size, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Qt=new Jt({props:{$$slots:{default:[hm]},$$scope:{ctx:U}}}),Kt=new ks({props:{anchor:"transformers.MobileViTForSemanticSegmentation.forward.example",$$slots:{default:[fm]},$$scope:{ctx:U}}}),ns=new mt({}),is=new ie({props:{name:"class transformers.TFMobileViTModel",anchor:"transformers.TFMobileViTModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFMobileViTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L800"}}),to=new Jt({props:{$$slots:{default:[um]},$$scope:{ctx:U}}}),ms=new ie({props:{name:"call",anchor:"transformers.TFMobileViTModel.call",parameters:[{name:"pixel_values",val:": tf.Tensor | 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.TFMobileViTModel.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>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFMobileViTModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. 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.TFMobileViTModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L808",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</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>) \u2014 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>) \u2014 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\u2019re 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),oo=new Jt({props:{$$slots:{default:[gm]},$$scope:{ctx:U}}}),so=new ks({props:{anchor:"transformers.TFMobileViTModel.call.example",$$slots:{default:[bm]},$$scope:{ctx:U}}}),ps=new mt({}),hs=new ie({props:{name:"class transformers.TFMobileViTForImageClassification",anchor:"transformers.TFMobileViTForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFMobileViTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L835"}}),ro=new Jt({props:{$$slots:{default:[_m]},$$scope:{ctx:U}}}),bs=new ie({props:{name:"call",anchor:"transformers.TFMobileViTForImageClassification.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"labels",val:": tf.Tensor | None = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFMobileViTForImageClassification.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>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFMobileViTForImageClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. 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.TFMobileViTForImageClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/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.TFMobileViTForImageClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss). If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L848",returnDescription:`
<p>A <code>transformers.modeling_tf_outputs.TFImageClassifierOutputWithNoAttention</code> 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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</li>
<li><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</li>
<li><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>) \u2014 Tuple of <code>tf.Tensor</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:`
<p><code>transformers.modeling_tf_outputs.TFImageClassifierOutputWithNoAttention</code> or <code>tuple(tf.Tensor)</code></p>
`}}),no=new Jt({props:{$$slots:{default:[vm]},$$scope:{ctx:U}}}),io=new ks({props:{anchor:"transformers.TFMobileViTForImageClassification.call.example",$$slots:{default:[Tm]},$$scope:{ctx:U}}}),_s=new mt({}),vs=new ie({props:{name:"class transformers.TFMobileViTForSemanticSegmentation",anchor:"transformers.TFMobileViTForSemanticSegmentation",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFMobileViTForSemanticSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig">MobileViTConfig</a>) &#x2014; 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/v4.30.0/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/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L1011"}}),co=new Jt({props:{$$slots:{default:[ym]},$$scope:{ctx:U}}}),Ms=new ie({props:{name:"call",anchor:"transformers.TFMobileViTForSemanticSegmentation.call",parameters:[{name:"pixel_values",val:": tf.Tensor | None = None"},{name:"labels",val:": tf.Tensor | 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.TFMobileViTForSemanticSegmentation.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>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">MobileViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFMobileViTForSemanticSegmentation.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. 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.TFMobileViTForSemanticSegmentation.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/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.TFMobileViTForSemanticSegmentation.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Ground truth semantic segmentation maps for computing the loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels &gt; 1</code>, a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mobilevit/modeling_tf_mobilevit.py#L1039",returnDescription:`
<p>A <code>transformers.modeling_tf_outputs.TFSemanticSegmenterOutputWithNoAttention</code> 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/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTConfig"
>MobileViTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 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, logits_height, logits_width)</code>) \u2014 Classification scores for each pixel.</p>
<Tip warning={true}>
<p>The logits returned do not necessarily have the same size as the <code>pixel_values</code> passed as inputs. This is
to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the
original image size as post-processing. You should always check your logits shape and resize as needed.</p>
</Tip>
</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>) \u2014 Tuple of <code>tf.Tensor</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, patch_size, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_tf_outputs.TFSemanticSegmenterOutputWithNoAttention</code> or <code>tuple(tf.Tensor)</code></p>
`}}),mo=new Jt({props:{$$slots:{default:[wm]},$$scope:{ctx:U}}}),po=new ks({props:{anchor:"transformers.TFMobileViTForSemanticSegmentation.call.example",$$slots:{default:[Mm]},$$scope:{ctx:U}}}),{c(){c=s("meta"),T=d(),b=s("h1"),g=s("a"),v=s("span"),w(l.$$.fragment),h=d(),I=s("span"),ke=r("MobileViT"),be=d(),N=s("h2"),ee=s("a"),te=s("span"),w(y.$$.fragment),Ce=d(),L=s("span"),Ie=r("Overview"),_e=d(),P=s("p"),je=r("The MobileViT model was proposed in "),oe=s("a"),O=r("MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer"),Ue=r(" by Sachin Mehta and Mohammad Rastegari. MobileViT introduces a new layer that replaces local processing in convolutions with global processing using transformers."),ve=d(),R=s("p"),xe=r("The abstract from the paper is the following:"),Te=d(),G=s("p"),de=s("em"),Je=r("Light-weight convolutional neural networks (CNNs) are the de-facto for mobile vision tasks. Their spatial inductive biases allow them to learn representations with fewer parameters across different vision tasks. However, these networks are spatially local. To learn global representations, self-attention-based vision trans-formers (ViTs) have been adopted. Unlike CNNs, ViTs are heavy-weight. In this paper, we ask the following question: is it possible to combine the strengths of CNNs and ViTs to build a light-weight and low latency network for mobile vision tasks? Towards this end, we introduce MobileViT, a light-weight and general-purpose vision transformer for mobile devices. MobileViT presents a different perspective for the global processing of information with transformers, i.e., transformers as convolutions. Our results show that MobileViT significantly outperforms CNN- and ViT-based networks across different tasks and datasets. On the ImageNet-1k dataset, MobileViT achieves top-1 accuracy of 78.4% with about 6 million parameters, which is 3.2% and 6.2% more accurate than MobileNetv3 (CNN-based) and DeIT (ViT-based) for a similar number of parameters. On the MS-COCO object detection task, MobileViT is 5.7% more accurate than MobileNetv3 for a similar number of parameters."),se=d(),j=s("p"),J=r("Tips:"),ye=d(),x=s("ul"),me=s("li"),ae=s("p"),q=r("MobileViT is more like a CNN than a Transformer model. It does not work on sequence data but on batches of images. Unlike ViT, there are no embeddings. The backbone model outputs a feature map. You can follow "),re=s("a"),We=r("this tutorial"),W=r(" for a lightweight introduction."),Ze=d(),X=s("li"),ne=s("p"),Ne=r("One can use "),B=s("a"),Se=r("MobileViTImageProcessor"),Pe=r(" to prepare images for the model. Note that if you do your own preprocessing, the pretrained checkpoints expect images to be in BGR pixel order (not RGB)."),A=d(),pe=s("li"),z=s("p"),ze=r("The available image classification checkpoints are pre-trained on "),Y=s("a"),Z=r("ImageNet-1k"),Re=r(" (also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes)."),S=d(),he=s("li"),H=s("p"),_=r("The segmentation model uses a "),k=s("a"),He=r("DeepLabV3"),le=r(" head. The available semantic segmentation checkpoints are pre-trained on "),we=s("a"),Qe=r("PASCAL VOC"),C=r("."),Ke=d(),Me=s("li"),$e=s("p"),et=r("As the name suggests MobileViT was designed to be performant and efficient on mobile phones. The TensorFlow versions of the MobileViT models are fully compatible with "),Ve=s("a"),D=r("TensorFlow Lite"),Q=r("."),tt=d(),Be=s("p"),K=r(`You can use the following code to convert a MobileViT checkpoint (be it image classification or semantic segmentation) to generate a
TensorFlow Lite model:`),De=d(),w(Ee.$$.fragment),Fe=d(),fe=s("p"),ce=r("The resulting model will be just "),Ae=s("strong"),ln=r("about an MB"),cn=r(` making it a good fit for mobile applications where resources and network
bandwidth can be constrained.`),or=d(),ot=s("p"),dn=r("This model was contributed by "),Vo=s("a"),mn=r("matthijs"),pn=r(". The TensorFlow version of the model was contributed by "),Eo=s("a"),hn=r("sayakpaul"),fn=r(". The original code and weights can be found "),Fo=s("a"),un=r("here"),gn=r("."),sr=d(),gt=s("h2"),Wt=s("a"),ca=s("span"),w(ko.$$.fragment),bn=d(),da=s("span"),_n=r("Resources"),ar=d(),Is=s("p"),vn=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with MobileViT."),rr=d(),w(Co.$$.fragment),nr=d(),Zt=s("ul"),ft=s("li"),js=s("a"),Tn=r("MobileViTForImageClassification"),yn=r(" is supported by this "),Io=s("a"),wn=r("example script"),Mn=r(" and "),jo=s("a"),$n=r("notebook"),Vn=r("."),En=d(),Us=s("li"),Fn=r("See also: "),xs=s("a"),kn=r("Image classification task guide"),ir=d(),Js=s("p"),ma=s("strong"),Cn=r("Semantic segmentation"),lr=d(),Ws=s("ul"),pa=s("li"),Zs=s("a"),In=r("Semantic segmentation task guide"),cr=d(),Ns=s("p"),jn=r("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),dr=d(),bt=s("h2"),Nt=s("a"),ha=s("span"),w(Uo.$$.fragment),Un=d(),fa=s("span"),xn=r("MobileViTConfig"),mr=d(),Le=s("div"),w(xo.$$.fragment),Jn=d(),_t=s("p"),Wn=r("This is the configuration class to store the configuration of a "),Ss=s("a"),Zn=r("MobileViTModel"),Nn=r(`. It is used to instantiate a
MobileViT 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 MobileViT
`),Jo=s("a"),Sn=r("apple/mobilevit-small"),Pn=r(" architecture."),zn=d(),vt=s("p"),Rn=r("Configuration objects inherit from "),Ps=s("a"),Gn=r("PretrainedConfig"),Bn=r(` and can be used to control the model outputs. Read the
documentation from `),zs=s("a"),An=r("PretrainedConfig"),Dn=r(" for more information."),Ln=d(),w(St.$$.fragment),pr=d(),Tt=s("h2"),Pt=s("a"),ua=s("span"),w(Wo.$$.fragment),Xn=d(),ga=s("span"),Yn=r("MobileViTFeatureExtractor"),hr=d(),pt=s("div"),w(Zo.$$.fragment),On=d(),zt=s("div"),w(No.$$.fragment),qn=d(),ba=s("p"),Hn=r("Preprocess an image or a batch of images."),Qn=d(),Rt=s("div"),w(So.$$.fragment),Kn=d(),Po=s("p"),ei=r("Converts the output of "),Rs=s("a"),ti=r("MobileViTForSemanticSegmentation"),oi=r(` into semantic segmentation maps. Only supports
PyTorch.`),fr=d(),yt=s("h2"),Gt=s("a"),_a=s("span"),w(zo.$$.fragment),si=d(),va=s("span"),ai=r("MobileViTImageProcessor"),ur=d(),Xe=s("div"),w(Ro.$$.fragment),ri=d(),Ta=s("p"),ni=r("Constructs a MobileViT image processor."),ii=d(),Bt=s("div"),w(Go.$$.fragment),li=d(),ya=s("p"),ci=r("Preprocess an image or batch of images."),di=d(),At=s("div"),w(Bo.$$.fragment),mi=d(),Ao=s("p"),pi=r("Converts the output of "),Gs=s("a"),hi=r("MobileViTForSemanticSegmentation"),fi=r(` into semantic segmentation maps. Only supports
PyTorch.`),gr=d(),wt=s("h2"),Dt=s("a"),wa=s("span"),w(Do.$$.fragment),ui=d(),Ma=s("span"),gi=r("MobileViTModel"),br=d(),ht=s("div"),w(Lo.$$.fragment),bi=d(),Xo=s("p"),_i=r(`The bare MobileViT model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Yo=s("a"),vi=r("torch.nn.Module"),Ti=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yi=d(),st=s("div"),w(Oo.$$.fragment),wi=d(),Mt=s("p"),Mi=r("The "),Bs=s("a"),$i=r("MobileViTModel"),Vi=r(" forward method, overrides the "),$a=s("code"),Ei=r("__call__"),Fi=r(" special method."),ki=d(),w(Lt.$$.fragment),Ci=d(),w(Xt.$$.fragment),_r=d(),$t=s("h2"),Yt=s("a"),Va=s("span"),w(qo.$$.fragment),Ii=d(),Ea=s("span"),ji=r("MobileViTForImageClassification"),vr=d(),Ye=s("div"),w(Ho.$$.fragment),Ui=d(),Fa=s("p"),xi=r(`MobileViT model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),Ji=d(),Qo=s("p"),Wi=r("This model is a PyTorch "),Ko=s("a"),Zi=r("torch.nn.Module"),Ni=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Si=d(),at=s("div"),w(es.$$.fragment),Pi=d(),Vt=s("p"),zi=r("The "),As=s("a"),Ri=r("MobileViTForImageClassification"),Gi=r(" forward method, overrides the "),ka=s("code"),Bi=r("__call__"),Ai=r(" special method."),Di=d(),w(Ot.$$.fragment),Li=d(),w(qt.$$.fragment),Tr=d(),Et=s("h2"),Ht=s("a"),Ca=s("span"),w(ts.$$.fragment),Xi=d(),Ia=s("span"),Yi=r("MobileViTForSemanticSegmentation"),yr=d(),Oe=s("div"),w(os.$$.fragment),Oi=d(),ja=s("p"),qi=r("MobileViT model with a semantic segmentation head on top, e.g. for Pascal VOC."),Hi=d(),ss=s("p"),Qi=r("This model is a PyTorch "),as=s("a"),Ki=r("torch.nn.Module"),el=r(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),tl=d(),rt=s("div"),w(rs.$$.fragment),ol=d(),Ft=s("p"),sl=r("The "),Ds=s("a"),al=r("MobileViTForSemanticSegmentation"),rl=r(" forward method, overrides the "),Ua=s("code"),nl=r("__call__"),il=r(" special method."),ll=d(),w(Qt.$$.fragment),cl=d(),w(Kt.$$.fragment),wr=d(),kt=s("h2"),eo=s("a"),xa=s("span"),w(ns.$$.fragment),dl=d(),Ja=s("span"),ml=r("TFMobileViTModel"),Mr=d(),Ge=s("div"),w(is.$$.fragment),pl=d(),ls=s("p"),hl=r(`The bare MobileViT model outputting raw hidden-states without any specific head on top.
This model inherits from `),Ls=s("a"),fl=r("TFPreTrainedModel"),ul=r(`. 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.)`),gl=d(),cs=s("p"),bl=r("This model is also a "),ds=s("a"),_l=r("tf.keras.Model"),vl=r(` 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.`),Tl=d(),w(to.$$.fragment),yl=d(),nt=s("div"),w(ms.$$.fragment),wl=d(),Ct=s("p"),Ml=r("The "),Xs=s("a"),$l=r("TFMobileViTModel"),Vl=r(" forward method, overrides the "),Wa=s("code"),El=r("__call__"),Fl=r(" special method."),kl=d(),w(oo.$$.fragment),Cl=d(),w(so.$$.fragment),$r=d(),It=s("h2"),ao=s("a"),Za=s("span"),w(ps.$$.fragment),Il=d(),Na=s("span"),jl=r("TFMobileViTForImageClassification"),Vr=d(),ue=s("div"),w(hs.$$.fragment),Ul=d(),Sa=s("p"),xl=r(`MobileViT model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),Jl=d(),fs=s("p"),Wl=r("This model inherits from "),Ys=s("a"),Zl=r("TFPreTrainedModel"),Nl=r(`. 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.)`),Sl=d(),us=s("p"),Pl=r("This model is also a "),gs=s("a"),zl=r("tf.keras.Model"),Rl=r(` 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.`),Gl=d(),w(ro.$$.fragment),Bl=d(),it=s("div"),w(bs.$$.fragment),Al=d(),jt=s("p"),Dl=r("The "),Os=s("a"),Ll=r("TFMobileViTForImageClassification"),Xl=r(" forward method, overrides the "),Pa=s("code"),Yl=r("__call__"),Ol=r(" special method."),ql=d(),w(no.$$.fragment),Hl=d(),w(io.$$.fragment),Er=d(),Ut=s("h2"),lo=s("a"),za=s("span"),w(_s.$$.fragment),Ql=d(),Ra=s("span"),Kl=r("TFMobileViTForSemanticSegmentation"),Fr=d(),ge=s("div"),w(vs.$$.fragment),ec=d(),Ga=s("p"),tc=r("MobileViT model with a semantic segmentation head on top, e.g. for Pascal VOC."),oc=d(),Ts=s("p"),sc=r("This model inherits from "),qs=s("a"),ac=r("TFPreTrainedModel"),rc=r(`. 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.)`),nc=d(),ys=s("p"),ic=r("This model is also a "),ws=s("a"),lc=r("tf.keras.Model"),cc=r(` 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.`),dc=d(),w(co.$$.fragment),mc=d(),lt=s("div"),w(Ms.$$.fragment),pc=d(),xt=s("p"),hc=r("The "),Hs=s("a"),fc=r("TFMobileViTForSemanticSegmentation"),uc=r(" forward method, overrides the "),Ba=s("code"),gc=r("__call__"),bc=r(" special method."),_c=d(),w(mo.$$.fragment),vc=d(),w(po.$$.fragment),this.h()},l(o){const u=rm('[data-svelte="svelte-1phssyn"]',document.head);c=a(u,"META",{name:!0,content:!0}),u.forEach(t),T=m(o),b=a(o,"H1",{class:!0});var $s=i(b);g=a($s,"A",{id:!0,class:!0,href:!0});var Aa=i(g);v=a(Aa,"SPAN",{});var Da=i(v);M(l.$$.fragment,Da),Da.forEach(t),Aa.forEach(t),h=m($s),I=a($s,"SPAN",{});var La=i(I);ke=n(La,"MobileViT"),La.forEach(t),$s.forEach(t),be=m(o),N=a(o,"H2",{class:!0});var Vs=i(N);ee=a(Vs,"A",{id:!0,class:!0,href:!0});var Xa=i(ee);te=a(Xa,"SPAN",{});var Ya=i(te);M(y.$$.fragment,Ya),Ya.forEach(t),Xa.forEach(t),Ce=m(Vs),L=a(Vs,"SPAN",{});var Oa=i(L);Ie=n(Oa,"Overview"),Oa.forEach(t),Vs.forEach(t),_e=m(o),P=a(o,"P",{});var Es=i(P);je=n(Es,"The MobileViT model was proposed in "),oe=a(Es,"A",{href:!0,rel:!0});var qa=i(oe);O=n(qa,"MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer"),qa.forEach(t),Ue=n(Es," by Sachin Mehta and Mohammad Rastegari. MobileViT introduces a new layer that replaces local processing in convolutions with global processing using transformers."),Es.forEach(t),ve=m(o),R=a(o,"P",{});var Ha=i(R);xe=n(Ha,"The abstract from the paper is the following:"),Ha.forEach(t),Te=m(o),G=a(o,"P",{});var Qa=i(G);de=a(Qa,"EM",{});var Ka=i(de);Je=n(Ka,"Light-weight convolutional neural networks (CNNs) are the de-facto for mobile vision tasks. Their spatial inductive biases allow them to learn representations with fewer parameters across different vision tasks. However, these networks are spatially local. To learn global representations, self-attention-based vision trans-formers (ViTs) have been adopted. Unlike CNNs, ViTs are heavy-weight. In this paper, we ask the following question: is it possible to combine the strengths of CNNs and ViTs to build a light-weight and low latency network for mobile vision tasks? Towards this end, we introduce MobileViT, a light-weight and general-purpose vision transformer for mobile devices. MobileViT presents a different perspective for the global processing of information with transformers, i.e., transformers as convolutions. Our results show that MobileViT significantly outperforms CNN- and ViT-based networks across different tasks and datasets. On the ImageNet-1k dataset, MobileViT achieves top-1 accuracy of 78.4% with about 6 million parameters, which is 3.2% and 6.2% more accurate than MobileNetv3 (CNN-based) and DeIT (ViT-based) for a similar number of parameters. On the MS-COCO object detection task, MobileViT is 5.7% more accurate than MobileNetv3 for a similar number of parameters."),Ka.forEach(t),Qa.forEach(t),se=m(o),j=a(o,"P",{});var er=i(j);J=n(er,"Tips:"),er.forEach(t),ye=m(o),x=a(o,"UL",{});var qe=i(x);me=a(qe,"LI",{});var tr=i(me);ae=a(tr,"P",{});var Cr=i(ae);q=n(Cr,"MobileViT is more like a CNN than a Transformer model. It does not work on sequence data but on batches of images. Unlike ViT, there are no embeddings. The backbone model outputs a feature map. You can follow "),re=a(Cr,"A",{href:!0,rel:!0});var yc=i(re);We=n(yc,"this tutorial"),yc.forEach(t),W=n(Cr," for a lightweight introduction."),Cr.forEach(t),tr.forEach(t),Ze=m(qe),X=a(qe,"LI",{});var wc=i(X);ne=a(wc,"P",{});var Ir=i(ne);Ne=n(Ir,"One can use "),B=a(Ir,"A",{href:!0});var Mc=i(B);Se=n(Mc,"MobileViTImageProcessor"),Mc.forEach(t),Pe=n(Ir," to prepare images for the model. Note that if you do your own preprocessing, the pretrained checkpoints expect images to be in BGR pixel order (not RGB)."),Ir.forEach(t),wc.forEach(t),A=m(qe),pe=a(qe,"LI",{});var $c=i(pe);z=a($c,"P",{});var jr=i(z);ze=n(jr,"The available image classification checkpoints are pre-trained on "),Y=a(jr,"A",{href:!0,rel:!0});var Vc=i(Y);Z=n(Vc,"ImageNet-1k"),Vc.forEach(t),Re=n(jr," (also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes)."),jr.forEach(t),$c.forEach(t),S=m(qe),he=a(qe,"LI",{});var Ec=i(he);H=a(Ec,"P",{});var Qs=i(H);_=n(Qs,"The segmentation model uses a "),k=a(Qs,"A",{href:!0,rel:!0});var Fc=i(k);He=n(Fc,"DeepLabV3"),Fc.forEach(t),le=n(Qs," head. The available semantic segmentation checkpoints are pre-trained on "),we=a(Qs,"A",{href:!0,rel:!0});var kc=i(we);Qe=n(kc,"PASCAL VOC"),kc.forEach(t),C=n(Qs,"."),Qs.forEach(t),Ec.forEach(t),Ke=m(qe),Me=a(qe,"LI",{});var Ur=i(Me);$e=a(Ur,"P",{});var xr=i($e);et=n(xr,"As the name suggests MobileViT was designed to be performant and efficient on mobile phones. The TensorFlow versions of the MobileViT models are fully compatible with "),Ve=a(xr,"A",{href:!0,rel:!0});var Cc=i(Ve);D=n(Cc,"TensorFlow Lite"),Cc.forEach(t),Q=n(xr,"."),xr.forEach(t),tt=m(Ur),Be=a(Ur,"P",{});var Ic=i(Be);K=n(Ic,`You can use the following code to convert a MobileViT checkpoint (be it image classification or semantic segmentation) to generate a
TensorFlow Lite model:`),Ic.forEach(t),Ur.forEach(t),qe.forEach(t),De=m(o),M(Ee.$$.fragment,o),Fe=m(o),fe=a(o,"P",{});var Jr=i(fe);ce=n(Jr,"The resulting model will be just "),Ae=a(Jr,"STRONG",{});var jc=i(Ae);ln=n(jc,"about an MB"),jc.forEach(t),cn=n(Jr,` making it a good fit for mobile applications where resources and network
bandwidth can be constrained.`),Jr.forEach(t),or=m(o),ot=a(o,"P",{});var ho=i(ot);dn=n(ho,"This model was contributed by "),Vo=a(ho,"A",{href:!0,rel:!0});var Uc=i(Vo);mn=n(Uc,"matthijs"),Uc.forEach(t),pn=n(ho,". The TensorFlow version of the model was contributed by "),Eo=a(ho,"A",{href:!0,rel:!0});var xc=i(Eo);hn=n(xc,"sayakpaul"),xc.forEach(t),fn=n(ho,". The original code and weights can be found "),Fo=a(ho,"A",{href:!0,rel:!0});var Jc=i(Fo);un=n(Jc,"here"),Jc.forEach(t),gn=n(ho,"."),ho.forEach(t),sr=m(o),gt=a(o,"H2",{class:!0});var Wr=i(gt);Wt=a(Wr,"A",{id:!0,class:!0,href:!0});var Wc=i(Wt);ca=a(Wc,"SPAN",{});var Zc=i(ca);M(ko.$$.fragment,Zc),Zc.forEach(t),Wc.forEach(t),bn=m(Wr),da=a(Wr,"SPAN",{});var Nc=i(da);_n=n(Nc,"Resources"),Nc.forEach(t),Wr.forEach(t),ar=m(o),Is=a(o,"P",{});var Sc=i(Is);vn=n(Sc,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with MobileViT."),Sc.forEach(t),rr=m(o),M(Co.$$.fragment,o),nr=m(o),Zt=a(o,"UL",{});var Zr=i(Zt);ft=a(Zr,"LI",{});var Fs=i(ft);js=a(Fs,"A",{href:!0});var Pc=i(js);Tn=n(Pc,"MobileViTForImageClassification"),Pc.forEach(t),yn=n(Fs," is supported by this "),Io=a(Fs,"A",{href:!0,rel:!0});var zc=i(Io);wn=n(zc,"example script"),zc.forEach(t),Mn=n(Fs," and "),jo=a(Fs,"A",{href:!0,rel:!0});var Rc=i(jo);$n=n(Rc,"notebook"),Rc.forEach(t),Vn=n(Fs,"."),Fs.forEach(t),En=m(Zr),Us=a(Zr,"LI",{});var Tc=i(Us);Fn=n(Tc,"See also: "),xs=a(Tc,"A",{href:!0});var Gc=i(xs);kn=n(Gc,"Image classification task guide"),Gc.forEach(t),Tc.forEach(t),Zr.forEach(t),ir=m(o),Js=a(o,"P",{});var Bc=i(Js);ma=a(Bc,"STRONG",{});var Ac=i(ma);Cn=n(Ac,"Semantic segmentation"),Ac.forEach(t),Bc.forEach(t),lr=m(o),Ws=a(o,"UL",{});var Dc=i(Ws);pa=a(Dc,"LI",{});var Lc=i(pa);Zs=a(Lc,"A",{href:!0});var Xc=i(Zs);In=n(Xc,"Semantic segmentation task guide"),Xc.forEach(t),Lc.forEach(t),Dc.forEach(t),cr=m(o),Ns=a(o,"P",{});var Yc=i(Ns);jn=n(Yc,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Yc.forEach(t),dr=m(o),bt=a(o,"H2",{class:!0});var Nr=i(bt);Nt=a(Nr,"A",{id:!0,class:!0,href:!0});var Oc=i(Nt);ha=a(Oc,"SPAN",{});var qc=i(ha);M(Uo.$$.fragment,qc),qc.forEach(t),Oc.forEach(t),Un=m(Nr),fa=a(Nr,"SPAN",{});var Hc=i(fa);xn=n(Hc,"MobileViTConfig"),Hc.forEach(t),Nr.forEach(t),mr=m(o),Le=a(o,"DIV",{class:!0});var fo=i(Le);M(xo.$$.fragment,fo),Jn=m(fo),_t=a(fo,"P",{});var Ks=i(_t);Wn=n(Ks,"This is the configuration class to store the configuration of a "),Ss=a(Ks,"A",{href:!0});var Qc=i(Ss);Zn=n(Qc,"MobileViTModel"),Qc.forEach(t),Nn=n(Ks,`. It is used to instantiate a
MobileViT 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 MobileViT
`),Jo=a(Ks,"A",{href:!0,rel:!0});var Kc=i(Jo);Sn=n(Kc,"apple/mobilevit-small"),Kc.forEach(t),Pn=n(Ks," architecture."),Ks.forEach(t),zn=m(fo),vt=a(fo,"P",{});var ea=i(vt);Rn=n(ea,"Configuration objects inherit from "),Ps=a(ea,"A",{href:!0});var ed=i(Ps);Gn=n(ed,"PretrainedConfig"),ed.forEach(t),Bn=n(ea,` and can be used to control the model outputs. Read the
documentation from `),zs=a(ea,"A",{href:!0});var td=i(zs);An=n(td,"PretrainedConfig"),td.forEach(t),Dn=n(ea," for more information."),ea.forEach(t),Ln=m(fo),M(St.$$.fragment,fo),fo.forEach(t),pr=m(o),Tt=a(o,"H2",{class:!0});var Sr=i(Tt);Pt=a(Sr,"A",{id:!0,class:!0,href:!0});var od=i(Pt);ua=a(od,"SPAN",{});var sd=i(ua);M(Wo.$$.fragment,sd),sd.forEach(t),od.forEach(t),Xn=m(Sr),ga=a(Sr,"SPAN",{});var ad=i(ga);Yn=n(ad,"MobileViTFeatureExtractor"),ad.forEach(t),Sr.forEach(t),hr=m(o),pt=a(o,"DIV",{class:!0});var ta=i(pt);M(Zo.$$.fragment,ta),On=m(ta),zt=a(ta,"DIV",{class:!0});var Pr=i(zt);M(No.$$.fragment,Pr),qn=m(Pr),ba=a(Pr,"P",{});var rd=i(ba);Hn=n(rd,"Preprocess an image or a batch of images."),rd.forEach(t),Pr.forEach(t),Qn=m(ta),Rt=a(ta,"DIV",{class:!0});var zr=i(Rt);M(So.$$.fragment,zr),Kn=m(zr),Po=a(zr,"P",{});var Rr=i(Po);ei=n(Rr,"Converts the output of "),Rs=a(Rr,"A",{href:!0});var nd=i(Rs);ti=n(nd,"MobileViTForSemanticSegmentation"),nd.forEach(t),oi=n(Rr,` into semantic segmentation maps. Only supports
PyTorch.`),Rr.forEach(t),zr.forEach(t),ta.forEach(t),fr=m(o),yt=a(o,"H2",{class:!0});var Gr=i(yt);Gt=a(Gr,"A",{id:!0,class:!0,href:!0});var id=i(Gt);_a=a(id,"SPAN",{});var ld=i(_a);M(zo.$$.fragment,ld),ld.forEach(t),id.forEach(t),si=m(Gr),va=a(Gr,"SPAN",{});var cd=i(va);ai=n(cd,"MobileViTImageProcessor"),cd.forEach(t),Gr.forEach(t),ur=m(o),Xe=a(o,"DIV",{class:!0});var uo=i(Xe);M(Ro.$$.fragment,uo),ri=m(uo),Ta=a(uo,"P",{});var dd=i(Ta);ni=n(dd,"Constructs a MobileViT image processor."),dd.forEach(t),ii=m(uo),Bt=a(uo,"DIV",{class:!0});var Br=i(Bt);M(Go.$$.fragment,Br),li=m(Br),ya=a(Br,"P",{});var md=i(ya);ci=n(md,"Preprocess an image or batch of images."),md.forEach(t),Br.forEach(t),di=m(uo),At=a(uo,"DIV",{class:!0});var Ar=i(At);M(Bo.$$.fragment,Ar),mi=m(Ar),Ao=a(Ar,"P",{});var Dr=i(Ao);pi=n(Dr,"Converts the output of "),Gs=a(Dr,"A",{href:!0});var pd=i(Gs);hi=n(pd,"MobileViTForSemanticSegmentation"),pd.forEach(t),fi=n(Dr,` into semantic segmentation maps. Only supports
PyTorch.`),Dr.forEach(t),Ar.forEach(t),uo.forEach(t),gr=m(o),wt=a(o,"H2",{class:!0});var Lr=i(wt);Dt=a(Lr,"A",{id:!0,class:!0,href:!0});var hd=i(Dt);wa=a(hd,"SPAN",{});var fd=i(wa);M(Do.$$.fragment,fd),fd.forEach(t),hd.forEach(t),ui=m(Lr),Ma=a(Lr,"SPAN",{});var ud=i(Ma);gi=n(ud,"MobileViTModel"),ud.forEach(t),Lr.forEach(t),br=m(o),ht=a(o,"DIV",{class:!0});var oa=i(ht);M(Lo.$$.fragment,oa),bi=m(oa),Xo=a(oa,"P",{});var Xr=i(Xo);_i=n(Xr,`The bare MobileViT model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Yo=a(Xr,"A",{href:!0,rel:!0});var gd=i(Yo);vi=n(gd,"torch.nn.Module"),gd.forEach(t),Ti=n(Xr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xr.forEach(t),yi=m(oa),st=a(oa,"DIV",{class:!0});var go=i(st);M(Oo.$$.fragment,go),wi=m(go),Mt=a(go,"P",{});var sa=i(Mt);Mi=n(sa,"The "),Bs=a(sa,"A",{href:!0});var bd=i(Bs);$i=n(bd,"MobileViTModel"),bd.forEach(t),Vi=n(sa," forward method, overrides the "),$a=a(sa,"CODE",{});var _d=i($a);Ei=n(_d,"__call__"),_d.forEach(t),Fi=n(sa," special method."),sa.forEach(t),ki=m(go),M(Lt.$$.fragment,go),Ci=m(go),M(Xt.$$.fragment,go),go.forEach(t),oa.forEach(t),_r=m(o),$t=a(o,"H2",{class:!0});var Yr=i($t);Yt=a(Yr,"A",{id:!0,class:!0,href:!0});var vd=i(Yt);Va=a(vd,"SPAN",{});var Td=i(Va);M(qo.$$.fragment,Td),Td.forEach(t),vd.forEach(t),Ii=m(Yr),Ea=a(Yr,"SPAN",{});var yd=i(Ea);ji=n(yd,"MobileViTForImageClassification"),yd.forEach(t),Yr.forEach(t),vr=m(o),Ye=a(o,"DIV",{class:!0});var bo=i(Ye);M(Ho.$$.fragment,bo),Ui=m(bo),Fa=a(bo,"P",{});var wd=i(Fa);xi=n(wd,`MobileViT model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),wd.forEach(t),Ji=m(bo),Qo=a(bo,"P",{});var Or=i(Qo);Wi=n(Or,"This model is a PyTorch "),Ko=a(Or,"A",{href:!0,rel:!0});var Md=i(Ko);Zi=n(Md,"torch.nn.Module"),Md.forEach(t),Ni=n(Or,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Or.forEach(t),Si=m(bo),at=a(bo,"DIV",{class:!0});var _o=i(at);M(es.$$.fragment,_o),Pi=m(_o),Vt=a(_o,"P",{});var aa=i(Vt);zi=n(aa,"The "),As=a(aa,"A",{href:!0});var $d=i(As);Ri=n($d,"MobileViTForImageClassification"),$d.forEach(t),Gi=n(aa," forward method, overrides the "),ka=a(aa,"CODE",{});var Vd=i(ka);Bi=n(Vd,"__call__"),Vd.forEach(t),Ai=n(aa," special method."),aa.forEach(t),Di=m(_o),M(Ot.$$.fragment,_o),Li=m(_o),M(qt.$$.fragment,_o),_o.forEach(t),bo.forEach(t),Tr=m(o),Et=a(o,"H2",{class:!0});var qr=i(Et);Ht=a(qr,"A",{id:!0,class:!0,href:!0});var Ed=i(Ht);Ca=a(Ed,"SPAN",{});var Fd=i(Ca);M(ts.$$.fragment,Fd),Fd.forEach(t),Ed.forEach(t),Xi=m(qr),Ia=a(qr,"SPAN",{});var kd=i(Ia);Yi=n(kd,"MobileViTForSemanticSegmentation"),kd.forEach(t),qr.forEach(t),yr=m(o),Oe=a(o,"DIV",{class:!0});var vo=i(Oe);M(os.$$.fragment,vo),Oi=m(vo),ja=a(vo,"P",{});var Cd=i(ja);qi=n(Cd,"MobileViT model with a semantic segmentation head on top, e.g. for Pascal VOC."),Cd.forEach(t),Hi=m(vo),ss=a(vo,"P",{});var Hr=i(ss);Qi=n(Hr,"This model is a PyTorch "),as=a(Hr,"A",{href:!0,rel:!0});var Id=i(as);Ki=n(Id,"torch.nn.Module"),Id.forEach(t),el=n(Hr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Hr.forEach(t),tl=m(vo),rt=a(vo,"DIV",{class:!0});var To=i(rt);M(rs.$$.fragment,To),ol=m(To),Ft=a(To,"P",{});var ra=i(Ft);sl=n(ra,"The "),Ds=a(ra,"A",{href:!0});var jd=i(Ds);al=n(jd,"MobileViTForSemanticSegmentation"),jd.forEach(t),rl=n(ra," forward method, overrides the "),Ua=a(ra,"CODE",{});var Ud=i(Ua);nl=n(Ud,"__call__"),Ud.forEach(t),il=n(ra," special method."),ra.forEach(t),ll=m(To),M(Qt.$$.fragment,To),cl=m(To),M(Kt.$$.fragment,To),To.forEach(t),vo.forEach(t),wr=m(o),kt=a(o,"H2",{class:!0});var Qr=i(kt);eo=a(Qr,"A",{id:!0,class:!0,href:!0});var xd=i(eo);xa=a(xd,"SPAN",{});var Jd=i(xa);M(ns.$$.fragment,Jd),Jd.forEach(t),xd.forEach(t),dl=m(Qr),Ja=a(Qr,"SPAN",{});var Wd=i(Ja);ml=n(Wd,"TFMobileViTModel"),Wd.forEach(t),Qr.forEach(t),Mr=m(o),Ge=a(o,"DIV",{class:!0});var ut=i(Ge);M(is.$$.fragment,ut),pl=m(ut),ls=a(ut,"P",{});var Kr=i(ls);hl=n(Kr,`The bare MobileViT model outputting raw hidden-states without any specific head on top.
This model inherits from `),Ls=a(Kr,"A",{href:!0});var Zd=i(Ls);fl=n(Zd,"TFPreTrainedModel"),Zd.forEach(t),ul=n(Kr,`. 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.)`),Kr.forEach(t),gl=m(ut),cs=a(ut,"P",{});var en=i(cs);bl=n(en,"This model is also a "),ds=a(en,"A",{href:!0,rel:!0});var Nd=i(ds);_l=n(Nd,"tf.keras.Model"),Nd.forEach(t),vl=n(en,` 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.`),en.forEach(t),Tl=m(ut),M(to.$$.fragment,ut),yl=m(ut),nt=a(ut,"DIV",{class:!0});var yo=i(nt);M(ms.$$.fragment,yo),wl=m(yo),Ct=a(yo,"P",{});var na=i(Ct);Ml=n(na,"The "),Xs=a(na,"A",{href:!0});var Sd=i(Xs);$l=n(Sd,"TFMobileViTModel"),Sd.forEach(t),Vl=n(na," forward method, overrides the "),Wa=a(na,"CODE",{});var Pd=i(Wa);El=n(Pd,"__call__"),Pd.forEach(t),Fl=n(na," special method."),na.forEach(t),kl=m(yo),M(oo.$$.fragment,yo),Cl=m(yo),M(so.$$.fragment,yo),yo.forEach(t),ut.forEach(t),$r=m(o),It=a(o,"H2",{class:!0});var tn=i(It);ao=a(tn,"A",{id:!0,class:!0,href:!0});var zd=i(ao);Za=a(zd,"SPAN",{});var Rd=i(Za);M(ps.$$.fragment,Rd),Rd.forEach(t),zd.forEach(t),Il=m(tn),Na=a(tn,"SPAN",{});var Gd=i(Na);jl=n(Gd,"TFMobileViTForImageClassification"),Gd.forEach(t),tn.forEach(t),Vr=m(o),ue=a(o,"DIV",{class:!0});var ct=i(ue);M(hs.$$.fragment,ct),Ul=m(ct),Sa=a(ct,"P",{});var Bd=i(Sa);xl=n(Bd,`MobileViT model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),Bd.forEach(t),Jl=m(ct),fs=a(ct,"P",{});var on=i(fs);Wl=n(on,"This model inherits from "),Ys=a(on,"A",{href:!0});var Ad=i(Ys);Zl=n(Ad,"TFPreTrainedModel"),Ad.forEach(t),Nl=n(on,`. 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.)`),on.forEach(t),Sl=m(ct),us=a(ct,"P",{});var sn=i(us);Pl=n(sn,"This model is also a "),gs=a(sn,"A",{href:!0,rel:!0});var Dd=i(gs);zl=n(Dd,"tf.keras.Model"),Dd.forEach(t),Rl=n(sn,` 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.`),sn.forEach(t),Gl=m(ct),M(ro.$$.fragment,ct),Bl=m(ct),it=a(ct,"DIV",{class:!0});var wo=i(it);M(bs.$$.fragment,wo),Al=m(wo),jt=a(wo,"P",{});var ia=i(jt);Dl=n(ia,"The "),Os=a(ia,"A",{href:!0});var Ld=i(Os);Ll=n(Ld,"TFMobileViTForImageClassification"),Ld.forEach(t),Xl=n(ia," forward method, overrides the "),Pa=a(ia,"CODE",{});var Xd=i(Pa);Yl=n(Xd,"__call__"),Xd.forEach(t),Ol=n(ia," special method."),ia.forEach(t),ql=m(wo),M(no.$$.fragment,wo),Hl=m(wo),M(io.$$.fragment,wo),wo.forEach(t),ct.forEach(t),Er=m(o),Ut=a(o,"H2",{class:!0});var an=i(Ut);lo=a(an,"A",{id:!0,class:!0,href:!0});var Yd=i(lo);za=a(Yd,"SPAN",{});var Od=i(za);M(_s.$$.fragment,Od),Od.forEach(t),Yd.forEach(t),Ql=m(an),Ra=a(an,"SPAN",{});var qd=i(Ra);Kl=n(qd,"TFMobileViTForSemanticSegmentation"),qd.forEach(t),an.forEach(t),Fr=m(o),ge=a(o,"DIV",{class:!0});var dt=i(ge);M(vs.$$.fragment,dt),ec=m(dt),Ga=a(dt,"P",{});var Hd=i(Ga);tc=n(Hd,"MobileViT model with a semantic segmentation head on top, e.g. for Pascal VOC."),Hd.forEach(t),oc=m(dt),Ts=a(dt,"P",{});var rn=i(Ts);sc=n(rn,"This model inherits from "),qs=a(rn,"A",{href:!0});var Qd=i(qs);ac=n(Qd,"TFPreTrainedModel"),Qd.forEach(t),rc=n(rn,`. 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.)`),rn.forEach(t),nc=m(dt),ys=a(dt,"P",{});var nn=i(ys);ic=n(nn,"This model is also a "),ws=a(nn,"A",{href:!0,rel:!0});var Kd=i(ws);lc=n(Kd,"tf.keras.Model"),Kd.forEach(t),cc=n(nn,` 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.`),nn.forEach(t),dc=m(dt),M(co.$$.fragment,dt),mc=m(dt),lt=a(dt,"DIV",{class:!0});var Mo=i(lt);M(Ms.$$.fragment,Mo),pc=m(Mo),xt=a(Mo,"P",{});var la=i(xt);hc=n(la,"The "),Hs=a(la,"A",{href:!0});var em=i(Hs);fc=n(em,"TFMobileViTForSemanticSegmentation"),em.forEach(t),uc=n(la," forward method, overrides the "),Ba=a(la,"CODE",{});var tm=i(Ba);gc=n(tm,"__call__"),tm.forEach(t),bc=n(la," special method."),la.forEach(t),_c=m(Mo),M(mo.$$.fragment,Mo),vc=m(Mo),M(po.$$.fragment,Mo),Mo.forEach(t),dt.forEach(t),this.h()},h(){p(c,"name","hf:doc:metadata"),p(c,"content",JSON.stringify(Vm)),p(g,"id","mobilevit"),p(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(g,"href","#mobilevit"),p(b,"class","relative group"),p(ee,"id","overview"),p(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ee,"href","#overview"),p(N,"class","relative group"),p(oe,"href","https://arxiv.org/abs/2110.02178"),p(oe,"rel","nofollow"),p(re,"href","https://keras.io/examples/vision/mobilevit"),p(re,"rel","nofollow"),p(B,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTImageProcessor"),p(Y,"href","https://huggingface.co/datasets/imagenet-1k"),p(Y,"rel","nofollow"),p(k,"href","https://arxiv.org/abs/1706.05587"),p(k,"rel","nofollow"),p(we,"href","http://host.robots.ox.ac.uk/pascal/VOC/"),p(we,"rel","nofollow"),p(Ve,"href","https://www.tensorflow.org/lite"),p(Ve,"rel","nofollow"),p(Vo,"href","https://huggingface.co/Matthijs"),p(Vo,"rel","nofollow"),p(Eo,"href","https://huggingface.co/sayakpaul"),p(Eo,"rel","nofollow"),p(Fo,"href","https://github.com/apple/ml-cvnets"),p(Fo,"rel","nofollow"),p(Wt,"id","resources"),p(Wt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Wt,"href","#resources"),p(gt,"class","relative group"),p(js,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForImageClassification"),p(Io,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),p(Io,"rel","nofollow"),p(jo,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),p(jo,"rel","nofollow"),p(xs,"href","../tasks/image_classification"),p(Zs,"href","../tasks/semantic_segmentation"),p(Nt,"id","transformers.MobileViTConfig"),p(Nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Nt,"href","#transformers.MobileViTConfig"),p(bt,"class","relative group"),p(Ss,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTModel"),p(Jo,"href","https://huggingface.co/apple/mobilevit-small"),p(Jo,"rel","nofollow"),p(Ps,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(zs,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Pt,"id","transformers.MobileViTFeatureExtractor"),p(Pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Pt,"href","#transformers.MobileViTFeatureExtractor"),p(Tt,"class","relative group"),p(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Rs,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForSemanticSegmentation"),p(Rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Gt,"id","transformers.MobileViTImageProcessor"),p(Gt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Gt,"href","#transformers.MobileViTImageProcessor"),p(yt,"class","relative group"),p(Bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Gs,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForSemanticSegmentation"),p(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Dt,"id","transformers.MobileViTModel"),p(Dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Dt,"href","#transformers.MobileViTModel"),p(wt,"class","relative group"),p(Yo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Yo,"rel","nofollow"),p(Bs,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTModel"),p(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Yt,"id","transformers.MobileViTForImageClassification"),p(Yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Yt,"href","#transformers.MobileViTForImageClassification"),p($t,"class","relative group"),p(Ko,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Ko,"rel","nofollow"),p(As,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForImageClassification"),p(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ht,"id","transformers.MobileViTForSemanticSegmentation"),p(Ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ht,"href","#transformers.MobileViTForSemanticSegmentation"),p(Et,"class","relative group"),p(as,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(as,"rel","nofollow"),p(Ds,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.MobileViTForSemanticSegmentation"),p(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(eo,"id","transformers.TFMobileViTModel"),p(eo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(eo,"href","#transformers.TFMobileViTModel"),p(kt,"class","relative group"),p(Ls,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(ds,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(ds,"rel","nofollow"),p(Xs,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.TFMobileViTModel"),p(nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ao,"id","transformers.TFMobileViTForImageClassification"),p(ao,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ao,"href","#transformers.TFMobileViTForImageClassification"),p(It,"class","relative group"),p(Ys,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(gs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(gs,"rel","nofollow"),p(Os,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.TFMobileViTForImageClassification"),p(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(lo,"id","transformers.TFMobileViTForSemanticSegmentation"),p(lo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(lo,"href","#transformers.TFMobileViTForSemanticSegmentation"),p(Ut,"class","relative group"),p(qs,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),p(ws,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(ws,"rel","nofollow"),p(Hs,"href","/docs/transformers/v4.30.0/en/model_doc/mobilevit#transformers.TFMobileViTForSemanticSegmentation"),p(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,u){e(document.head,c),f(o,T,u),f(o,b,u),e(b,g),e(g,v),$(l,v,null),e(b,h),e(b,I),e(I,ke),f(o,be,u),f(o,N,u),e(N,ee),e(ee,te),$(y,te,null),e(N,Ce),e(N,L),e(L,Ie),f(o,_e,u),f(o,P,u),e(P,je),e(P,oe),e(oe,O),e(P,Ue),f(o,ve,u),f(o,R,u),e(R,xe),f(o,Te,u),f(o,G,u),e(G,de),e(de,Je),f(o,se,u),f(o,j,u),e(j,J),f(o,ye,u),f(o,x,u),e(x,me),e(me,ae),e(ae,q),e(ae,re),e(re,We),e(ae,W),e(x,Ze),e(x,X),e(X,ne),e(ne,Ne),e(ne,B),e(B,Se),e(ne,Pe),e(x,A),e(x,pe),e(pe,z),e(z,ze),e(z,Y),e(Y,Z),e(z,Re),e(x,S),e(x,he),e(he,H),e(H,_),e(H,k),e(k,He),e(H,le),e(H,we),e(we,Qe),e(H,C),e(x,Ke),e(x,Me),e(Me,$e),e($e,et),e($e,Ve),e(Ve,D),e($e,Q),e(Me,tt),e(Me,Be),e(Be,K),f(o,De,u),$(Ee,o,u),f(o,Fe,u),f(o,fe,u),e(fe,ce),e(fe,Ae),e(Ae,ln),e(fe,cn),f(o,or,u),f(o,ot,u),e(ot,dn),e(ot,Vo),e(Vo,mn),e(ot,pn),e(ot,Eo),e(Eo,hn),e(ot,fn),e(ot,Fo),e(Fo,un),e(ot,gn),f(o,sr,u),f(o,gt,u),e(gt,Wt),e(Wt,ca),$(ko,ca,null),e(gt,bn),e(gt,da),e(da,_n),f(o,ar,u),f(o,Is,u),e(Is,vn),f(o,rr,u),$(Co,o,u),f(o,nr,u),f(o,Zt,u),e(Zt,ft),e(ft,js),e(js,Tn),e(ft,yn),e(ft,Io),e(Io,wn),e(ft,Mn),e(ft,jo),e(jo,$n),e(ft,Vn),e(Zt,En),e(Zt,Us),e(Us,Fn),e(Us,xs),e(xs,kn),f(o,ir,u),f(o,Js,u),e(Js,ma),e(ma,Cn),f(o,lr,u),f(o,Ws,u),e(Ws,pa),e(pa,Zs),e(Zs,In),f(o,cr,u),f(o,Ns,u),e(Ns,jn),f(o,dr,u),f(o,bt,u),e(bt,Nt),e(Nt,ha),$(Uo,ha,null),e(bt,Un),e(bt,fa),e(fa,xn),f(o,mr,u),f(o,Le,u),$(xo,Le,null),e(Le,Jn),e(Le,_t),e(_t,Wn),e(_t,Ss),e(Ss,Zn),e(_t,Nn),e(_t,Jo),e(Jo,Sn),e(_t,Pn),e(Le,zn),e(Le,vt),e(vt,Rn),e(vt,Ps),e(Ps,Gn),e(vt,Bn),e(vt,zs),e(zs,An),e(vt,Dn),e(Le,Ln),$(St,Le,null),f(o,pr,u),f(o,Tt,u),e(Tt,Pt),e(Pt,ua),$(Wo,ua,null),e(Tt,Xn),e(Tt,ga),e(ga,Yn),f(o,hr,u),f(o,pt,u),$(Zo,pt,null),e(pt,On),e(pt,zt),$(No,zt,null),e(zt,qn),e(zt,ba),e(ba,Hn),e(pt,Qn),e(pt,Rt),$(So,Rt,null),e(Rt,Kn),e(Rt,Po),e(Po,ei),e(Po,Rs),e(Rs,ti),e(Po,oi),f(o,fr,u),f(o,yt,u),e(yt,Gt),e(Gt,_a),$(zo,_a,null),e(yt,si),e(yt,va),e(va,ai),f(o,ur,u),f(o,Xe,u),$(Ro,Xe,null),e(Xe,ri),e(Xe,Ta),e(Ta,ni),e(Xe,ii),e(Xe,Bt),$(Go,Bt,null),e(Bt,li),e(Bt,ya),e(ya,ci),e(Xe,di),e(Xe,At),$(Bo,At,null),e(At,mi),e(At,Ao),e(Ao,pi),e(Ao,Gs),e(Gs,hi),e(Ao,fi),f(o,gr,u),f(o,wt,u),e(wt,Dt),e(Dt,wa),$(Do,wa,null),e(wt,ui),e(wt,Ma),e(Ma,gi),f(o,br,u),f(o,ht,u),$(Lo,ht,null),e(ht,bi),e(ht,Xo),e(Xo,_i),e(Xo,Yo),e(Yo,vi),e(Xo,Ti),e(ht,yi),e(ht,st),$(Oo,st,null),e(st,wi),e(st,Mt),e(Mt,Mi),e(Mt,Bs),e(Bs,$i),e(Mt,Vi),e(Mt,$a),e($a,Ei),e(Mt,Fi),e(st,ki),$(Lt,st,null),e(st,Ci),$(Xt,st,null),f(o,_r,u),f(o,$t,u),e($t,Yt),e(Yt,Va),$(qo,Va,null),e($t,Ii),e($t,Ea),e(Ea,ji),f(o,vr,u),f(o,Ye,u),$(Ho,Ye,null),e(Ye,Ui),e(Ye,Fa),e(Fa,xi),e(Ye,Ji),e(Ye,Qo),e(Qo,Wi),e(Qo,Ko),e(Ko,Zi),e(Qo,Ni),e(Ye,Si),e(Ye,at),$(es,at,null),e(at,Pi),e(at,Vt),e(Vt,zi),e(Vt,As),e(As,Ri),e(Vt,Gi),e(Vt,ka),e(ka,Bi),e(Vt,Ai),e(at,Di),$(Ot,at,null),e(at,Li),$(qt,at,null),f(o,Tr,u),f(o,Et,u),e(Et,Ht),e(Ht,Ca),$(ts,Ca,null),e(Et,Xi),e(Et,Ia),e(Ia,Yi),f(o,yr,u),f(o,Oe,u),$(os,Oe,null),e(Oe,Oi),e(Oe,ja),e(ja,qi),e(Oe,Hi),e(Oe,ss),e(ss,Qi),e(ss,as),e(as,Ki),e(ss,el),e(Oe,tl),e(Oe,rt),$(rs,rt,null),e(rt,ol),e(rt,Ft),e(Ft,sl),e(Ft,Ds),e(Ds,al),e(Ft,rl),e(Ft,Ua),e(Ua,nl),e(Ft,il),e(rt,ll),$(Qt,rt,null),e(rt,cl),$(Kt,rt,null),f(o,wr,u),f(o,kt,u),e(kt,eo),e(eo,xa),$(ns,xa,null),e(kt,dl),e(kt,Ja),e(Ja,ml),f(o,Mr,u),f(o,Ge,u),$(is,Ge,null),e(Ge,pl),e(Ge,ls),e(ls,hl),e(ls,Ls),e(Ls,fl),e(ls,ul),e(Ge,gl),e(Ge,cs),e(cs,bl),e(cs,ds),e(ds,_l),e(cs,vl),e(Ge,Tl),$(to,Ge,null),e(Ge,yl),e(Ge,nt),$(ms,nt,null),e(nt,wl),e(nt,Ct),e(Ct,Ml),e(Ct,Xs),e(Xs,$l),e(Ct,Vl),e(Ct,Wa),e(Wa,El),e(Ct,Fl),e(nt,kl),$(oo,nt,null),e(nt,Cl),$(so,nt,null),f(o,$r,u),f(o,It,u),e(It,ao),e(ao,Za),$(ps,Za,null),e(It,Il),e(It,Na),e(Na,jl),f(o,Vr,u),f(o,ue,u),$(hs,ue,null),e(ue,Ul),e(ue,Sa),e(Sa,xl),e(ue,Jl),e(ue,fs),e(fs,Wl),e(fs,Ys),e(Ys,Zl),e(fs,Nl),e(ue,Sl),e(ue,us),e(us,Pl),e(us,gs),e(gs,zl),e(us,Rl),e(ue,Gl),$(ro,ue,null),e(ue,Bl),e(ue,it),$(bs,it,null),e(it,Al),e(it,jt),e(jt,Dl),e(jt,Os),e(Os,Ll),e(jt,Xl),e(jt,Pa),e(Pa,Yl),e(jt,Ol),e(it,ql),$(no,it,null),e(it,Hl),$(io,it,null),f(o,Er,u),f(o,Ut,u),e(Ut,lo),e(lo,za),$(_s,za,null),e(Ut,Ql),e(Ut,Ra),e(Ra,Kl),f(o,Fr,u),f(o,ge,u),$(vs,ge,null),e(ge,ec),e(ge,Ga),e(Ga,tc),e(ge,oc),e(ge,Ts),e(Ts,sc),e(Ts,qs),e(qs,ac),e(Ts,rc),e(ge,nc),e(ge,ys),e(ys,ic),e(ys,ws),e(ws,lc),e(ys,cc),e(ge,dc),$(co,ge,null),e(ge,mc),e(ge,lt),$(Ms,lt,null),e(lt,pc),e(lt,xt),e(xt,hc),e(xt,Hs),e(Hs,fc),e(xt,uc),e(xt,Ba),e(Ba,gc),e(xt,bc),e(lt,_c),$(mo,lt,null),e(lt,vc),$(po,lt,null),kr=!0},p(o,[u]){const $s={};u&2&&($s.$$scope={dirty:u,ctx:o}),St.$set($s);const Aa={};u&2&&(Aa.$$scope={dirty:u,ctx:o}),Lt.$set(Aa);const Da={};u&2&&(Da.$$scope={dirty:u,ctx:o}),Xt.$set(Da);const La={};u&2&&(La.$$scope={dirty:u,ctx:o}),Ot.$set(La);const Vs={};u&2&&(Vs.$$scope={dirty:u,ctx:o}),qt.$set(Vs);const Xa={};u&2&&(Xa.$$scope={dirty:u,ctx:o}),Qt.$set(Xa);const Ya={};u&2&&(Ya.$$scope={dirty:u,ctx:o}),Kt.$set(Ya);const Oa={};u&2&&(Oa.$$scope={dirty:u,ctx:o}),to.$set(Oa);const Es={};u&2&&(Es.$$scope={dirty:u,ctx:o}),oo.$set(Es);const qa={};u&2&&(qa.$$scope={dirty:u,ctx:o}),so.$set(qa);const Ha={};u&2&&(Ha.$$scope={dirty:u,ctx:o}),ro.$set(Ha);const Qa={};u&2&&(Qa.$$scope={dirty:u,ctx:o}),no.$set(Qa);const Ka={};u&2&&(Ka.$$scope={dirty:u,ctx:o}),io.$set(Ka);const er={};u&2&&(er.$$scope={dirty:u,ctx:o}),co.$set(er);const qe={};u&2&&(qe.$$scope={dirty:u,ctx:o}),mo.$set(qe);const tr={};u&2&&(tr.$$scope={dirty:u,ctx:o}),po.$set(tr)},i(o){kr||(V(l.$$.fragment,o),V(y.$$.fragment,o),V(Ee.$$.fragment,o),V(ko.$$.fragment,o),V(Co.$$.fragment,o),V(Uo.$$.fragment,o),V(xo.$$.fragment,o),V(St.$$.fragment,o),V(Wo.$$.fragment,o),V(Zo.$$.fragment,o),V(No.$$.fragment,o),V(So.$$.fragment,o),V(zo.$$.fragment,o),V(Ro.$$.fragment,o),V(Go.$$.fragment,o),V(Bo.$$.fragment,o),V(Do.$$.fragment,o),V(Lo.$$.fragment,o),V(Oo.$$.fragment,o),V(Lt.$$.fragment,o),V(Xt.$$.fragment,o),V(qo.$$.fragment,o),V(Ho.$$.fragment,o),V(es.$$.fragment,o),V(Ot.$$.fragment,o),V(qt.$$.fragment,o),V(ts.$$.fragment,o),V(os.$$.fragment,o),V(rs.$$.fragment,o),V(Qt.$$.fragment,o),V(Kt.$$.fragment,o),V(ns.$$.fragment,o),V(is.$$.fragment,o),V(to.$$.fragment,o),V(ms.$$.fragment,o),V(oo.$$.fragment,o),V(so.$$.fragment,o),V(ps.$$.fragment,o),V(hs.$$.fragment,o),V(ro.$$.fragment,o),V(bs.$$.fragment,o),V(no.$$.fragment,o),V(io.$$.fragment,o),V(_s.$$.fragment,o),V(vs.$$.fragment,o),V(co.$$.fragment,o),V(Ms.$$.fragment,o),V(mo.$$.fragment,o),V(po.$$.fragment,o),kr=!0)},o(o){E(l.$$.fragment,o),E(y.$$.fragment,o),E(Ee.$$.fragment,o),E(ko.$$.fragment,o),E(Co.$$.fragment,o),E(Uo.$$.fragment,o),E(xo.$$.fragment,o),E(St.$$.fragment,o),E(Wo.$$.fragment,o),E(Zo.$$.fragment,o),E(No.$$.fragment,o),E(So.$$.fragment,o),E(zo.$$.fragment,o),E(Ro.$$.fragment,o),E(Go.$$.fragment,o),E(Bo.$$.fragment,o),E(Do.$$.fragment,o),E(Lo.$$.fragment,o),E(Oo.$$.fragment,o),E(Lt.$$.fragment,o),E(Xt.$$.fragment,o),E(qo.$$.fragment,o),E(Ho.$$.fragment,o),E(es.$$.fragment,o),E(Ot.$$.fragment,o),E(qt.$$.fragment,o),E(ts.$$.fragment,o),E(os.$$.fragment,o),E(rs.$$.fragment,o),E(Qt.$$.fragment,o),E(Kt.$$.fragment,o),E(ns.$$.fragment,o),E(is.$$.fragment,o),E(to.$$.fragment,o),E(ms.$$.fragment,o),E(oo.$$.fragment,o),E(so.$$.fragment,o),E(ps.$$.fragment,o),E(hs.$$.fragment,o),E(ro.$$.fragment,o),E(bs.$$.fragment,o),E(no.$$.fragment,o),E(io.$$.fragment,o),E(_s.$$.fragment,o),E(vs.$$.fragment,o),E(co.$$.fragment,o),E(Ms.$$.fragment,o),E(mo.$$.fragment,o),E(po.$$.fragment,o),kr=!1},d(o){t(c),o&&t(T),o&&t(b),F(l),o&&t(be),o&&t(N),F(y),o&&t(_e),o&&t(P),o&&t(ve),o&&t(R),o&&t(Te),o&&t(G),o&&t(se),o&&t(j),o&&t(ye),o&&t(x),o&&t(De),F(Ee,o),o&&t(Fe),o&&t(fe),o&&t(or),o&&t(ot),o&&t(sr),o&&t(gt),F(ko),o&&t(ar),o&&t(Is),o&&t(rr),F(Co,o),o&&t(nr),o&&t(Zt),o&&t(ir),o&&t(Js),o&&t(lr),o&&t(Ws),o&&t(cr),o&&t(Ns),o&&t(dr),o&&t(bt),F(Uo),o&&t(mr),o&&t(Le),F(xo),F(St),o&&t(pr),o&&t(Tt),F(Wo),o&&t(hr),o&&t(pt),F(Zo),F(No),F(So),o&&t(fr),o&&t(yt),F(zo),o&&t(ur),o&&t(Xe),F(Ro),F(Go),F(Bo),o&&t(gr),o&&t(wt),F(Do),o&&t(br),o&&t(ht),F(Lo),F(Oo),F(Lt),F(Xt),o&&t(_r),o&&t($t),F(qo),o&&t(vr),o&&t(Ye),F(Ho),F(es),F(Ot),F(qt),o&&t(Tr),o&&t(Et),F(ts),o&&t(yr),o&&t(Oe),F(os),F(rs),F(Qt),F(Kt),o&&t(wr),o&&t(kt),F(ns),o&&t(Mr),o&&t(Ge),F(is),F(to),F(ms),F(oo),F(so),o&&t($r),o&&t(It),F(ps),o&&t(Vr),o&&t(ue),F(hs),F(ro),F(bs),F(no),F(io),o&&t(Er),o&&t(Ut),F(_s),o&&t(Fr),o&&t(ge),F(vs),F(co),F(Ms),F(mo),F(po)}}}const Vm={local:"mobilevit",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.MobileViTConfig",title:"MobileViTConfig"},{local:"transformers.MobileViTFeatureExtractor",title:"MobileViTFeatureExtractor"},{local:"transformers.MobileViTImageProcessor",title:"MobileViTImageProcessor"},{local:"transformers.MobileViTModel",title:"MobileViTModel"},{local:"transformers.MobileViTForImageClassification",title:"MobileViTForImageClassification"},{local:"transformers.MobileViTForSemanticSegmentation",title:"MobileViTForSemanticSegmentation"},{local:"transformers.TFMobileViTModel",title:"TFMobileViTModel"},{local:"transformers.TFMobileViTForImageClassification",title:"TFMobileViTForImageClassification"},{local:"transformers.TFMobileViTForSemanticSegmentation",title:"TFMobileViTForSemanticSegmentation"}],title:"MobileViT"};function Em(U){return nm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jm extends om{constructor(c){super();sm(this,c,Em,$m,am,{})}}export{Jm as default,Vm as metadata};
