import{s as Ft,o as qt,n as Pt}from"../chunks/scheduler.7bc62968.js";import{S as Qt,i as zt,g as i,s as n,r as f,A as Yt,h as o,f as s,c as a,j as Nt,u,x as p,k as Et,y as Lt,a as l,v as M,d as y,t as d,w as T,m as Rt,n as Ht}from"../chunks/index.2f8492b0.js";import{T as Gt}from"../chunks/Tip.016f38d9.js";import{C as Me}from"../chunks/CodeBlock.4e96d6f7.js";import{H as he,E as Xt}from"../chunks/EditOnGithub.2a9ce03a.js";function Ot(fe){let r;return{c(){r=Rt("A receptive field is the size of a region in an input space that affects the features of a particular layer.")},l(m){r=Ht(m,"A receptive field is the size of a region in an input space that affects the features of a particular layer.")},m(m,w){l(m,r,w)},d(m){m&&s(r)}}}function Kt(fe){let r,m,w='Separable self-attention was not the first paper to have O(k) complexity. In Linformer, O(k) complexity for Attention was also achieved in <a href="https://arxiv.org/abs/2006.04768" rel="nofollow">Linformer</a> before separable self-attention.',b,h,J="However, it still used costly operations like batch-wise matrix multiplications.";return{c(){r=Rt(`There have been many other forms of Attention such that complexity has ranged from O(k), O(k*sqrt(k)), O(k*log(k)).
`),m=i("p"),m.innerHTML=w,b=n(),h=i("p"),h.textContent=J},l(c){r=Ht(c,`There have been many other forms of Attention such that complexity has ranged from O(k), O(k*sqrt(k)), O(k*log(k)).
`),m=o(c,"P",{"data-svelte-h":!0}),p(m)!=="svelte-1a5ry1c"&&(m.innerHTML=w),b=a(c),h=o(c,"P",{"data-svelte-h":!0}),p(h)!=="svelte-1ajshxs"&&(h.textContent=J)},m(c,j){l(c,r,j),l(c,m,j),l(c,b,j),l(c,h,j)},p:Pt,d(c){c&&(s(r),s(m),s(b),s(h))}}}function Dt(fe){let r,m,w,b,h,J,c,j="The previously discussed Vision Transformer architectures are computationally intensive and hard to run on mobile devices. The previous state-of-the-art architecture used CNNs for mobile vision tasks. However, CNNs cannot learn global representations, and as a result they perform worse than their transformer counterparts.",ye,U,ot="The MobileViT architecture aims to solve the required problems for vision mobile tasks, such as low-latency and lightweight architecture, while providing the advantages of transformers and CNNs. The mobileViT Architecture was developed by Apple and builds MobileNet from Google’s research team. The MobileViT architecture builds upon the previous MobileNet architecture by adding the MobileViT Block and separable self-attention. These two features allow for lightning-fast latency, reduction of parameters, computational complexity, and deployment of vision ML models on resource-constrained devices.",de,g,Te,I,pt=`The architecture of MobileViT presented in the paper “MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer” by Sachin Mehta and Mohammad Rastegari is as follows:
<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/MobileViT-Architecture.png" alt="MobileViT Architecture"/>`,we,$,rt="Some of this should look similar to the previous chapter. The MobileNet blocks, nxn convolutions, downsampling, global pooling, and the final linear layer.",be,x,ct="As seen by the global pooling layer and the linear layer, the model shown here is for classification. However, the same blocks introduced in this paper can be used for a variety of vision applications.",Ce,k,ve,V,mt="The MobileViT block combines CNN’s local processing and global processing, as seen in transformers. It uses a combination of convolutions and a transformer layer, allowing it to capture spatially local information and global dependencies in the data.",Je,Z,ht=`A diagram of the MobileViT Block is shown below:
<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/MobileViT-MobileViTBlock.png" alt="MobileViT Block"/>`,je,B,ft="Okay, that’s a lot to take in. Let’s break that down.",Ue,W,ut="<li>The block takes in an image with multiple channels. Let’s say for an RGB image 3 channels, so the block takes in a three channeled image.</li> <li>It then performs a N by N convolution on the channels appending them to the existing channels.</li> <li>The block then creates a linear combination of these channels and adds them to the existing stack of channels.</li> <li>For each channel these images are unfolded into flattened patches.</li> <li>Then these flattened patches are passed through a transformer to project them into new patches.</li> <li>These patches are then folded back together to create an image with d dimensions.</li> <li>Afterwards a pointwise convolution is overlayed on the stitched image.</li> <li>And then the stitched image is then recombined with the original RGB images.</li>",ge,_,Mt="This approach allows for a receptive field of H x W (the entire input size) while modeling non-local dependencies and local dependencies through retaining patch locational information. This can be seen in the unfolding and refolding of the patches.",Ie,C,$e,A,yt=`This compound approach allows MobileViT to have fewer parameters than traditional CNNs and even better accuracy!
<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/MobileViT-CNNPreformance.png" alt="MobileViT CNNPreformance"/>`,xe,S,dt="The main efficiency bottleneck in the original MobileViT architecture is the multi-head self-attention in Transformers, which requires O(k^2) time complexity concerning the input tokens.",ke,N,Tt="Multi-head self-attention also requires costly operations like batch-wise matrix multiplications, which can impact latency on resource-constrained devices.",Ve,E,wt="These same authors wrote another paper on exactly how to make attention operate faster. They’ve called it separable self-attention.",Ze,G,Be,R,bt="In traditional multihead attention, the big O concerning input tokens is quadratic (O(k^2)). Separable self-attention introduced in this paper has a complexity of O(k) concerning input tokens.",We,H,Ct="In addition, the attention method does not use any batch-wise matrix multiplications, which helps reduce latency on resource-constrained devices like mobile phones.",_e,F,vt="This is a massive improvement!",Ae,v,Se,q,Jt=`A comparison between the attention mechanisms in Transformer, Linformer, and MobileViT is shown below:
<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/MobileViT-Attention.png" alt="Attention Comparison"/>`,Ne,P,jt="The image above gives a comparison of each of the individual types of attention between the Transformer, Linformer, and MobileViT v2 architectures.",Ee,Q,Ut="For example, in both the transformer and Linformer architectures, the attention computations perform two batch-wise matrix multiplications.",Ge,z,gt="However, in the case of separable self-attention, these two batch-wise multiplications are replaced by two separate linear computations. This allows for further boosted inference speed.",Re,Y,He,L,It="MobileViT blocks retain spatially local information while developing global representations, combining the strengths of Transformers and CNNs. They provide a receptive field that encompasses the entire image.",Fe,X,$t=`The introduction of separable self-attention into this existing architecture even further boosted both accuracy and inference speed.
<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/MobileViT-Inference.png" alt="Inference Tests"/>`,qe,O,xt="Tests performed with different architectures on the iPhone 12s exhibited a large jump in performance with the introduction of separable attention, as shown above!",Pe,K,kt="Overall, the MobileViT Architecture is an extraordinarily powerful architecture for resource-limited vision tasks that provides fast inference and high accuracy.",Qe,D,ze,ee,Vt="If you want to try out MobileViTv2 locally, you can use it from HuggingFace’s <code>transformers</code> library, here’s how:",Ye,te,Le,se,Zt="Below is a short snippet on how to use MobileViT model to classify an image.",Xe,le,Oe,ne,Ke,ae,Bt=`For an even lighter computer vision setup, you can use the Hugging Face Inference API with MobileViTv2.
Inference API is an API to interact with many models available on Hugging Face Hub.
We can query Inference API like following through Python.`,De,ie,et,oe,Wt="We can do the same with javascript like following.",tt,pe,st,re,_t="Finally, we can query inference API through curl.",lt,ce,nt,me,at,ue,it;return h=new he({props:{title:"MobileViT v2",local:"mobilevit-v2",headingTag:"h1"}}),g=new he({props:{title:"MobileViT Architecture",local:"mobilevit-architecture",headingTag:"h2"}}),k=new he({props:{title:"MobileViT Block",local:"mobilevit-block",headingTag:"h2"}}),C=new Gt({props:{$$slots:{default:[Ot]},$$scope:{ctx:fe}}}),G=new he({props:{title:"Separable Self-attention",local:"separable-self-attention",headingTag:"h1"}}),v=new Gt({props:{$$slots:{default:[Kt]},$$scope:{ctx:fe}}}),Y=new he({props:{title:"Conclusion",local:"conclusion",headingTag:"h1"}}),D=new he({props:{title:"Transformers Library",local:"transformers-library",headingTag:"h1"}}),te=new Me({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycw==",highlighted:"pip install transformers",wrap:!1}}),le=new Me({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZVZpVFYyRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmFwcGxlJTJGbW9iaWxldml0djItMS4wLWltYWdlbmV0MWstMjU2JTIyJTBBKSUwQW1vZGVsJTIwJTNEJTIwTW9iaWxlVmlUVjJGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJhcHBsZSUyRm1vYmlsZXZpdHYyLTEuMC1pbWFnZW5ldDFrLTI1NiUyMiUwQSklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileViTV2ForImageClassification
<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

image_processor = AutoImageProcessor.from_pretrained(
    <span class="hljs-string">&quot;apple/mobilevitv2-1.0-imagenet1k-256&quot;</span>
)
model = MobileViTV2ForImageClassification.from_pretrained(
    <span class="hljs-string">&quot;apple/mobilevitv2-1.0-imagenet1k-256&quot;</span>
)

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

logits = model(**inputs).logits

<span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])`,wrap:!1}}),ne=new he({props:{title:"Inference API",local:"inference-api",headingTag:"h1"}}),ie=new Me({props:{code:"aW1wb3J0JTIwanNvbiUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBaGVhZGVycyUyMCUzRCUyMCU3QiUyMkF1dGhvcml6YXRpb24lMjIlM0ElMjBmJTIyQmVhcmVyJTIwJTdCQVBJX1RPS0VOJTdEJTIyJTdEJTBBQVBJX1VSTCUyMCUzRCUyMCglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmFwaS1pbmZlcmVuY2UuaHVnZ2luZ2ZhY2UuY28lMkZtb2RlbHMlMkZhcHBsZSUyRm1vYmlsZXZpdHYyLTEuMC1pbWFnZW5ldDFrLTI1NiUyMiUwQSklMEElMEElMEFkZWYlMjBxdWVyeShmaWxlbmFtZSklM0ElMEElMjAlMjAlMjAlMjB3aXRoJTIwb3BlbihmaWxlbmFtZSUyQyUyMCUyMnJiJTIyKSUyMGFzJTIwZiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGRhdGElMjAlM0QlMjBmLnJlYWQoKSUwQSUyMCUyMCUyMCUyMHJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMucmVxdWVzdCglMjJQT1NUJTIyJTJDJTIwQVBJX1VSTCUyQyUyMGhlYWRlcnMlM0RoZWFkZXJzJTJDJTIwZGF0YSUzRGRhdGEpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwanNvbi5sb2FkcyhyZXNwb25zZS5jb250ZW50LmRlY29kZSglMjJ1dGYtOCUyMikpJTBBJTBBJTBBZGF0YSUyMCUzRCUyMHF1ZXJ5KCUyMmNhdHMuanBnJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> json
<span class="hljs-keyword">import</span> requests

headers = {<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">f&quot;Bearer <span class="hljs-subst">{API_TOKEN}</span>&quot;</span>}
API_URL = (
    <span class="hljs-string">&quot;https://api-inference.huggingface.co/models/apple/mobilevitv2-1.0-imagenet1k-256&quot;</span>
)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">query</span>(<span class="hljs-params">filename</span>):
    <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(filename, <span class="hljs-string">&quot;rb&quot;</span>) <span class="hljs-keyword">as</span> f:
        data = f.read()
    response = requests.request(<span class="hljs-string">&quot;POST&quot;</span>, API_URL, headers=headers, data=data)
    <span class="hljs-keyword">return</span> json.loads(response.content.decode(<span class="hljs-string">&quot;utf-8&quot;</span>))


data = query(<span class="hljs-string">&quot;cats.jpg&quot;</span>)`,wrap:!1}}),pe=new Me({props:{code:"aW1wb3J0JTIwZmV0Y2glMjBmcm9tJTIwJTIybm9kZS1mZXRjaCUyMiUzQiUwQWltcG9ydCUyMGZzJTIwZnJvbSUyMCUyMmZzJTIyJTNCJTBBYXN5bmMlMjBmdW5jdGlvbiUyMHF1ZXJ5KGZpbGVuYW1lKSUyMCU3QiUwQSUyMCUyMCUyMCUyMGNvbnN0JTIwZGF0YSUyMCUzRCUyMGZzLnJlYWRGaWxlU3luYyhmaWxlbmFtZSklM0IlMEElMjAlMjAlMjAlMjBjb25zdCUyMHJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBmZXRjaCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmFwaS1pbmZlcmVuY2UuaHVnZ2luZ2ZhY2UuY28lMkZtb2RlbHMlMkZhcHBsZSUyRm1vYmlsZXZpdHYyLTEuMC1pbWFnZW5ldDFrLTI1NiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGhlYWRlcnMlM0ElMjAlN0IlMjBBdXRob3JpemF0aW9uJTNBJTIwJTYwQmVhcmVyJTIwJTI0JTdCQVBJX1RPS0VOJTdEJTYwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbWV0aG9kJTNBJTIwJTIyUE9TVCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJvZHklM0ElMjBkYXRhJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwKSUzQiUwQSUyMCUyMCUyMCUyMGNvbnN0JTIwcmVzdWx0JTIwJTNEJTIwYXdhaXQlMjByZXNwb25zZS5qc29uKCklM0IlMEElMjAlMjAlMjAlMjByZXR1cm4lMjByZXN1bHQlM0IlMEElN0QlMEFxdWVyeSglMjJjYXRzLmpwZyUyMikudGhlbigocmVzcG9uc2UpJTIwJTNEJTNFJTIwJTdCJTBBJTIwJTIwJTIwJTIwY29uc29sZS5sb2coSlNPTi5zdHJpbmdpZnkocmVzcG9uc2UpKSUzQiUwQSU3RCklM0I=",highlighted:`<span class="hljs-keyword">import</span> fetch <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;node-fetch&quot;</span>;
<span class="hljs-keyword">import</span> fs <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;fs&quot;</span>;
<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">query</span>(<span class="hljs-params">filename</span>) {
    <span class="hljs-keyword">const</span> data = fs.<span class="hljs-title function_">readFileSync</span>(filename);
    <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(
        <span class="hljs-string">&quot;https://api-inference.huggingface.co/models/apple/mobilevitv2-1.0-imagenet1k-256&quot;</span>,
        {
            <span class="hljs-attr">headers</span>: { <span class="hljs-title class_">Authorization</span>: <span class="hljs-string">\`Bearer <span class="hljs-subst">\${API_TOKEN}</span>\`</span> },
            <span class="hljs-attr">method</span>: <span class="hljs-string">&quot;POST&quot;</span>,
            <span class="hljs-attr">body</span>: data,
        }
    );
    <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> response.<span class="hljs-title function_">json</span>();
    <span class="hljs-keyword">return</span> result;
}
<span class="hljs-title function_">query</span>(<span class="hljs-string">&quot;cats.jpg&quot;</span>).<span class="hljs-title function_">then</span>(<span class="hljs-function">(<span class="hljs-params">response</span>) =&gt;</span> {
    <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(response));
});`,wrap:!1}}),ce=new Me({props:{code:"Y3VybCUyMGh0dHBzJTNBJTJGJTJGYXBpLWluZmVyZW5jZS5odWdnaW5nZmFjZS5jbyUyRm1vZGVscyUyRmFwcGxlJTJGbW9iaWxldml0djItMS4wLWltYWdlbmV0MWstMjU2JTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLVglMjBQT1NUJTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLS1kYXRhLWJpbmFyeSUyMCclNDBjYXRzLmpwZyclMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtSCUyMCUyMkF1dGhvcml6YXRpb24lM0ElMjBCZWFyZXIlMjAlMjQlN0JIRl9BUElfVE9LRU4lN0QlMjI=",highlighted:`curl https://api-inference.huggingface.co/models/apple/mobilevitv2-1.0-imagenet1k-256 \\
        -X POST \\
        --data-binary <span class="hljs-string">&#x27;@cats.jpg&#x27;</span> \\
        -H <span class="hljs-string">&quot;Authorization: Bearer <span class="hljs-variable">\${HF_API_TOKEN}</span>&quot;</span>`,wrap:!1}}),me=new Xt({props:{source:"https://github.com/johko/computer-vision-course/blob/main/chapters/en/unit3/vision-transformers/mobilevit.mdx"}}),{c(){r=i("meta"),m=n(),w=i("p"),b=n(),f(h.$$.fragment),J=n(),c=i("p"),c.textContent=j,ye=n(),U=i("p"),U.textContent=ot,de=n(),f(g.$$.fragment),Te=n(),I=i("p"),I.innerHTML=pt,we=n(),$=i("p"),$.textContent=rt,be=n(),x=i("p"),x.textContent=ct,Ce=n(),f(k.$$.fragment),ve=n(),V=i("p"),V.textContent=mt,Je=n(),Z=i("p"),Z.innerHTML=ht,je=n(),B=i("p"),B.textContent=ft,Ue=n(),W=i("ul"),W.innerHTML=ut,ge=n(),_=i("p"),_.textContent=Mt,Ie=n(),f(C.$$.fragment),$e=n(),A=i("p"),A.innerHTML=yt,xe=n(),S=i("p"),S.textContent=dt,ke=n(),N=i("p"),N.textContent=Tt,Ve=n(),E=i("p"),E.textContent=wt,Ze=n(),f(G.$$.fragment),Be=n(),R=i("p"),R.textContent=bt,We=n(),H=i("p"),H.textContent=Ct,_e=n(),F=i("p"),F.textContent=vt,Ae=n(),f(v.$$.fragment),Se=n(),q=i("p"),q.innerHTML=Jt,Ne=n(),P=i("p"),P.textContent=jt,Ee=n(),Q=i("p"),Q.textContent=Ut,Ge=n(),z=i("p"),z.textContent=gt,Re=n(),f(Y.$$.fragment),He=n(),L=i("p"),L.textContent=It,Fe=n(),X=i("p"),X.innerHTML=$t,qe=n(),O=i("p"),O.textContent=xt,Pe=n(),K=i("p"),K.textContent=kt,Qe=n(),f(D.$$.fragment),ze=n(),ee=i("p"),ee.innerHTML=Vt,Ye=n(),f(te.$$.fragment),Le=n(),se=i("p"),se.textContent=Zt,Xe=n(),f(le.$$.fragment),Oe=n(),f(ne.$$.fragment),Ke=n(),ae=i("p"),ae.textContent=Bt,De=n(),f(ie.$$.fragment),et=n(),oe=i("p"),oe.textContent=Wt,tt=n(),f(pe.$$.fragment),st=n(),re=i("p"),re.textContent=_t,lt=n(),f(ce.$$.fragment),nt=n(),f(me.$$.fragment),at=n(),ue=i("p"),this.h()},l(e){const t=Yt("svelte-u9bgzb",document.head);r=o(t,"META",{name:!0,content:!0}),t.forEach(s),m=a(e),w=o(e,"P",{}),Nt(w).forEach(s),b=a(e),u(h.$$.fragment,e),J=a(e),c=o(e,"P",{"data-svelte-h":!0}),p(c)!=="svelte-a5sr6t"&&(c.textContent=j),ye=a(e),U=o(e,"P",{"data-svelte-h":!0}),p(U)!=="svelte-10z2vs1"&&(U.textContent=ot),de=a(e),u(g.$$.fragment,e),Te=a(e),I=o(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-bmj0ue"&&(I.innerHTML=pt),we=a(e),$=o(e,"P",{"data-svelte-h":!0}),p($)!=="svelte-13qcall"&&($.textContent=rt),be=a(e),x=o(e,"P",{"data-svelte-h":!0}),p(x)!=="svelte-1ev9nks"&&(x.textContent=ct),Ce=a(e),u(k.$$.fragment,e),ve=a(e),V=o(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-16bokny"&&(V.textContent=mt),Je=a(e),Z=o(e,"P",{"data-svelte-h":!0}),p(Z)!=="svelte-1ty6jj8"&&(Z.innerHTML=ht),je=a(e),B=o(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-18vonjn"&&(B.textContent=ft),Ue=a(e),W=o(e,"UL",{"data-svelte-h":!0}),p(W)!=="svelte-85swkx"&&(W.innerHTML=ut),ge=a(e),_=o(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-1ks87bx"&&(_.textContent=Mt),Ie=a(e),u(C.$$.fragment,e),$e=a(e),A=o(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-10ehg4e"&&(A.innerHTML=yt),xe=a(e),S=o(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-1jrpgtq"&&(S.textContent=dt),ke=a(e),N=o(e,"P",{"data-svelte-h":!0}),p(N)!=="svelte-1w3wo1k"&&(N.textContent=Tt),Ve=a(e),E=o(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-svxq7o"&&(E.textContent=wt),Ze=a(e),u(G.$$.fragment,e),Be=a(e),R=o(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-1cmet3s"&&(R.textContent=bt),We=a(e),H=o(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-zdrtnh"&&(H.textContent=Ct),_e=a(e),F=o(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-15m63ew"&&(F.textContent=vt),Ae=a(e),u(v.$$.fragment,e),Se=a(e),q=o(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-3skqhs"&&(q.innerHTML=Jt),Ne=a(e),P=o(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-17i0vc"&&(P.textContent=jt),Ee=a(e),Q=o(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-1pddr69"&&(Q.textContent=Ut),Ge=a(e),z=o(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-1gc2js8"&&(z.textContent=gt),Re=a(e),u(Y.$$.fragment,e),He=a(e),L=o(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-1lfv2sg"&&(L.textContent=It),Fe=a(e),X=o(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-5csdhs"&&(X.innerHTML=$t),qe=a(e),O=o(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-pkj3bq"&&(O.textContent=xt),Pe=a(e),K=o(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-qdo4d3"&&(K.textContent=kt),Qe=a(e),u(D.$$.fragment,e),ze=a(e),ee=o(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-2kyg2y"&&(ee.innerHTML=Vt),Ye=a(e),u(te.$$.fragment,e),Le=a(e),se=o(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-qgp6vb"&&(se.textContent=Zt),Xe=a(e),u(le.$$.fragment,e),Oe=a(e),u(ne.$$.fragment,e),Ke=a(e),ae=o(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-1iqg6dj"&&(ae.textContent=Bt),De=a(e),u(ie.$$.fragment,e),et=a(e),oe=o(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-1fv3ued"&&(oe.textContent=Wt),tt=a(e),u(pe.$$.fragment,e),st=a(e),re=o(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-6diubf"&&(re.textContent=_t),lt=a(e),u(ce.$$.fragment,e),nt=a(e),u(me.$$.fragment,e),at=a(e),ue=o(e,"P",{}),Nt(ue).forEach(s),this.h()},h(){Et(r,"name","hf:doc:metadata"),Et(r,"content",es)},m(e,t){Lt(document.head,r),l(e,m,t),l(e,w,t),l(e,b,t),M(h,e,t),l(e,J,t),l(e,c,t),l(e,ye,t),l(e,U,t),l(e,de,t),M(g,e,t),l(e,Te,t),l(e,I,t),l(e,we,t),l(e,$,t),l(e,be,t),l(e,x,t),l(e,Ce,t),M(k,e,t),l(e,ve,t),l(e,V,t),l(e,Je,t),l(e,Z,t),l(e,je,t),l(e,B,t),l(e,Ue,t),l(e,W,t),l(e,ge,t),l(e,_,t),l(e,Ie,t),M(C,e,t),l(e,$e,t),l(e,A,t),l(e,xe,t),l(e,S,t),l(e,ke,t),l(e,N,t),l(e,Ve,t),l(e,E,t),l(e,Ze,t),M(G,e,t),l(e,Be,t),l(e,R,t),l(e,We,t),l(e,H,t),l(e,_e,t),l(e,F,t),l(e,Ae,t),M(v,e,t),l(e,Se,t),l(e,q,t),l(e,Ne,t),l(e,P,t),l(e,Ee,t),l(e,Q,t),l(e,Ge,t),l(e,z,t),l(e,Re,t),M(Y,e,t),l(e,He,t),l(e,L,t),l(e,Fe,t),l(e,X,t),l(e,qe,t),l(e,O,t),l(e,Pe,t),l(e,K,t),l(e,Qe,t),M(D,e,t),l(e,ze,t),l(e,ee,t),l(e,Ye,t),M(te,e,t),l(e,Le,t),l(e,se,t),l(e,Xe,t),M(le,e,t),l(e,Oe,t),M(ne,e,t),l(e,Ke,t),l(e,ae,t),l(e,De,t),M(ie,e,t),l(e,et,t),l(e,oe,t),l(e,tt,t),M(pe,e,t),l(e,st,t),l(e,re,t),l(e,lt,t),M(ce,e,t),l(e,nt,t),M(me,e,t),l(e,at,t),l(e,ue,t),it=!0},p(e,[t]){const At={};t&2&&(At.$$scope={dirty:t,ctx:e}),C.$set(At);const St={};t&2&&(St.$$scope={dirty:t,ctx:e}),v.$set(St)},i(e){it||(y(h.$$.fragment,e),y(g.$$.fragment,e),y(k.$$.fragment,e),y(C.$$.fragment,e),y(G.$$.fragment,e),y(v.$$.fragment,e),y(Y.$$.fragment,e),y(D.$$.fragment,e),y(te.$$.fragment,e),y(le.$$.fragment,e),y(ne.$$.fragment,e),y(ie.$$.fragment,e),y(pe.$$.fragment,e),y(ce.$$.fragment,e),y(me.$$.fragment,e),it=!0)},o(e){d(h.$$.fragment,e),d(g.$$.fragment,e),d(k.$$.fragment,e),d(C.$$.fragment,e),d(G.$$.fragment,e),d(v.$$.fragment,e),d(Y.$$.fragment,e),d(D.$$.fragment,e),d(te.$$.fragment,e),d(le.$$.fragment,e),d(ne.$$.fragment,e),d(ie.$$.fragment,e),d(pe.$$.fragment,e),d(ce.$$.fragment,e),d(me.$$.fragment,e),it=!1},d(e){e&&(s(m),s(w),s(b),s(J),s(c),s(ye),s(U),s(de),s(Te),s(I),s(we),s($),s(be),s(x),s(Ce),s(ve),s(V),s(Je),s(Z),s(je),s(B),s(Ue),s(W),s(ge),s(_),s(Ie),s($e),s(A),s(xe),s(S),s(ke),s(N),s(Ve),s(E),s(Ze),s(Be),s(R),s(We),s(H),s(_e),s(F),s(Ae),s(Se),s(q),s(Ne),s(P),s(Ee),s(Q),s(Ge),s(z),s(Re),s(He),s(L),s(Fe),s(X),s(qe),s(O),s(Pe),s(K),s(Qe),s(ze),s(ee),s(Ye),s(Le),s(se),s(Xe),s(Oe),s(Ke),s(ae),s(De),s(et),s(oe),s(tt),s(st),s(re),s(lt),s(nt),s(at),s(ue)),s(r),T(h,e),T(g,e),T(k,e),T(C,e),T(G,e),T(v,e),T(Y,e),T(D,e),T(te,e),T(le,e),T(ne,e),T(ie,e),T(pe,e),T(ce,e),T(me,e)}}}const es='{"title":"MobileViT v2","local":"mobilevit-v2","sections":[{"title":"MobileViT Architecture","local":"mobilevit-architecture","sections":[],"depth":2},{"title":"MobileViT Block","local":"mobilevit-block","sections":[],"depth":2}],"depth":1}';function ts(fe){return qt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class os extends Qt{constructor(r){super(),zt(this,r,ts,Dt,Ft,{})}}export{os as component};
