import{s as Ke,o as et,n as tt}from"../chunks/scheduler.25b97de1.js";import{S as nt,i as at,g as s,s as o,r as f,A as ot,h as i,f as n,c as r,j as y,u as d,x as $,k as w,y as l,a,v as b,d as u,t as p,w as g}from"../chunks/index.d9030fc9.js";import{D as O}from"../chunks/Docstring.ffac8efa.js";import{C as rt}from"../chunks/CodeBlock.e6cd0d95.js";import{E as st}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as se,E as it}from"../chunks/EditOnGithub.91d95064.js";function lt(me){let c,U="Example:",B,_,k;return _=new rt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRpbW1CYWNrYm9uZUNvbmZpZyUyQyUyMFRpbW1CYWNrYm9uZSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjB0aW1tJTIwYmFja2JvbmUlMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwVGltbUJhY2tib25lQ29uZmlnKCUyMnJlc25ldDUwJTIyKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBUaW1tQmFja2JvbmUoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TimmBackboneConfig, TimmBackbone

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a timm backbone</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = TimmBackboneConfig(<span class="hljs-string">&quot;resnet50&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TimmBackbone(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`,wrap:!1}}),{c(){c=s("p"),c.textContent=U,B=o(),f(_.$$.fragment)},l(m){c=i(m,"P",{"data-svelte-h":!0}),$(c)!=="svelte-11lpom8"&&(c.textContent=U),B=r(m),d(_.$$.fragment,m)},m(m,v){a(m,c,v),a(m,B,v),b(_,m,v),k=!0},p:tt,i(m){k||(u(_.$$.fragment,m),k=!0)},o(m){p(_.$$.fragment,m),k=!1},d(m){m&&(n(c),n(B)),g(_,m)}}}function mt(me){let c,U,B,_,k,m,v,Je='A backbone is a model used for feature extraction for higher level computer vision tasks such as object detection and image classification. Transformers provides an <a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.AutoBackbone">AutoBackbone</a> class for initializing a Transformers backbone from pretrained model weights, and two utility classes:',ce,P,Se='<li><a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.utils.BackboneMixin">BackboneMixin</a> enables initializing a backbone from Transformers or <a href="https://hf.co/docs/timm/index" rel="nofollow">timm</a> and includes functions for returning the output features and indices.</li> <li><a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.utils.BackboneConfigMixin">BackboneConfigMixin</a> sets the output features and indices of the backbone configuration.</li>',fe,W,De='<a href="https://hf.co/docs/timm/index" rel="nofollow">timm</a> models are loaded with the <a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.TimmBackbone">TimmBackbone</a> and <a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.TimmBackboneConfig">TimmBackboneConfig</a> classes.',de,H,Fe="Backbones are supported for the following models:",be,N,Ve='<li><a href="../model_doc/beit">BEiT</a></li> <li><a href="../model_doc/bit">BiT</a></li> <li><a href="../model_doc/convnext">ConvNext</a></li> <li><a href="../model_doc/convnextv2">ConvNextV2</a></li> <li><a href="../model_doc/dinat">DiNAT</a></li> <li><a href="../model_doc/dinov2">DINOV2</a></li> <li><a href="../model_doc/focalnet">FocalNet</a></li> <li><a href="../model_doc/maskformer">MaskFormer</a></li> <li><a href="../model_doc/nat">NAT</a></li> <li><a href="../model_doc/resnet">ResNet</a></li> <li><a href="../model_doc/swin">Swin Transformer</a></li> <li><a href="../model_doc/swinv2">Swin Transformer v2</a></li> <li><a href="../model_doc/vitdet">ViTDet</a></li>',ue,I,pe,A,Z,ge,z,he,M,J,Le,j,S,Ue,X,Ye=`Serializes this instance to a Python dictionary. Override the default <code>to_dict()</code> from <code>PretrainedConfig</code> to
include the <code>out_features</code> and <code>out_indices</code> attributes.`,$e,D,_e,T,F,Pe,K,Ge="A Mixin to support handling the <code>out_features</code> and <code>out_indices</code> attributes for the backbone configurations.",We,E,V,He,ee,Re=`Serializes this instance to a Python dictionary. Override the default <code>to_dict()</code> from <code>PretrainedConfig</code> to
include the <code>out_features</code> and <code>out_indices</code> attributes.`,ke,Y,ve,C,G,Ne,te,Qe=`Wrapper class for timm models to be used as backbones. This enables using the timm models interchangeably with the
other models in the library keeping the same API.`,Te,R,Be,h,Q,Ie,ne,qe='This is the configuration class to store the configuration for a timm backbone <a href="/docs/transformers/pr_29969/en/main_classes/backbones#transformers.TimmBackbone">TimmBackbone</a>.',Ae,ae,Oe="It is used to instantiate a timm backbone model according to the specified arguments, defining the model.",Ze,oe,Xe=`Configuration objects inherit from <a href="/docs/transformers/pr_29969/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_29969/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ze,L,xe,q,Me,ie,Ce;return k=new se({props:{title:"Backbone",local:"backbone",headingTag:"h1"}}),I=new se({props:{title:"AutoBackbone",local:"transformers.AutoBackbone",headingTag:"h2"}}),Z=new O({props:{name:"class transformers.AutoBackbone",anchor:"transformers.AutoBackbone",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/models/auto/modeling_auto.py#L1740"}}),z=new se({props:{title:"BackboneMixin",local:"transformers.utils.BackboneMixin",headingTag:"h2"}}),J=new O({props:{name:"class transformers.utils.BackboneMixin",anchor:"transformers.utils.BackboneMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/utils/backbone_utils.py#L140"}}),S=new O({props:{name:"to_dict",anchor:"transformers.utils.BackboneMixin.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/utils/backbone_utils.py#L246"}}),D=new se({props:{title:"BackboneConfigMixin",local:"transformers.utils.BackboneConfigMixin",headingTag:"h2"}}),F=new O({props:{name:"class transformers.utils.BackboneConfigMixin",anchor:"transformers.utils.BackboneConfigMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/utils/backbone_utils.py#L257"}}),V=new O({props:{name:"to_dict",anchor:"transformers.utils.BackboneConfigMixin.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/utils/backbone_utils.py#L288"}}),Y=new se({props:{title:"TimmBackbone",local:"transformers.TimmBackbone",headingTag:"h2"}}),G=new O({props:{name:"class transformers.TimmBackbone",anchor:"transformers.TimmBackbone",parameters:[{name:"config",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/models/timm_backbone/modeling_timm_backbone.py#L35"}}),R=new se({props:{title:"TimmBackboneConfig",local:"transformers.TimmBackboneConfig",headingTag:"h2"}}),Q=new O({props:{name:"class transformers.TimmBackboneConfig",anchor:"transformers.TimmBackboneConfig",parameters:[{name:"backbone",val:" = None"},{name:"num_channels",val:" = 3"},{name:"features_only",val:" = True"},{name:"use_pretrained_backbone",val:" = True"},{name:"out_indices",val:" = None"},{name:"freeze_batch_norm_2d",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimmBackboneConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The timm checkpoint to load.`,name:"backbone"},{anchor:"transformers.TimmBackboneConfig.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.TimmBackboneConfig.features_only",description:`<strong>features_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to output only the features or also the logits.`,name:"features_only"},{anchor:"transformers.TimmBackboneConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a pretrained backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.TimmBackboneConfig.out_indices",description:`<strong>out_indices</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how
many stages the model has). Will default to the last stage if unset.`,name:"out_indices"},{anchor:"transformers.TimmBackboneConfig.freeze_batch_norm_2d",description:`<strong>freeze_batch_norm_2d</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Converts all <code>BatchNorm2d</code> and <code>SyncBatchNorm</code> layers of provided module into <code>FrozenBatchNorm2d</code>.`,name:"freeze_batch_norm_2d"}],source:"https://github.com/huggingface/transformers/blob/vr_29969/src/transformers/models/timm_backbone/configuration_timm_backbone.py#L25"}}),L=new st({props:{anchor:"transformers.TimmBackboneConfig.example",$$slots:{default:[lt]},$$scope:{ctx:me}}}),q=new it({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/main_classes/backbones.md"}}),{c(){c=s("meta"),U=o(),B=s("p"),_=o(),f(k.$$.fragment),m=o(),v=s("p"),v.innerHTML=Je,ce=o(),P=s("ul"),P.innerHTML=Se,fe=o(),W=s("p"),W.innerHTML=De,de=o(),H=s("p"),H.textContent=Fe,be=o(),N=s("ul"),N.innerHTML=Ve,ue=o(),f(I.$$.fragment),pe=o(),A=s("div"),f(Z.$$.fragment),ge=o(),f(z.$$.fragment),he=o(),M=s("div"),f(J.$$.fragment),Le=o(),j=s("div"),f(S.$$.fragment),Ue=o(),X=s("p"),X.innerHTML=Ye,$e=o(),f(D.$$.fragment),_e=o(),T=s("div"),f(F.$$.fragment),Pe=o(),K=s("p"),K.innerHTML=Ge,We=o(),E=s("div"),f(V.$$.fragment),He=o(),ee=s("p"),ee.innerHTML=Re,ke=o(),f(Y.$$.fragment),ve=o(),C=s("div"),f(G.$$.fragment),Ne=o(),te=s("p"),te.textContent=Qe,Te=o(),f(R.$$.fragment),Be=o(),h=s("div"),f(Q.$$.fragment),Ie=o(),ne=s("p"),ne.innerHTML=qe,Ae=o(),ae=s("p"),ae.textContent=Oe,Ze=o(),oe=s("p"),oe.innerHTML=Xe,ze=o(),f(L.$$.fragment),xe=o(),f(q.$$.fragment),Me=o(),ie=s("p"),this.h()},l(e){const t=ot("svelte-u9bgzb",document.head);c=i(t,"META",{name:!0,content:!0}),t.forEach(n),U=r(e),B=i(e,"P",{}),y(B).forEach(n),_=r(e),d(k.$$.fragment,e),m=r(e),v=i(e,"P",{"data-svelte-h":!0}),$(v)!=="svelte-jgsish"&&(v.innerHTML=Je),ce=r(e),P=i(e,"UL",{"data-svelte-h":!0}),$(P)!=="svelte-l1rjw2"&&(P.innerHTML=Se),fe=r(e),W=i(e,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1x78yqf"&&(W.innerHTML=De),de=r(e),H=i(e,"P",{"data-svelte-h":!0}),$(H)!=="svelte-1jkm1nh"&&(H.textContent=Fe),be=r(e),N=i(e,"UL",{"data-svelte-h":!0}),$(N)!=="svelte-1gaesco"&&(N.innerHTML=Ve),ue=r(e),d(I.$$.fragment,e),pe=r(e),A=i(e,"DIV",{class:!0});var le=y(A);d(Z.$$.fragment,le),le.forEach(n),ge=r(e),d(z.$$.fragment,e),he=r(e),M=i(e,"DIV",{class:!0});var ye=y(M);d(J.$$.fragment,ye),Le=r(ye),j=i(ye,"DIV",{class:!0});var we=y(j);d(S.$$.fragment,we),Ue=r(we),X=i(we,"P",{"data-svelte-h":!0}),$(X)!=="svelte-1iot5zd"&&(X.innerHTML=Ye),we.forEach(n),ye.forEach(n),$e=r(e),d(D.$$.fragment,e),_e=r(e),T=i(e,"DIV",{class:!0});var re=y(T);d(F.$$.fragment,re),Pe=r(re),K=i(re,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1qu9wgw"&&(K.innerHTML=Ge),We=r(re),E=i(re,"DIV",{class:!0});var je=y(E);d(V.$$.fragment,je),He=r(je),ee=i(je,"P",{"data-svelte-h":!0}),$(ee)!=="svelte-1iot5zd"&&(ee.innerHTML=Re),je.forEach(n),re.forEach(n),ke=r(e),d(Y.$$.fragment,e),ve=r(e),C=i(e,"DIV",{class:!0});var Ee=y(C);d(G.$$.fragment,Ee),Ne=r(Ee),te=i(Ee,"P",{"data-svelte-h":!0}),$(te)!=="svelte-9d26yi"&&(te.textContent=Qe),Ee.forEach(n),Te=r(e),d(R.$$.fragment,e),Be=r(e),h=i(e,"DIV",{class:!0});var x=y(h);d(Q.$$.fragment,x),Ie=r(x),ne=i(x,"P",{"data-svelte-h":!0}),$(ne)!=="svelte-wa53i8"&&(ne.innerHTML=qe),Ae=r(x),ae=i(x,"P",{"data-svelte-h":!0}),$(ae)!=="svelte-13l5btx"&&(ae.textContent=Oe),Ze=r(x),oe=i(x,"P",{"data-svelte-h":!0}),$(oe)!=="svelte-1xp2kwr"&&(oe.innerHTML=Xe),ze=r(x),d(L.$$.fragment,x),x.forEach(n),xe=r(e),d(q.$$.fragment,e),Me=r(e),ie=i(e,"P",{}),y(ie).forEach(n),this.h()},h(){w(c,"name","hf:doc:metadata"),w(c,"content",ct),w(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(h,"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,t){l(document.head,c),a(e,U,t),a(e,B,t),a(e,_,t),b(k,e,t),a(e,m,t),a(e,v,t),a(e,ce,t),a(e,P,t),a(e,fe,t),a(e,W,t),a(e,de,t),a(e,H,t),a(e,be,t),a(e,N,t),a(e,ue,t),b(I,e,t),a(e,pe,t),a(e,A,t),b(Z,A,null),a(e,ge,t),b(z,e,t),a(e,he,t),a(e,M,t),b(J,M,null),l(M,Le),l(M,j),b(S,j,null),l(j,Ue),l(j,X),a(e,$e,t),b(D,e,t),a(e,_e,t),a(e,T,t),b(F,T,null),l(T,Pe),l(T,K),l(T,We),l(T,E),b(V,E,null),l(E,He),l(E,ee),a(e,ke,t),b(Y,e,t),a(e,ve,t),a(e,C,t),b(G,C,null),l(C,Ne),l(C,te),a(e,Te,t),b(R,e,t),a(e,Be,t),a(e,h,t),b(Q,h,null),l(h,Ie),l(h,ne),l(h,Ae),l(h,ae),l(h,Ze),l(h,oe),l(h,ze),b(L,h,null),a(e,xe,t),b(q,e,t),a(e,Me,t),a(e,ie,t),Ce=!0},p(e,[t]){const le={};t&2&&(le.$$scope={dirty:t,ctx:e}),L.$set(le)},i(e){Ce||(u(k.$$.fragment,e),u(I.$$.fragment,e),u(Z.$$.fragment,e),u(z.$$.fragment,e),u(J.$$.fragment,e),u(S.$$.fragment,e),u(D.$$.fragment,e),u(F.$$.fragment,e),u(V.$$.fragment,e),u(Y.$$.fragment,e),u(G.$$.fragment,e),u(R.$$.fragment,e),u(Q.$$.fragment,e),u(L.$$.fragment,e),u(q.$$.fragment,e),Ce=!0)},o(e){p(k.$$.fragment,e),p(I.$$.fragment,e),p(Z.$$.fragment,e),p(z.$$.fragment,e),p(J.$$.fragment,e),p(S.$$.fragment,e),p(D.$$.fragment,e),p(F.$$.fragment,e),p(V.$$.fragment,e),p(Y.$$.fragment,e),p(G.$$.fragment,e),p(R.$$.fragment,e),p(Q.$$.fragment,e),p(L.$$.fragment,e),p(q.$$.fragment,e),Ce=!1},d(e){e&&(n(U),n(B),n(_),n(m),n(v),n(ce),n(P),n(fe),n(W),n(de),n(H),n(be),n(N),n(ue),n(pe),n(A),n(ge),n(he),n(M),n($e),n(_e),n(T),n(ke),n(ve),n(C),n(Te),n(Be),n(h),n(xe),n(Me),n(ie)),n(c),g(k,e),g(I,e),g(Z),g(z,e),g(J),g(S),g(D,e),g(F),g(V),g(Y,e),g(G),g(R,e),g(Q),g(L),g(q,e)}}}const ct='{"title":"Backbone","local":"backbone","sections":[{"title":"AutoBackbone","local":"transformers.AutoBackbone","sections":[],"depth":2},{"title":"BackboneMixin","local":"transformers.utils.BackboneMixin","sections":[],"depth":2},{"title":"BackboneConfigMixin","local":"transformers.utils.BackboneConfigMixin","sections":[],"depth":2},{"title":"TimmBackbone","local":"transformers.TimmBackbone","sections":[],"depth":2},{"title":"TimmBackboneConfig","local":"transformers.TimmBackboneConfig","sections":[],"depth":2}],"depth":1}';function ft(me){return et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $t extends nt{constructor(c){super(),at(this,c,ft,mt,Ke,{})}}export{$t as component};
