import{s as Xe,o as Oe,n as Ke}from"../chunks/scheduler.9bc65507.js";import{S as et,i as tt,g as s,s as o,r as d,A as nt,h as i,f as t,c as r,j as y,u,x as $,k as w,y as l,a,v as b,d as p,t as g,w as h}from"../chunks/index.707bf1b6.js";import{D as q}from"../chunks/Docstring.17db21ae.js";import{C as at}from"../chunks/CodeBlock.54a9f38d.js";import{E as ot}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as re}from"../chunks/Heading.342b1fa6.js";function rt(le){let c,E="Example:",B,k,_;return k=new at({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=E,B=o(),d(k.$$.fragment)},l(m){c=i(m,"P",{"data-svelte-h":!0}),$(c)!=="svelte-11lpom8"&&(c.textContent=E),B=r(m),u(k.$$.fragment,m)},m(m,v){a(m,c,v),a(m,B,v),b(k,m,v),_=!0},p:Ke,i(m){_||(p(k.$$.fragment,m),_=!0)},o(m){g(k.$$.fragment,m),_=!1},d(m){m&&(t(c),t(B)),h(k,m)}}}function st(le){let c,E,B,k,_,m,v,ze='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/v4.39.1/en/main_classes/backbones#transformers.AutoBackbone">AutoBackbone</a> class for initializing a Transformers backbone from pretrained model weights, and two utility classes:',me,P,Ze='<li><a href="/docs/transformers/v4.39.1/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/v4.39.1/en/main_classes/backbones#transformers.utils.BackboneConfigMixin">BackboneConfigMixin</a> sets the output features and indices of the backbone configuration.</li>',ce,W,Je='<a href="https://hf.co/docs/timm/index" rel="nofollow">timm</a> models are loaded with the <a href="/docs/transformers/v4.39.1/en/main_classes/backbones#transformers.TimmBackbone">TimmBackbone</a> and <a href="/docs/transformers/v4.39.1/en/main_classes/backbones#transformers.TimmBackboneConfig">TimmBackboneConfig</a> classes.',fe,H,Se="Backbones are supported for the following models:",de,N,De='<li><a href="..model_doc/beit">BEiT</a></li> <li><a href="../model_doc/bit">BiT</a></li> <li><a href="../model_doc/convnext">ConvNet</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,be,A,z,pe,Z,ge,M,J,je,j,S,Le,X,Fe=`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.`,he,D,$e,T,F,Ue,O,Ve="A Mixin to support handling the <code>out_features</code> and <code>out_indices</code> attributes for the backbone configurations.",Ee,L,V,Pe,K,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.`,ke,Y,_e,C,R,We,ee,Re=`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.`,ve,G,Te,f,Q,He,te,Ge='This is the configuration class to store the configuration for a timm backbone <a href="/docs/transformers/v4.39.1/en/main_classes/backbones#transformers.TimmBackbone">TimmBackbone</a>.',Ne,ne,Qe="It is used to instantiate a timm backbone model according to the specified arguments, defining the model.",Ie,ae,qe=`Configuration objects inherit from <a href="/docs/transformers/v4.39.1/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/v4.39.1/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ae,U,Be,se,xe;return _=new re({props:{title:"Backbone",local:"backbone",headingTag:"h1"}}),I=new re({props:{title:"AutoBackbone",local:"transformers.AutoBackbone",headingTag:"h2"}}),z=new q({props:{name:"class transformers.AutoBackbone",anchor:"transformers.AutoBackbone",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/models/auto/modeling_auto.py#L1655"}}),Z=new re({props:{title:"BackboneMixin",local:"transformers.utils.BackboneMixin",headingTag:"h2"}}),J=new q({props:{name:"class transformers.utils.BackboneMixin",anchor:"transformers.utils.BackboneMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/utils/backbone_utils.py#L135"}}),S=new q({props:{name:"to_dict",anchor:"transformers.utils.BackboneMixin.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/utils/backbone_utils.py#L238"}}),D=new re({props:{title:"BackboneConfigMixin",local:"transformers.utils.BackboneConfigMixin",headingTag:"h2"}}),F=new q({props:{name:"class transformers.utils.BackboneConfigMixin",anchor:"transformers.utils.BackboneConfigMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/utils/backbone_utils.py#L249"}}),V=new q({props:{name:"to_dict",anchor:"transformers.utils.BackboneConfigMixin.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/utils/backbone_utils.py#L280"}}),Y=new re({props:{title:"TimmBackbone",local:"transformers.TimmBackbone",headingTag:"h2"}}),R=new q({props:{name:"class transformers.TimmBackbone",anchor:"transformers.TimmBackbone",parameters:[{name:"config",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.39.1/src/transformers/models/timm_backbone/modeling_timm_backbone.py#L35"}}),G=new re({props:{title:"TimmBackboneConfig",local:"transformers.TimmBackboneConfig",headingTag:"h2"}}),Q=new q({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/v4.39.1/src/transformers/models/timm_backbone/configuration_timm_backbone.py#L25"}}),U=new ot({props:{anchor:"transformers.TimmBackboneConfig.example",$$slots:{default:[rt]},$$scope:{ctx:le}}}),{c(){c=s("meta"),E=o(),B=s("p"),k=o(),d(_.$$.fragment),m=o(),v=s("p"),v.innerHTML=ze,me=o(),P=s("ul"),P.innerHTML=Ze,ce=o(),W=s("p"),W.innerHTML=Je,fe=o(),H=s("p"),H.textContent=Se,de=o(),N=s("ul"),N.innerHTML=De,ue=o(),d(I.$$.fragment),be=o(),A=s("div"),d(z.$$.fragment),pe=o(),d(Z.$$.fragment),ge=o(),M=s("div"),d(J.$$.fragment),je=o(),j=s("div"),d(S.$$.fragment),Le=o(),X=s("p"),X.innerHTML=Fe,he=o(),d(D.$$.fragment),$e=o(),T=s("div"),d(F.$$.fragment),Ue=o(),O=s("p"),O.innerHTML=Ve,Ee=o(),L=s("div"),d(V.$$.fragment),Pe=o(),K=s("p"),K.innerHTML=Ye,ke=o(),d(Y.$$.fragment),_e=o(),C=s("div"),d(R.$$.fragment),We=o(),ee=s("p"),ee.textContent=Re,ve=o(),d(G.$$.fragment),Te=o(),f=s("div"),d(Q.$$.fragment),He=o(),te=s("p"),te.innerHTML=Ge,Ne=o(),ne=s("p"),ne.textContent=Qe,Ie=o(),ae=s("p"),ae.innerHTML=qe,Ae=o(),d(U.$$.fragment),Be=o(),se=s("p"),this.h()},l(e){const n=nt("svelte-u9bgzb",document.head);c=i(n,"META",{name:!0,content:!0}),n.forEach(t),E=r(e),B=i(e,"P",{}),y(B).forEach(t),k=r(e),u(_.$$.fragment,e),m=r(e),v=i(e,"P",{"data-svelte-h":!0}),$(v)!=="svelte-142t6za"&&(v.innerHTML=ze),me=r(e),P=i(e,"UL",{"data-svelte-h":!0}),$(P)!=="svelte-2kuwuo"&&(P.innerHTML=Ze),ce=r(e),W=i(e,"P",{"data-svelte-h":!0}),$(W)!=="svelte-bgunqf"&&(W.innerHTML=Je),fe=r(e),H=i(e,"P",{"data-svelte-h":!0}),$(H)!=="svelte-1jkm1nh"&&(H.textContent=Se),de=r(e),N=i(e,"UL",{"data-svelte-h":!0}),$(N)!=="svelte-17e37fu"&&(N.innerHTML=De),ue=r(e),u(I.$$.fragment,e),be=r(e),A=i(e,"DIV",{class:!0});var ie=y(A);u(z.$$.fragment,ie),ie.forEach(t),pe=r(e),u(Z.$$.fragment,e),ge=r(e),M=i(e,"DIV",{class:!0});var Me=y(M);u(J.$$.fragment,Me),je=r(Me),j=i(Me,"DIV",{class:!0});var Ce=y(j);u(S.$$.fragment,Ce),Le=r(Ce),X=i(Ce,"P",{"data-svelte-h":!0}),$(X)!=="svelte-1iot5zd"&&(X.innerHTML=Fe),Ce.forEach(t),Me.forEach(t),he=r(e),u(D.$$.fragment,e),$e=r(e),T=i(e,"DIV",{class:!0});var oe=y(T);u(F.$$.fragment,oe),Ue=r(oe),O=i(oe,"P",{"data-svelte-h":!0}),$(O)!=="svelte-1qu9wgw"&&(O.innerHTML=Ve),Ee=r(oe),L=i(oe,"DIV",{class:!0});var ye=y(L);u(V.$$.fragment,ye),Pe=r(ye),K=i(ye,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1iot5zd"&&(K.innerHTML=Ye),ye.forEach(t),oe.forEach(t),ke=r(e),u(Y.$$.fragment,e),_e=r(e),C=i(e,"DIV",{class:!0});var we=y(C);u(R.$$.fragment,we),We=r(we),ee=i(we,"P",{"data-svelte-h":!0}),$(ee)!=="svelte-9d26yi"&&(ee.textContent=Re),we.forEach(t),ve=r(e),u(G.$$.fragment,e),Te=r(e),f=i(e,"DIV",{class:!0});var x=y(f);u(Q.$$.fragment,x),He=r(x),te=i(x,"P",{"data-svelte-h":!0}),$(te)!=="svelte-7m1r41"&&(te.innerHTML=Ge),Ne=r(x),ne=i(x,"P",{"data-svelte-h":!0}),$(ne)!=="svelte-13l5btx"&&(ne.textContent=Qe),Ie=r(x),ae=i(x,"P",{"data-svelte-h":!0}),$(ae)!=="svelte-1nrxf0l"&&(ae.innerHTML=qe),Ae=r(x),u(U.$$.fragment,x),x.forEach(t),Be=r(e),se=i(e,"P",{}),y(se).forEach(t),this.h()},h(){w(c,"name","hf:doc:metadata"),w(c,"content",it),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(L,"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(f,"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,n){l(document.head,c),a(e,E,n),a(e,B,n),a(e,k,n),b(_,e,n),a(e,m,n),a(e,v,n),a(e,me,n),a(e,P,n),a(e,ce,n),a(e,W,n),a(e,fe,n),a(e,H,n),a(e,de,n),a(e,N,n),a(e,ue,n),b(I,e,n),a(e,be,n),a(e,A,n),b(z,A,null),a(e,pe,n),b(Z,e,n),a(e,ge,n),a(e,M,n),b(J,M,null),l(M,je),l(M,j),b(S,j,null),l(j,Le),l(j,X),a(e,he,n),b(D,e,n),a(e,$e,n),a(e,T,n),b(F,T,null),l(T,Ue),l(T,O),l(T,Ee),l(T,L),b(V,L,null),l(L,Pe),l(L,K),a(e,ke,n),b(Y,e,n),a(e,_e,n),a(e,C,n),b(R,C,null),l(C,We),l(C,ee),a(e,ve,n),b(G,e,n),a(e,Te,n),a(e,f,n),b(Q,f,null),l(f,He),l(f,te),l(f,Ne),l(f,ne),l(f,Ie),l(f,ae),l(f,Ae),b(U,f,null),a(e,Be,n),a(e,se,n),xe=!0},p(e,[n]){const ie={};n&2&&(ie.$$scope={dirty:n,ctx:e}),U.$set(ie)},i(e){xe||(p(_.$$.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(R.$$.fragment,e),p(G.$$.fragment,e),p(Q.$$.fragment,e),p(U.$$.fragment,e),xe=!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(R.$$.fragment,e),g(G.$$.fragment,e),g(Q.$$.fragment,e),g(U.$$.fragment,e),xe=!1},d(e){e&&(t(E),t(B),t(k),t(m),t(v),t(me),t(P),t(ce),t(W),t(fe),t(H),t(de),t(N),t(ue),t(be),t(A),t(pe),t(ge),t(M),t(he),t($e),t(T),t(ke),t(_e),t(C),t(ve),t(Te),t(f),t(Be),t(se)),t(c),h(_,e),h(I,e),h(z),h(Z,e),h(J),h(S),h(D,e),h(F),h(V),h(Y,e),h(R),h(G,e),h(Q),h(U)}}}const it='{"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 lt(le){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pt extends et{constructor(c){super(),tt(this,c,lt,st,Xe,{})}}export{pt as component};
