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 m,a,v as b,d as u,t as g,w as p}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 mt(le){let c,U="Example:",B,k,_;return k=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(k.$$.fragment)},l(l){c=i(l,"P",{"data-svelte-h":!0}),$(c)!=="svelte-11lpom8"&&(c.textContent=U),B=r(l),d(k.$$.fragment,l)},m(l,v){a(l,c,v),a(l,B,v),b(k,l,v),_=!0},p:tt,i(l){_||(u(k.$$.fragment,l),_=!0)},o(l){g(k.$$.fragment,l),_=!1},d(l){l&&(n(c),n(B)),p(k,l)}}}function lt(le){let c,U,B,k,_,l,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/main/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/main/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/main/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/main/en/main_classes/backbones#transformers.TimmBackbone">TimmBackbone</a> and <a href="/docs/transformers/main/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,ge,A,Z,pe,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,ke,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.`,_e,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/main/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/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ze,L,xe,q,Me,ie,Ce;return _=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/main/src/transformers/models/auto/modeling_auto.py#L1878"}}),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/main/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/main/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/main/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/main/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/main/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/main/src/transformers/models/timm_backbone/configuration_timm_backbone.py#L25"}}),L=new st({props:{anchor:"transformers.TimmBackboneConfig.example",$$slots:{default:[mt]},$$scope:{ctx:le}}}),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"),k=o(),f(_.$$.fragment),l=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),ge=o(),A=s("div"),f(Z.$$.fragment),pe=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),ke=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,_e=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),k=r(e),d(_.$$.fragment,e),l=r(e),v=i(e,"P",{"data-svelte-h":!0}),$(v)!=="svelte-17uwlhg"&&(v.innerHTML=Je),ce=r(e),P=i(e,"UL",{"data-svelte-h":!0}),$(P)!=="svelte-1ok1ps0"&&(P.innerHTML=Se),fe=r(e),W=i(e,"P",{"data-svelte-h":!0}),$(W)!=="svelte-unk4ov"&&(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),ge=r(e),A=i(e,"DIV",{class:!0});var me=y(A);d(Z.$$.fragment,me),me.forEach(n),pe=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),ke=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),_e=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-1t02wit"&&(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-o55m63"&&(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){m(document.head,c),a(e,U,t),a(e,B,t),a(e,k,t),b(_,e,t),a(e,l,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,ge,t),a(e,A,t),b(Z,A,null),a(e,pe,t),b(z,e,t),a(e,he,t),a(e,M,t),b(J,M,null),m(M,Le),m(M,j),b(S,j,null),m(j,Ue),m(j,X),a(e,$e,t),b(D,e,t),a(e,ke,t),a(e,T,t),b(F,T,null),m(T,Pe),m(T,K),m(T,We),m(T,E),b(V,E,null),m(E,He),m(E,ee),a(e,_e,t),b(Y,e,t),a(e,ve,t),a(e,C,t),b(G,C,null),m(C,Ne),m(C,te),a(e,Te,t),b(R,e,t),a(e,Be,t),a(e,h,t),b(Q,h,null),m(h,Ie),m(h,ne),m(h,Ae),m(h,ae),m(h,Ze),m(h,oe),m(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 me={};t&2&&(me.$$scope={dirty:t,ctx:e}),L.$set(me)},i(e){Ce||(u(_.$$.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){g(_.$$.fragment,e),g(I.$$.fragment,e),g(Z.$$.fragment,e),g(z.$$.fragment,e),g(J.$$.fragment,e),g(S.$$.fragment,e),g(D.$$.fragment,e),g(F.$$.fragment,e),g(V.$$.fragment,e),g(Y.$$.fragment,e),g(G.$$.fragment,e),g(R.$$.fragment,e),g(Q.$$.fragment,e),g(L.$$.fragment,e),g(q.$$.fragment,e),Ce=!1},d(e){e&&(n(U),n(B),n(k),n(l),n(v),n(ce),n(P),n(fe),n(W),n(de),n(H),n(be),n(N),n(ue),n(ge),n(A),n(pe),n(he),n(M),n($e),n(ke),n(T),n(_e),n(ve),n(C),n(Te),n(Be),n(h),n(xe),n(Me),n(ie)),n(c),p(_,e),p(I,e),p(Z),p(z,e),p(J),p(S),p(D,e),p(F),p(V),p(Y,e),p(G),p(R,e),p(Q),p(L),p(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(le){return et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $t extends nt{constructor(c){super(),at(this,c,ft,lt,Ke,{})}}export{$t as component};
