import{S as Ta,i as $a,s as Ia,e as n,k as u,w as y,t as i,M as ka,c as s,d as o,m as g,a as r,x as w,h as l,b as c,G as t,g as v,y as M,q as T,o as $,B as I,v as Da,L as Bo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ma}from"../../chunks/Tip-hf-doc-builder.js";import{D as ot}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Go}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as at}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Po}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ja(j){let d,b,f,p,_;return p=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpbm92MkNvbmZpZyUyQyUyMERpbm92Mk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMERpbm92MiUyMGRpbm92Mi1iYXNlLXBhdGNoMTYtMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMERpbm92MkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBkaW5vdjItYmFzZS1wYXRjaDE2LTIyNCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwRGlub3YyTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Dinov2Config, Dinov2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Dinov2 dinov2-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Dinov2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the dinov2-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Dinov2Model(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(){d=n("p"),b=i("Example:"),f=u(),y(p.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),f=g(a),w(p.$$.fragment,a)},m(a,m){v(a,d,m),t(d,b),v(a,f,m),M(p,a,m),_=!0},p:Bo,i(a){_||(T(p.$$.fragment,a),_=!0)},o(a){$(p.$$.fragment,a),_=!1},d(a){a&&o(d),a&&o(f),I(p,a)}}}function Ca(j){let d,b,f,p,_;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),p=i("Module"),_=i(`
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(a){d=s(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(m,"CODE",{});var x=r(f);p=l(x,"Module"),x.forEach(o),_=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){v(a,d,m),t(d,b),t(d,f),t(f,p),t(d,_)},d(a){a&&o(d)}}}function Ea(j){let d,b,f,p,_;return p=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERpbm92Mk1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRpbm92Mi1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlub3YyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGlub3YyLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Dinov2Model
<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;facebook/dinov2-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Dinov2Model.from_pretrained(<span class="hljs-string">&quot;facebook/dinov2-base&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">197</span>, <span class="hljs-number">768</span>]`}}),{c(){d=n("p"),b=i("Example:"),f=u(),y(p.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),f=g(a),w(p.$$.fragment,a)},m(a,m){v(a,d,m),t(d,b),v(a,f,m),M(p,a,m),_=!0},p:Bo,i(a){_||(T(p.$$.fragment,a),_=!0)},o(a){$(p.$$.fragment,a),_=!1},d(a){a&&o(d),a&&o(f),I(p,a)}}}function Ja(j){let d,b,f,p,_;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),p=i("Module"),_=i(`
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(a){d=s(a,"P",{});var m=r(d);b=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(m,"CODE",{});var x=r(f);p=l(x,"Module"),x.forEach(o),_=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(a,m){v(a,d,m),t(d,b),t(d,f),t(f,p),t(d,_)},d(a){a&&o(d)}}}function xa(j){let d,b,f,p,_;return p=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMERpbm92MkZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZGlub3YyLWJhc2UtcGF0Y2gxNi0yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBEaW5vdjJGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmRpbm92Mi1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Dinov2ForImageClassification
<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;facebook/dinov2-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Dinov2ForImageClassification.from_pretrained(<span class="hljs-string">&quot;facebook/dinov2-base-patch16-224&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])
Egyptian cat`}}),{c(){d=n("p"),b=i("Example:"),f=u(),y(p.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);b=l(m,"Example:"),m.forEach(o),f=g(a),w(p.$$.fragment,a)},m(a,m){v(a,d,m),t(d,b),v(a,f,m),M(p,a,m),_=!0},p:Bo,i(a){_||(T(p.$$.fragment,a),_=!0)},o(a){$(p.$$.fragment,a),_=!1},d(a){a&&o(d),a&&o(f),I(p,a)}}}function Na(j){let d,b,f,p,_,a,m,x,$t,nt,F,R,Ge,ae,It,Ve,kt,st,C,Dt,ne,jt,Ct,se,Et,Jt,$e,xt,Nt,rt,Ie,Ut,it,ke,Re,Ft,lt,De,Wt,dt,je,re,zt,Ce,Zt,Pt,ct,U,Bt,ie,Gt,Vt,le,Rt,St,ht,W,S,Se,de,Yt,Ye,At,pt,k,ce,qt,z,Ot,Ee,Xt,Ht,he,Qt,Lt,Kt,Z,eo,Je,to,oo,xe,ao,no,so,Y,mt,P,A,Ae,pe,ro,qe,io,ft,N,me,lo,fe,co,ue,ho,po,mo,E,ge,fo,B,uo,Ne,go,vo,Oe,_o,bo,yo,q,wo,O,ut,G,X,Xe,ve,Mo,He,To,gt,D,_e,$o,Qe,Io,ko,be,Do,ye,jo,Co,Eo,J,we,Jo,V,xo,Ue,No,Uo,Le,Fo,Wo,zo,H,Zo,Q,vt;return a=new at({}),ae=new at({}),de=new at({}),ce=new ot({props:{name:"class transformers.Dinov2Config",anchor:"transformers.Dinov2Config",parameters:[{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"mlp_ratio",val:" = 4"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"layerscale_value",val:" = 1.0"},{name:"drop_path_rate",val:" = 0.0"},{name:"use_swiglu_ffn",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Dinov2Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Dinov2Config.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Dinov2Config.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Dinov2Config.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Ratio of the hidden size of the MLPs relative to the <code>hidden_size</code>.`,name:"mlp_ratio"},{anchor:"transformers.Dinov2Config.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.Dinov2Config.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.Dinov2Config.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.Dinov2Config.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.Dinov2Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Dinov2Config.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.Dinov2Config.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Dinov2Config.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.Dinov2Config.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.Dinov2Config.layerscale_value",description:`<strong>layerscale_value</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Initial value to use for layer scale.`,name:"layerscale_value"},{anchor:"transformers.Dinov2Config.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Stochastic depth rate per sample (when applied in the main path of residual layers).`,name:"drop_path_rate"},{anchor:"transformers.Dinov2Config.use_swiglu_ffn",description:`<strong>use_swiglu_ffn</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use the SwiGLU feedforward neural network.`,name:"use_swiglu_ffn"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/dinov2/configuration_dinov2.py#L34"}}),Y=new Po({props:{anchor:"transformers.Dinov2Config.example",$$slots:{default:[ja]},$$scope:{ctx:j}}}),pe=new at({}),me=new ot({props:{name:"class transformers.Dinov2Model",anchor:"transformers.Dinov2Model",parameters:[{name:"config",val:": Dinov2Config"}],parametersDescription:[{anchor:"transformers.Dinov2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2Config">Dinov2Config</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.32.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.32.0/src/transformers/models/dinov2/modeling_dinov2.py#L585"}}),ge=new ot({props:{name:"forward",anchor:"transformers.Dinov2Model.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Dinov2Model.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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.32.0/en/model_doc/bit#transformers.BitImageProcessor.preprocess">BitImageProcessor.preprocess()</a> for details.`,name:"pixel_values"},{anchor:"transformers.Dinov2Model.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0). Only relevant for
pre-training.`,name:"bool_masked_pos"},{anchor:"transformers.Dinov2Model.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Dinov2Model.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Dinov2Model.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.Dinov2Model.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.32.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.32.0/src/transformers/models/dinov2/modeling_dinov2.py#L609",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</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.32.0/en/model_doc/dinov2#transformers.Dinov2Config"
>Dinov2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</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>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</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, sequence_length, 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, 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.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),q=new Ma({props:{$$slots:{default:[Ca]},$$scope:{ctx:j}}}),O=new Po({props:{anchor:"transformers.Dinov2Model.forward.example",$$slots:{default:[Ea]},$$scope:{ctx:j}}}),ve=new at({}),_e=new ot({props:{name:"class transformers.Dinov2ForImageClassification",anchor:"transformers.Dinov2ForImageClassification",parameters:[{name:"config",val:": Dinov2Config"}],parametersDescription:[{anchor:"transformers.Dinov2ForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2Config">Dinov2Config</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.32.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.32.0/src/transformers/models/dinov2/modeling_dinov2.py#L674"}}),we=new ot({props:{name:"forward",anchor:"transformers.Dinov2ForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Dinov2ForImageClassification.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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.32.0/en/model_doc/bit#transformers.BitImageProcessor.preprocess">BitImageProcessor.preprocess()</a> for details.`,name:"pixel_values"},{anchor:"transformers.Dinov2ForImageClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Dinov2ForImageClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Dinov2ForImageClassification.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.Dinov2ForImageClassification.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.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Dinov2ForImageClassification.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.32.0/src/transformers/models/dinov2/modeling_dinov2.py#L689",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2Config"
>Dinov2Config</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)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \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, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \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.32.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new Ma({props:{$$slots:{default:[Ja]},$$scope:{ctx:j}}}),Q=new Po({props:{anchor:"transformers.Dinov2ForImageClassification.forward.example",$$slots:{default:[xa]},$$scope:{ctx:j}}}),{c(){d=n("meta"),b=u(),f=n("h1"),p=n("a"),_=n("span"),y(a.$$.fragment),m=u(),x=n("span"),$t=i("DINOv2"),nt=u(),F=n("h2"),R=n("a"),Ge=n("span"),y(ae.$$.fragment),It=u(),Ve=n("span"),kt=i("Overview"),st=u(),C=n("p"),Dt=i("The DINOv2 model was proposed in "),ne=n("a"),jt=i("DINOv2: Learning Robust Visual Features without Supervision"),Ct=i(` by
Maxime Oquab, Timoth\xE9e Darcet, Th\xE9o Moutakanni, Huy Vo, Marc Szafraniec, Vasil Khalidov, Pierre Fernandez, Daniel Haziza, Francisco Massa, Alaaeldin El-Nouby, Mahmoud Assran, Nicolas Ballas, Wojciech Galuba, Russell Howes, Po-Yao Huang, Shang-Wen Li, Ishan Misra, Michael Rabbat, Vasu Sharma, Gabriel Synnaeve, Hu Xu, Herv\xE9 Jegou, Julien Mairal, Patrick Labatut, Armand Joulin, Piotr Bojanowski.
DINOv2 is an upgrade of `),se=n("a"),Et=i("DINO"),Jt=i(", a self-supervised method applied on "),$e=n("a"),xt=i("Vision Transformers"),Nt=i(". This method enables all-purpose visual features, i.e., features that work across image distributions and tasks without finetuning."),rt=u(),Ie=n("p"),Ut=i("The abstract from the paper is the following:"),it=u(),ke=n("p"),Re=n("em"),Ft=i("The recent breakthroughs in natural language processing for model pretraining on large quantities of data have opened the way for similar foundation models in computer vision. These models could greatly simplify the use of images in any system by producing all-purpose visual features, i.e., features that work across image distributions and tasks without finetuning. This work shows that existing pretraining methods, especially self-supervised methods, can produce such features if trained on enough curated data from diverse sources. We revisit existing approaches and combine different techniques to scale our pretraining in terms of data and model size. Most of the technical contributions aim at accelerating and stabilizing the training at scale. In terms of data, we propose an automatic pipeline to build a dedicated, diverse, and curated image dataset instead of uncurated data, as typically done in the self-supervised literature. In terms of models, we train a ViT model (Dosovitskiy et al., 2020) with 1B parameters and distill it into a series of smaller models that surpass the best available all-purpose features, OpenCLIP (Ilharco et al., 2021) on most of the benchmarks at image and pixel levels."),lt=u(),De=n("p"),Wt=i("Tips:"),dt=u(),je=n("ul"),re=n("li"),zt=i("One can use "),Ce=n("a"),Zt=i("AutoImageProcessor"),Pt=i(" class to prepare images for the model."),ct=u(),U=n("p"),Bt=i("This model was contributed by "),ie=n("a"),Gt=i("nielsr"),Vt=i(`.
The original code can be found `),le=n("a"),Rt=i("here"),St=i("."),ht=u(),W=n("h2"),S=n("a"),Se=n("span"),y(de.$$.fragment),Yt=u(),Ye=n("span"),At=i("Dinov2Config"),pt=u(),k=n("div"),y(ce.$$.fragment),qt=u(),z=n("p"),Ot=i("This is the configuration class to store the configuration of a "),Ee=n("a"),Xt=i("Dinov2Model"),Ht=i(`. It is used to instantiate an
Dinov2 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 Dinov2
`),he=n("a"),Qt=i("google/dinov2-base-patch16-224"),Lt=i(" architecture."),Kt=u(),Z=n("p"),eo=i("Configuration objects inherit from "),Je=n("a"),to=i("PretrainedConfig"),oo=i(` and can be used to control the model outputs. Read the
documentation from `),xe=n("a"),ao=i("PretrainedConfig"),no=i(" for more information."),so=u(),y(Y.$$.fragment),mt=u(),P=n("h2"),A=n("a"),Ae=n("span"),y(pe.$$.fragment),ro=u(),qe=n("span"),io=i("Dinov2Model"),ft=u(),N=n("div"),y(me.$$.fragment),lo=u(),fe=n("p"),co=i(`The bare DINOv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ue=n("a"),ho=i("torch.nn.Module"),po=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),mo=u(),E=n("div"),y(ge.$$.fragment),fo=u(),B=n("p"),uo=i("The "),Ne=n("a"),go=i("Dinov2Model"),vo=i(" forward method, overrides the "),Oe=n("code"),_o=i("__call__"),bo=i(" special method."),yo=u(),y(q.$$.fragment),wo=u(),y(O.$$.fragment),ut=u(),G=n("h2"),X=n("a"),Xe=n("span"),y(ve.$$.fragment),Mo=u(),He=n("span"),To=i("Dinov2ForImageClassification"),gt=u(),D=n("div"),y(_e.$$.fragment),$o=u(),Qe=n("p"),Io=i(`Dinov2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),ko=u(),be=n("p"),Do=i("This model is a PyTorch "),ye=n("a"),jo=i("torch.nn.Module"),Co=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Eo=u(),J=n("div"),y(we.$$.fragment),Jo=u(),V=n("p"),xo=i("The "),Ue=n("a"),No=i("Dinov2ForImageClassification"),Uo=i(" forward method, overrides the "),Le=n("code"),Fo=i("__call__"),Wo=i(" special method."),zo=u(),y(H.$$.fragment),Zo=u(),y(Q.$$.fragment),this.h()},l(e){const h=ka('[data-svelte="svelte-1phssyn"]',document.head);d=s(h,"META",{name:!0,content:!0}),h.forEach(o),b=g(e),f=s(e,"H1",{class:!0});var Me=r(f);p=s(Me,"A",{id:!0,class:!0,href:!0});var Ke=r(p);_=s(Ke,"SPAN",{});var et=r(_);w(a.$$.fragment,et),et.forEach(o),Ke.forEach(o),m=g(Me),x=s(Me,"SPAN",{});var tt=r(x);$t=l(tt,"DINOv2"),tt.forEach(o),Me.forEach(o),nt=g(e),F=s(e,"H2",{class:!0});var Te=r(F);R=s(Te,"A",{id:!0,class:!0,href:!0});var Vo=r(R);Ge=s(Vo,"SPAN",{});var Ro=r(Ge);w(ae.$$.fragment,Ro),Ro.forEach(o),Vo.forEach(o),It=g(Te),Ve=s(Te,"SPAN",{});var So=r(Ve);kt=l(So,"Overview"),So.forEach(o),Te.forEach(o),st=g(e),C=s(e,"P",{});var L=r(C);Dt=l(L,"The DINOv2 model was proposed in "),ne=s(L,"A",{href:!0,rel:!0});var Yo=r(ne);jt=l(Yo,"DINOv2: Learning Robust Visual Features without Supervision"),Yo.forEach(o),Ct=l(L,` by
Maxime Oquab, Timoth\xE9e Darcet, Th\xE9o Moutakanni, Huy Vo, Marc Szafraniec, Vasil Khalidov, Pierre Fernandez, Daniel Haziza, Francisco Massa, Alaaeldin El-Nouby, Mahmoud Assran, Nicolas Ballas, Wojciech Galuba, Russell Howes, Po-Yao Huang, Shang-Wen Li, Ishan Misra, Michael Rabbat, Vasu Sharma, Gabriel Synnaeve, Hu Xu, Herv\xE9 Jegou, Julien Mairal, Patrick Labatut, Armand Joulin, Piotr Bojanowski.
DINOv2 is an upgrade of `),se=s(L,"A",{href:!0,rel:!0});var Ao=r(se);Et=l(Ao,"DINO"),Ao.forEach(o),Jt=l(L,", a self-supervised method applied on "),$e=s(L,"A",{href:!0});var qo=r($e);xt=l(qo,"Vision Transformers"),qo.forEach(o),Nt=l(L,". This method enables all-purpose visual features, i.e., features that work across image distributions and tasks without finetuning."),L.forEach(o),rt=g(e),Ie=s(e,"P",{});var Oo=r(Ie);Ut=l(Oo,"The abstract from the paper is the following:"),Oo.forEach(o),it=g(e),ke=s(e,"P",{});var Xo=r(ke);Re=s(Xo,"EM",{});var Ho=r(Re);Ft=l(Ho,"The recent breakthroughs in natural language processing for model pretraining on large quantities of data have opened the way for similar foundation models in computer vision. These models could greatly simplify the use of images in any system by producing all-purpose visual features, i.e., features that work across image distributions and tasks without finetuning. This work shows that existing pretraining methods, especially self-supervised methods, can produce such features if trained on enough curated data from diverse sources. We revisit existing approaches and combine different techniques to scale our pretraining in terms of data and model size. Most of the technical contributions aim at accelerating and stabilizing the training at scale. In terms of data, we propose an automatic pipeline to build a dedicated, diverse, and curated image dataset instead of uncurated data, as typically done in the self-supervised literature. In terms of models, we train a ViT model (Dosovitskiy et al., 2020) with 1B parameters and distill it into a series of smaller models that surpass the best available all-purpose features, OpenCLIP (Ilharco et al., 2021) on most of the benchmarks at image and pixel levels."),Ho.forEach(o),Xo.forEach(o),lt=g(e),De=s(e,"P",{});var Qo=r(De);Wt=l(Qo,"Tips:"),Qo.forEach(o),dt=g(e),je=s(e,"UL",{});var Lo=r(je);re=s(Lo,"LI",{});var _t=r(re);zt=l(_t,"One can use "),Ce=s(_t,"A",{href:!0});var Ko=r(Ce);Zt=l(Ko,"AutoImageProcessor"),Ko.forEach(o),Pt=l(_t," class to prepare images for the model."),_t.forEach(o),Lo.forEach(o),ct=g(e),U=s(e,"P",{});var Fe=r(U);Bt=l(Fe,"This model was contributed by "),ie=s(Fe,"A",{href:!0,rel:!0});var ea=r(ie);Gt=l(ea,"nielsr"),ea.forEach(o),Vt=l(Fe,`.
The original code can be found `),le=s(Fe,"A",{href:!0,rel:!0});var ta=r(le);Rt=l(ta,"here"),ta.forEach(o),St=l(Fe,"."),Fe.forEach(o),ht=g(e),W=s(e,"H2",{class:!0});var bt=r(W);S=s(bt,"A",{id:!0,class:!0,href:!0});var oa=r(S);Se=s(oa,"SPAN",{});var aa=r(Se);w(de.$$.fragment,aa),aa.forEach(o),oa.forEach(o),Yt=g(bt),Ye=s(bt,"SPAN",{});var na=r(Ye);At=l(na,"Dinov2Config"),na.forEach(o),bt.forEach(o),pt=g(e),k=s(e,"DIV",{class:!0});var K=r(k);w(ce.$$.fragment,K),qt=g(K),z=s(K,"P",{});var We=r(z);Ot=l(We,"This is the configuration class to store the configuration of a "),Ee=s(We,"A",{href:!0});var sa=r(Ee);Xt=l(sa,"Dinov2Model"),sa.forEach(o),Ht=l(We,`. It is used to instantiate an
Dinov2 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 Dinov2
`),he=s(We,"A",{href:!0,rel:!0});var ra=r(he);Qt=l(ra,"google/dinov2-base-patch16-224"),ra.forEach(o),Lt=l(We," architecture."),We.forEach(o),Kt=g(K),Z=s(K,"P",{});var ze=r(Z);eo=l(ze,"Configuration objects inherit from "),Je=s(ze,"A",{href:!0});var ia=r(Je);to=l(ia,"PretrainedConfig"),ia.forEach(o),oo=l(ze,` and can be used to control the model outputs. Read the
documentation from `),xe=s(ze,"A",{href:!0});var la=r(xe);ao=l(la,"PretrainedConfig"),la.forEach(o),no=l(ze," for more information."),ze.forEach(o),so=g(K),w(Y.$$.fragment,K),K.forEach(o),mt=g(e),P=s(e,"H2",{class:!0});var yt=r(P);A=s(yt,"A",{id:!0,class:!0,href:!0});var da=r(A);Ae=s(da,"SPAN",{});var ca=r(Ae);w(pe.$$.fragment,ca),ca.forEach(o),da.forEach(o),ro=g(yt),qe=s(yt,"SPAN",{});var ha=r(qe);io=l(ha,"Dinov2Model"),ha.forEach(o),yt.forEach(o),ft=g(e),N=s(e,"DIV",{class:!0});var Ze=r(N);w(me.$$.fragment,Ze),lo=g(Ze),fe=s(Ze,"P",{});var wt=r(fe);co=l(wt,`The bare DINOv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ue=s(wt,"A",{href:!0,rel:!0});var pa=r(ue);ho=l(pa,"torch.nn.Module"),pa.forEach(o),po=l(wt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),wt.forEach(o),mo=g(Ze),E=s(Ze,"DIV",{class:!0});var ee=r(E);w(ge.$$.fragment,ee),fo=g(ee),B=s(ee,"P",{});var Pe=r(B);uo=l(Pe,"The "),Ne=s(Pe,"A",{href:!0});var ma=r(Ne);go=l(ma,"Dinov2Model"),ma.forEach(o),vo=l(Pe," forward method, overrides the "),Oe=s(Pe,"CODE",{});var fa=r(Oe);_o=l(fa,"__call__"),fa.forEach(o),bo=l(Pe," special method."),Pe.forEach(o),yo=g(ee),w(q.$$.fragment,ee),wo=g(ee),w(O.$$.fragment,ee),ee.forEach(o),Ze.forEach(o),ut=g(e),G=s(e,"H2",{class:!0});var Mt=r(G);X=s(Mt,"A",{id:!0,class:!0,href:!0});var ua=r(X);Xe=s(ua,"SPAN",{});var ga=r(Xe);w(ve.$$.fragment,ga),ga.forEach(o),ua.forEach(o),Mo=g(Mt),He=s(Mt,"SPAN",{});var va=r(He);To=l(va,"Dinov2ForImageClassification"),va.forEach(o),Mt.forEach(o),gt=g(e),D=s(e,"DIV",{class:!0});var te=r(D);w(_e.$$.fragment,te),$o=g(te),Qe=s(te,"P",{});var _a=r(Qe);Io=l(_a,`Dinov2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),_a.forEach(o),ko=g(te),be=s(te,"P",{});var Tt=r(be);Do=l(Tt,"This model is a PyTorch "),ye=s(Tt,"A",{href:!0,rel:!0});var ba=r(ye);jo=l(ba,"torch.nn.Module"),ba.forEach(o),Co=l(Tt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tt.forEach(o),Eo=g(te),J=s(te,"DIV",{class:!0});var oe=r(J);w(we.$$.fragment,oe),Jo=g(oe),V=s(oe,"P",{});var Be=r(V);xo=l(Be,"The "),Ue=s(Be,"A",{href:!0});var ya=r(Ue);No=l(ya,"Dinov2ForImageClassification"),ya.forEach(o),Uo=l(Be," forward method, overrides the "),Le=s(Be,"CODE",{});var wa=r(Le);Fo=l(wa,"__call__"),wa.forEach(o),Wo=l(Be," special method."),Be.forEach(o),zo=g(oe),w(H.$$.fragment,oe),Zo=g(oe),w(Q.$$.fragment,oe),oe.forEach(o),te.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Ua)),c(p,"id","dinov2"),c(p,"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"),c(p,"href","#dinov2"),c(f,"class","relative group"),c(R,"id","overview"),c(R,"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"),c(R,"href","#overview"),c(F,"class","relative group"),c(ne,"href","https://arxiv.org/abs/2304.07193"),c(ne,"rel","nofollow"),c(se,"href","https://arxiv.org/abs/2104.14294"),c(se,"rel","nofollow"),c($e,"href","vit"),c(Ce,"href","/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoImageProcessor"),c(ie,"href","https://huggingface.co/nielsr"),c(ie,"rel","nofollow"),c(le,"href","https://github.com/facebookresearch/dinov2"),c(le,"rel","nofollow"),c(S,"id","transformers.Dinov2Config"),c(S,"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"),c(S,"href","#transformers.Dinov2Config"),c(W,"class","relative group"),c(Ee,"href","/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2Model"),c(he,"href","https://huggingface.co/google/dinov2-base-patch16-224"),c(he,"rel","nofollow"),c(Je,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(xe,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(A,"id","transformers.Dinov2Model"),c(A,"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"),c(A,"href","#transformers.Dinov2Model"),c(P,"class","relative group"),c(ue,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ue,"rel","nofollow"),c(Ne,"href","/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2Model"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(X,"id","transformers.Dinov2ForImageClassification"),c(X,"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"),c(X,"href","#transformers.Dinov2ForImageClassification"),c(G,"class","relative group"),c(ye,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ye,"rel","nofollow"),c(Ue,"href","/docs/transformers/v4.32.0/en/model_doc/dinov2#transformers.Dinov2ForImageClassification"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,h){t(document.head,d),v(e,b,h),v(e,f,h),t(f,p),t(p,_),M(a,_,null),t(f,m),t(f,x),t(x,$t),v(e,nt,h),v(e,F,h),t(F,R),t(R,Ge),M(ae,Ge,null),t(F,It),t(F,Ve),t(Ve,kt),v(e,st,h),v(e,C,h),t(C,Dt),t(C,ne),t(ne,jt),t(C,Ct),t(C,se),t(se,Et),t(C,Jt),t(C,$e),t($e,xt),t(C,Nt),v(e,rt,h),v(e,Ie,h),t(Ie,Ut),v(e,it,h),v(e,ke,h),t(ke,Re),t(Re,Ft),v(e,lt,h),v(e,De,h),t(De,Wt),v(e,dt,h),v(e,je,h),t(je,re),t(re,zt),t(re,Ce),t(Ce,Zt),t(re,Pt),v(e,ct,h),v(e,U,h),t(U,Bt),t(U,ie),t(ie,Gt),t(U,Vt),t(U,le),t(le,Rt),t(U,St),v(e,ht,h),v(e,W,h),t(W,S),t(S,Se),M(de,Se,null),t(W,Yt),t(W,Ye),t(Ye,At),v(e,pt,h),v(e,k,h),M(ce,k,null),t(k,qt),t(k,z),t(z,Ot),t(z,Ee),t(Ee,Xt),t(z,Ht),t(z,he),t(he,Qt),t(z,Lt),t(k,Kt),t(k,Z),t(Z,eo),t(Z,Je),t(Je,to),t(Z,oo),t(Z,xe),t(xe,ao),t(Z,no),t(k,so),M(Y,k,null),v(e,mt,h),v(e,P,h),t(P,A),t(A,Ae),M(pe,Ae,null),t(P,ro),t(P,qe),t(qe,io),v(e,ft,h),v(e,N,h),M(me,N,null),t(N,lo),t(N,fe),t(fe,co),t(fe,ue),t(ue,ho),t(fe,po),t(N,mo),t(N,E),M(ge,E,null),t(E,fo),t(E,B),t(B,uo),t(B,Ne),t(Ne,go),t(B,vo),t(B,Oe),t(Oe,_o),t(B,bo),t(E,yo),M(q,E,null),t(E,wo),M(O,E,null),v(e,ut,h),v(e,G,h),t(G,X),t(X,Xe),M(ve,Xe,null),t(G,Mo),t(G,He),t(He,To),v(e,gt,h),v(e,D,h),M(_e,D,null),t(D,$o),t(D,Qe),t(Qe,Io),t(D,ko),t(D,be),t(be,Do),t(be,ye),t(ye,jo),t(be,Co),t(D,Eo),t(D,J),M(we,J,null),t(J,Jo),t(J,V),t(V,xo),t(V,Ue),t(Ue,No),t(V,Uo),t(V,Le),t(Le,Fo),t(V,Wo),t(J,zo),M(H,J,null),t(J,Zo),M(Q,J,null),vt=!0},p(e,[h]){const Me={};h&2&&(Me.$$scope={dirty:h,ctx:e}),Y.$set(Me);const Ke={};h&2&&(Ke.$$scope={dirty:h,ctx:e}),q.$set(Ke);const et={};h&2&&(et.$$scope={dirty:h,ctx:e}),O.$set(et);const tt={};h&2&&(tt.$$scope={dirty:h,ctx:e}),H.$set(tt);const Te={};h&2&&(Te.$$scope={dirty:h,ctx:e}),Q.$set(Te)},i(e){vt||(T(a.$$.fragment,e),T(ae.$$.fragment,e),T(de.$$.fragment,e),T(ce.$$.fragment,e),T(Y.$$.fragment,e),T(pe.$$.fragment,e),T(me.$$.fragment,e),T(ge.$$.fragment,e),T(q.$$.fragment,e),T(O.$$.fragment,e),T(ve.$$.fragment,e),T(_e.$$.fragment,e),T(we.$$.fragment,e),T(H.$$.fragment,e),T(Q.$$.fragment,e),vt=!0)},o(e){$(a.$$.fragment,e),$(ae.$$.fragment,e),$(de.$$.fragment,e),$(ce.$$.fragment,e),$(Y.$$.fragment,e),$(pe.$$.fragment,e),$(me.$$.fragment,e),$(ge.$$.fragment,e),$(q.$$.fragment,e),$(O.$$.fragment,e),$(ve.$$.fragment,e),$(_e.$$.fragment,e),$(we.$$.fragment,e),$(H.$$.fragment,e),$(Q.$$.fragment,e),vt=!1},d(e){o(d),e&&o(b),e&&o(f),I(a),e&&o(nt),e&&o(F),I(ae),e&&o(st),e&&o(C),e&&o(rt),e&&o(Ie),e&&o(it),e&&o(ke),e&&o(lt),e&&o(De),e&&o(dt),e&&o(je),e&&o(ct),e&&o(U),e&&o(ht),e&&o(W),I(de),e&&o(pt),e&&o(k),I(ce),I(Y),e&&o(mt),e&&o(P),I(pe),e&&o(ft),e&&o(N),I(me),I(ge),I(q),I(O),e&&o(ut),e&&o(G),I(ve),e&&o(gt),e&&o(D),I(_e),I(we),I(H),I(Q)}}}const Ua={local:"dinov2",sections:[{local:"overview",title:"Overview"},{local:"transformers.Dinov2Config",title:"Dinov2Config"},{local:"transformers.Dinov2Model",title:"Dinov2Model"},{local:"transformers.Dinov2ForImageClassification",title:"Dinov2ForImageClassification"}],title:"DINOv2"};function Fa(j){return Da(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Va extends Ta{constructor(d){super();$a(this,d,Fa,Na,Ia,{})}}export{Va as default,Ua as metadata};
