import{S as Wa,i as Ua,s as Va,e as r,k as m,w,t as n,M as Ha,c as a,d as o,m as p,a as s,x as y,h as i,b as c,G as t,g as f,y as $,q as B,o as T,B as I,v as Ga,L as Hr}from"../../chunks/vendor-hf-doc-builder.js";import{T as Oa}from"../../chunks/Tip-hf-doc-builder.js";import{D as De}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Gr}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Se}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Vr}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Ja}from"../../chunks/PipelineTag-hf-doc-builder.js";function Ya(C){let h,b,_,g,v;return g=new Gr({props:{code:`from transformers import BitConfig, BitModel

# Initializing a BiT bit-50 style configuration
configuration = BitConfig()

# Initializing a model (with random weights) from the bit-50 style configuration
model = BitModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitConfig, BitModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BiT bit-50 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = BitConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the bit-50 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BitModel(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(){h=r("p"),b=n("Example:"),_=m(),w(g.$$.fragment)},l(l){h=a(l,"P",{});var u=s(h);b=i(u,"Example:"),u.forEach(o),_=p(l),y(g.$$.fragment,l)},m(l,u){f(l,h,u),t(h,b),f(l,_,u),$(g,l,u),v=!0},p:Hr,i(l){v||(B(g.$$.fragment,l),v=!0)},o(l){T(g.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),I(g,l)}}}function Xa(C){let h,b,_,g,v;return{c(){h=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),v=n(`
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(l){h=a(l,"P",{});var u=s(h);b=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var A=s(_);g=i(A,"Module"),A.forEach(o),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){f(l,h,u),t(h,b),t(h,_),t(_,g),t(h,v)},d(l){l&&o(h)}}}function Ka(C){let h,b,_,g,v;return g=new Gr({props:{code:`from transformers import AutoImageProcessor, BitModel
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("google/bit-50")
model = BitModel.from_pretrained("google/bit-50")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, BitModel
<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;google/bit-50&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BitModel.from_pretrained(<span class="hljs-string">&quot;google/bit-50&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">2048</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`}}),{c(){h=r("p"),b=n("Example:"),_=m(),w(g.$$.fragment)},l(l){h=a(l,"P",{});var u=s(h);b=i(u,"Example:"),u.forEach(o),_=p(l),y(g.$$.fragment,l)},m(l,u){f(l,h,u),t(h,b),f(l,_,u),$(g,l,u),v=!0},p:Hr,i(l){v||(B(g.$$.fragment,l),v=!0)},o(l){T(g.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),I(g,l)}}}function Za(C){let h,b,_,g,v;return{c(){h=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),v=n(`
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(l){h=a(l,"P",{});var u=s(h);b=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var A=s(_);g=i(A,"Module"),A.forEach(o),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){f(l,h,u),t(h,b),t(h,_),t(_,g),t(h,v)},d(l){l&&o(h)}}}function Qa(C){let h,b,_,g,v;return g=new Gr({props:{code:`from transformers import AutoImageProcessor, BitForImageClassification
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("google/bit-50")
model = BitForImageClassification.from_pretrained("google/bit-50")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, BitForImageClassification
<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;google/bit-50&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BitForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/bit-50&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])
tiger cat`}}),{c(){h=r("p"),b=n("Example:"),_=m(),w(g.$$.fragment)},l(l){h=a(l,"P",{});var u=s(h);b=i(u,"Example:"),u.forEach(o),_=p(l),y(g.$$.fragment,l)},m(l,u){f(l,h,u),t(h,b),f(l,_,u),$(g,l,u),v=!0},p:Hr,i(l){v||(B(g.$$.fragment,l),v=!0)},o(l){T(g.$$.fragment,l),v=!1},d(l){l&&o(h),l&&o(_),I(g,l)}}}function es(C){let h,b,_,g,v,l,u,A,co,jt,q,J,pt,me,mo,ft,po,Nt,N,fo,pe,ho,go,Oe,uo,_o,Mt,We,vo,Ft,Ue,ht,bo,qt,Ve,wo,Rt,He,R,yo,fe,$o,Bo,he,To,Io,Lt,M,Po,ge,xo,Co,ue,Eo,zo,Dt,L,Y,gt,_e,Ao,ut,ko,St,Ge,jo,Ot,ve,Wt,X,F,Je,No,Mo,be,Fo,qo,we,Ro,Lo,Do,Ye,So,Xe,Oo,Ut,Ke,Wo,Vt,D,K,_t,ye,Uo,vt,Vo,Ht,P,$e,Ho,S,Go,Ze,Jo,Yo,Be,Xo,Ko,Zo,O,Qo,Qe,er,tr,et,or,rr,ar,Z,Gt,W,Q,bt,Te,sr,wt,nr,Jt,k,Ie,ir,yt,lr,cr,ee,Pe,dr,$t,mr,Yt,U,te,Bt,xe,pr,Tt,fr,Xt,j,Ce,hr,Ee,gr,ze,ur,_r,vr,E,Ae,br,V,wr,tt,yr,$r,It,Br,Tr,Ir,oe,Pr,re,Kt,H,ae,Pt,ke,xr,xt,Cr,Zt,x,je,Er,Ct,zr,Ar,Ne,kr,Me,jr,Nr,Mr,z,Fe,Fr,G,qr,ot,Rr,Lr,Et,Dr,Sr,Or,se,Wr,ne,Qt;return l=new Se({}),me=new Se({}),_e=new Se({}),ve=new Ja({props:{pipeline:"image-classification"}}),ye=new Se({}),$e=new De({props:{name:"class transformers.BitConfig",anchor:"transformers.BitConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"embedding_size",val:" = 64"},{name:"hidden_sizes",val:" = [256, 512, 1024, 2048]"},{name:"depths",val:" = [3, 4, 6, 3]"},{name:"layer_type",val:" = 'preactivation'"},{name:"hidden_act",val:" = 'relu'"},{name:"global_padding",val:" = None"},{name:"num_groups",val:" = 32"},{name:"drop_path_rate",val:" = 0.0"},{name:"embedding_dynamic_padding",val:" = False"},{name:"output_stride",val:" = 32"},{name:"width_factor",val:" = 1"},{name:"out_features",val:" = None"},{name:"out_indices",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BitConfig.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.BitConfig.embedding_size",description:`<strong>embedding_size</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality (hidden size) for the embedding layer.`,name:"embedding_size"},{anchor:"transformers.BitConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[256, 512, 1024, 2048]</code>) &#x2014;
Dimensionality (hidden size) at each stage.`,name:"hidden_sizes"},{anchor:"transformers.BitConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 4, 6, 3]</code>) &#x2014;
Depth (number of layers) for each stage.`,name:"depths"},{anchor:"transformers.BitConfig.layer_type",description:`<strong>layer_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;preactivation&quot;</code>) &#x2014;
The layer to use, it can be either <code>&quot;preactivation&quot;</code> or <code>&quot;bottleneck&quot;</code>.`,name:"layer_type"},{anchor:"transformers.BitConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The non-linear activation function in each block. 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.BitConfig.global_padding",description:`<strong>global_padding</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Padding strategy to use for the convolutional layers. Can be either <code>&quot;valid&quot;</code>, <code>&quot;same&quot;</code>, or <code>None</code>.`,name:"global_padding"},{anchor:"transformers.BitConfig.num_groups",description:`<strong>num_groups</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) &#x2014;
Number of groups used for the <code>BitGroupNormActivation</code> layers.`,name:"num_groups"},{anchor:"transformers.BitConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The drop path rate for the stochastic depth.`,name:"drop_path_rate"},{anchor:"transformers.BitConfig.embedding_dynamic_padding",description:`<strong>embedding_dynamic_padding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to make use of dynamic padding for the embedding layer.`,name:"embedding_dynamic_padding"},{anchor:"transformers.BitConfig.output_stride",description:`<strong>output_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The output stride of the model.`,name:"output_stride"},{anchor:"transformers.BitConfig.width_factor",description:`<strong>width_factor</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The width factor for the model.`,name:"width_factor"},{anchor:"transformers.BitConfig.out_features",description:`<strong>out_features</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of features to output. Can be any of <code>&quot;stem&quot;</code>, <code>&quot;stage1&quot;</code>, <code>&quot;stage2&quot;</code>, etc.
(depending on how many stages the model has). If unset and <code>out_indices</code> is set, will default to the
corresponding stages. If unset and <code>out_indices</code> is unset, will default to the last stage.`,name:"out_features"},{anchor:"transformers.BitConfig.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). If unset and <code>out_features</code> is set, will default to the corresponding stages.
If unset and <code>out_features</code> is unset, will default to the last stage.`,name:"out_indices"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bit/configuration_bit.py#L29"}}),Z=new Vr({props:{anchor:"transformers.BitConfig.example",$$slots:{default:[Ya]},$$scope:{ctx:C}}}),Te=new Se({}),Ie=new De({props:{name:"class transformers.BitImageProcessor",anchor:"transformers.BitImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BitImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.BitImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.BitImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.BitImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.BitImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to 224) &#x2014;
Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code>
method.`,name:"crop_size"},{anchor:"transformers.BitImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.BitImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.BitImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.BitImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.BitImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bit/image_processing_bit.py#L51"}}),Pe=new De({props:{name:"preprocess",anchor:"transformers.BitImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": int = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BitImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.BitImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.BitImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.BitImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.BitImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.BitImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.BitImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.BitImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.BitImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.BitImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.BitImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.BitImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.BitImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.BitImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bit/image_processing_bit.py#L219"}}),xe=new Se({}),Ce=new De({props:{name:"class transformers.BitModel",anchor:"transformers.BitModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BitModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitConfig">BitConfig</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.29.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.29.0/src/transformers/models/bit/modeling_bit.py#L706"}}),Ae=new De({props:{name:"forward",anchor:"transformers.BitModel.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BitModel.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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BitImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.BitModel.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.BitModel.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.29.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.29.0/src/transformers/models/bit/modeling_bit.py#L724",returnDescription:`
<p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> 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.29.0/en/model_doc/bit#transformers.BitConfig"
>BitConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</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 after a pooling operation on the spatial dimensions.</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, num_channels, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oe=new Oa({props:{$$slots:{default:[Xa]},$$scope:{ctx:C}}}),re=new Vr({props:{anchor:"transformers.BitModel.forward.example",$$slots:{default:[Ka]},$$scope:{ctx:C}}}),ke=new Se({}),je=new De({props:{name:"class transformers.BitForImageClassification",anchor:"transformers.BitForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.BitForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitConfig">BitConfig</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.29.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.29.0/src/transformers/models/bit/modeling_bit.py#L769"}}),Fe=new De({props:{name:"forward",anchor:"transformers.BitForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.BitForImageClassification.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.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">BitImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.BitForImageClassification.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.BitForImageClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.BitForImageClassification.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 &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/bit/modeling_bit.py#L782",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</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.29.0/en/model_doc/bit#transformers.BitConfig"
>BitConfig</a>) and inputs.</p>
<ul>
<li><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.</li>
<li><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).</li>
<li><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, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new Oa({props:{$$slots:{default:[Za]},$$scope:{ctx:C}}}),ne=new Vr({props:{anchor:"transformers.BitForImageClassification.forward.example",$$slots:{default:[Qa]},$$scope:{ctx:C}}}),{c(){h=r("meta"),b=m(),_=r("h1"),g=r("a"),v=r("span"),w(l.$$.fragment),u=m(),A=r("span"),co=n("Big Transfer (BiT)"),jt=m(),q=r("h2"),J=r("a"),pt=r("span"),w(me.$$.fragment),mo=m(),ft=r("span"),po=n("Overview"),Nt=m(),N=r("p"),fo=n("The BiT model was proposed in "),pe=r("a"),ho=n("Big Transfer (BiT): General Visual Representation Learning"),go=n(` by Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil Houlsby.
BiT is a simple recipe for scaling up pre-training of `),Oe=r("a"),uo=n("ResNet"),_o=n("-like architectures (specifically, ResNetv2). The method results in significant improvements for transfer learning."),Mt=m(),We=r("p"),vo=n("The abstract from the paper is the following:"),Ft=m(),Ue=r("p"),ht=r("em"),bo=n("Transfer of pre-trained representations improves sample efficiency and simplifies hyperparameter tuning when training deep neural networks for vision. We revisit the paradigm of pre-training on large supervised datasets and fine-tuning the model on a target task. We scale up pre-training, and propose a simple recipe that we call Big Transfer (BiT). By combining a few carefully selected components, and transferring using a simple heuristic, we achieve strong performance on over 20 datasets. BiT performs well across a surprisingly wide range of data regimes \u2014 from 1 example per class to 1M total examples. BiT achieves 87.5% top-1 accuracy on ILSVRC-2012, 99.4% on CIFAR-10, and 76.3% on the 19 task Visual Task Adaptation Benchmark (VTAB). On small datasets, BiT attains 76.8% on ILSVRC-2012 with 10 examples per class, and 97.0% on CIFAR-10 with 10 examples per class. We conduct detailed analysis of the main components that lead to high transfer performance."),qt=m(),Ve=r("p"),wo=n("Tips:"),Rt=m(),He=r("ul"),R=r("li"),yo=n("BiT models are equivalent to ResNetv2 in terms of architecture, except that: 1) all batch normalization layers are replaced by "),fe=r("a"),$o=n("group normalization"),Bo=n(`,
2) `),he=r("a"),To=n("weight standardization"),Io=n(` is used for convolutional layers. The authors show that the combination of both is useful for training with large batch sizes, and has a significant
impact on transfer learning.`),Lt=m(),M=r("p"),Po=n("This model was contributed by "),ge=r("a"),xo=n("nielsr"),Co=n(`.
The original code can be found `),ue=r("a"),Eo=n("here"),zo=n("."),Dt=m(),L=r("h2"),Y=r("a"),gt=r("span"),w(_e.$$.fragment),Ao=m(),ut=r("span"),ko=n("Resources"),St=m(),Ge=r("p"),jo=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with BiT."),Ot=m(),w(ve.$$.fragment),Wt=m(),X=r("ul"),F=r("li"),Je=r("a"),No=n("BitForImageClassification"),Mo=n(" is supported by this "),be=r("a"),Fo=n("example script"),qo=n(" and "),we=r("a"),Ro=n("notebook"),Lo=n("."),Do=m(),Ye=r("li"),So=n("See also: "),Xe=r("a"),Oo=n("Image classification task guide"),Ut=m(),Ke=r("p"),Wo=n("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Vt=m(),D=r("h2"),K=r("a"),_t=r("span"),w(ye.$$.fragment),Uo=m(),vt=r("span"),Vo=n("BitConfig"),Ht=m(),P=r("div"),w($e.$$.fragment),Ho=m(),S=r("p"),Go=n("This is the configuration class to store the configuration of a "),Ze=r("a"),Jo=n("BitModel"),Yo=n(`. It is used to instantiate an BiT
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 BiT
`),Be=r("a"),Xo=n("google/bit-50"),Ko=n(" architecture."),Zo=m(),O=r("p"),Qo=n("Configuration objects inherit from "),Qe=r("a"),er=n("PretrainedConfig"),tr=n(` and can be used to control the model outputs. Read the
documentation from `),et=r("a"),or=n("PretrainedConfig"),rr=n(" for more information."),ar=m(),w(Z.$$.fragment),Gt=m(),W=r("h2"),Q=r("a"),bt=r("span"),w(Te.$$.fragment),sr=m(),wt=r("span"),nr=n("BitImageProcessor"),Jt=m(),k=r("div"),w(Ie.$$.fragment),ir=m(),yt=r("p"),lr=n("Constructs a BiT image processor."),cr=m(),ee=r("div"),w(Pe.$$.fragment),dr=m(),$t=r("p"),mr=n("Preprocess an image or batch of images."),Yt=m(),U=r("h2"),te=r("a"),Bt=r("span"),w(xe.$$.fragment),pr=m(),Tt=r("span"),fr=n("BitModel"),Xt=m(),j=r("div"),w(Ce.$$.fragment),hr=m(),Ee=r("p"),gr=n(`The bare BiT model outputting raw features without any specific head on top.
This model is a PyTorch `),ze=r("a"),ur=n("torch.nn.Module"),_r=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),vr=m(),E=r("div"),w(Ae.$$.fragment),br=m(),V=r("p"),wr=n("The "),tt=r("a"),yr=n("BitModel"),$r=n(" forward method, overrides the "),It=r("code"),Br=n("__call__"),Tr=n(" special method."),Ir=m(),w(oe.$$.fragment),Pr=m(),w(re.$$.fragment),Kt=m(),H=r("h2"),ae=r("a"),Pt=r("span"),w(ke.$$.fragment),xr=m(),xt=r("span"),Cr=n("BitForImageClassification"),Zt=m(),x=r("div"),w(je.$$.fragment),Er=m(),Ct=r("p"),zr=n(`BiT Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),Ar=m(),Ne=r("p"),kr=n("This model is a PyTorch "),Me=r("a"),jr=n("torch.nn.Module"),Nr=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Mr=m(),z=r("div"),w(Fe.$$.fragment),Fr=m(),G=r("p"),qr=n("The "),ot=r("a"),Rr=n("BitForImageClassification"),Lr=n(" forward method, overrides the "),Et=r("code"),Dr=n("__call__"),Sr=n(" special method."),Or=m(),w(se.$$.fragment),Wr=m(),w(ne.$$.fragment),this.h()},l(e){const d=Ha('[data-svelte="svelte-1phssyn"]',document.head);h=a(d,"META",{name:!0,content:!0}),d.forEach(o),b=p(e),_=a(e,"H1",{class:!0});var qe=s(_);g=a(qe,"A",{id:!0,class:!0,href:!0});var zt=s(g);v=a(zt,"SPAN",{});var At=s(v);y(l.$$.fragment,At),At.forEach(o),zt.forEach(o),u=p(qe),A=a(qe,"SPAN",{});var kt=s(A);co=i(kt,"Big Transfer (BiT)"),kt.forEach(o),qe.forEach(o),jt=p(e),q=a(e,"H2",{class:!0});var Re=s(q);J=a(Re,"A",{id:!0,class:!0,href:!0});var Jr=s(J);pt=a(Jr,"SPAN",{});var Yr=s(pt);y(me.$$.fragment,Yr),Yr.forEach(o),Jr.forEach(o),mo=p(Re),ft=a(Re,"SPAN",{});var Xr=s(ft);po=i(Xr,"Overview"),Xr.forEach(o),Re.forEach(o),Nt=p(e),N=a(e,"P",{});var rt=s(N);fo=i(rt,"The BiT model was proposed in "),pe=a(rt,"A",{href:!0,rel:!0});var Kr=s(pe);ho=i(Kr,"Big Transfer (BiT): General Visual Representation Learning"),Kr.forEach(o),go=i(rt,` by Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil Houlsby.
BiT is a simple recipe for scaling up pre-training of `),Oe=a(rt,"A",{href:!0});var Zr=s(Oe);uo=i(Zr,"ResNet"),Zr.forEach(o),_o=i(rt,"-like architectures (specifically, ResNetv2). The method results in significant improvements for transfer learning."),rt.forEach(o),Mt=p(e),We=a(e,"P",{});var Qr=s(We);vo=i(Qr,"The abstract from the paper is the following:"),Qr.forEach(o),Ft=p(e),Ue=a(e,"P",{});var ea=s(Ue);ht=a(ea,"EM",{});var ta=s(ht);bo=i(ta,"Transfer of pre-trained representations improves sample efficiency and simplifies hyperparameter tuning when training deep neural networks for vision. We revisit the paradigm of pre-training on large supervised datasets and fine-tuning the model on a target task. We scale up pre-training, and propose a simple recipe that we call Big Transfer (BiT). By combining a few carefully selected components, and transferring using a simple heuristic, we achieve strong performance on over 20 datasets. BiT performs well across a surprisingly wide range of data regimes \u2014 from 1 example per class to 1M total examples. BiT achieves 87.5% top-1 accuracy on ILSVRC-2012, 99.4% on CIFAR-10, and 76.3% on the 19 task Visual Task Adaptation Benchmark (VTAB). On small datasets, BiT attains 76.8% on ILSVRC-2012 with 10 examples per class, and 97.0% on CIFAR-10 with 10 examples per class. We conduct detailed analysis of the main components that lead to high transfer performance."),ta.forEach(o),ea.forEach(o),qt=p(e),Ve=a(e,"P",{});var oa=s(Ve);wo=i(oa,"Tips:"),oa.forEach(o),Rt=p(e),He=a(e,"UL",{});var ra=s(He);R=a(ra,"LI",{});var at=s(R);yo=i(at,"BiT models are equivalent to ResNetv2 in terms of architecture, except that: 1) all batch normalization layers are replaced by "),fe=a(at,"A",{href:!0,rel:!0});var aa=s(fe);$o=i(aa,"group normalization"),aa.forEach(o),Bo=i(at,`,
2) `),he=a(at,"A",{href:!0,rel:!0});var sa=s(he);To=i(sa,"weight standardization"),sa.forEach(o),Io=i(at,` is used for convolutional layers. The authors show that the combination of both is useful for training with large batch sizes, and has a significant
impact on transfer learning.`),at.forEach(o),ra.forEach(o),Lt=p(e),M=a(e,"P",{});var st=s(M);Po=i(st,"This model was contributed by "),ge=a(st,"A",{href:!0,rel:!0});var na=s(ge);xo=i(na,"nielsr"),na.forEach(o),Co=i(st,`.
The original code can be found `),ue=a(st,"A",{href:!0,rel:!0});var ia=s(ue);Eo=i(ia,"here"),ia.forEach(o),zo=i(st,"."),st.forEach(o),Dt=p(e),L=a(e,"H2",{class:!0});var eo=s(L);Y=a(eo,"A",{id:!0,class:!0,href:!0});var la=s(Y);gt=a(la,"SPAN",{});var ca=s(gt);y(_e.$$.fragment,ca),ca.forEach(o),la.forEach(o),Ao=p(eo),ut=a(eo,"SPAN",{});var da=s(ut);ko=i(da,"Resources"),da.forEach(o),eo.forEach(o),St=p(e),Ge=a(e,"P",{});var ma=s(Ge);jo=i(ma,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with BiT."),ma.forEach(o),Ot=p(e),y(ve.$$.fragment,e),Wt=p(e),X=a(e,"UL",{});var to=s(X);F=a(to,"LI",{});var Le=s(F);Je=a(Le,"A",{href:!0});var pa=s(Je);No=i(pa,"BitForImageClassification"),pa.forEach(o),Mo=i(Le," is supported by this "),be=a(Le,"A",{href:!0,rel:!0});var fa=s(be);Fo=i(fa,"example script"),fa.forEach(o),qo=i(Le," and "),we=a(Le,"A",{href:!0,rel:!0});var ha=s(we);Ro=i(ha,"notebook"),ha.forEach(o),Lo=i(Le,"."),Le.forEach(o),Do=p(to),Ye=a(to,"LI",{});var Ur=s(Ye);So=i(Ur,"See also: "),Xe=a(Ur,"A",{href:!0});var ga=s(Xe);Oo=i(ga,"Image classification task guide"),ga.forEach(o),Ur.forEach(o),to.forEach(o),Ut=p(e),Ke=a(e,"P",{});var ua=s(Ke);Wo=i(ua,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),ua.forEach(o),Vt=p(e),D=a(e,"H2",{class:!0});var oo=s(D);K=a(oo,"A",{id:!0,class:!0,href:!0});var _a=s(K);_t=a(_a,"SPAN",{});var va=s(_t);y(ye.$$.fragment,va),va.forEach(o),_a.forEach(o),Uo=p(oo),vt=a(oo,"SPAN",{});var ba=s(vt);Vo=i(ba,"BitConfig"),ba.forEach(o),oo.forEach(o),Ht=p(e),P=a(e,"DIV",{class:!0});var ie=s(P);y($e.$$.fragment,ie),Ho=p(ie),S=a(ie,"P",{});var nt=s(S);Go=i(nt,"This is the configuration class to store the configuration of a "),Ze=a(nt,"A",{href:!0});var wa=s(Ze);Jo=i(wa,"BitModel"),wa.forEach(o),Yo=i(nt,`. It is used to instantiate an BiT
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 BiT
`),Be=a(nt,"A",{href:!0,rel:!0});var ya=s(Be);Xo=i(ya,"google/bit-50"),ya.forEach(o),Ko=i(nt," architecture."),nt.forEach(o),Zo=p(ie),O=a(ie,"P",{});var it=s(O);Qo=i(it,"Configuration objects inherit from "),Qe=a(it,"A",{href:!0});var $a=s(Qe);er=i($a,"PretrainedConfig"),$a.forEach(o),tr=i(it,` and can be used to control the model outputs. Read the
documentation from `),et=a(it,"A",{href:!0});var Ba=s(et);or=i(Ba,"PretrainedConfig"),Ba.forEach(o),rr=i(it," for more information."),it.forEach(o),ar=p(ie),y(Z.$$.fragment,ie),ie.forEach(o),Gt=p(e),W=a(e,"H2",{class:!0});var ro=s(W);Q=a(ro,"A",{id:!0,class:!0,href:!0});var Ta=s(Q);bt=a(Ta,"SPAN",{});var Ia=s(bt);y(Te.$$.fragment,Ia),Ia.forEach(o),Ta.forEach(o),sr=p(ro),wt=a(ro,"SPAN",{});var Pa=s(wt);nr=i(Pa,"BitImageProcessor"),Pa.forEach(o),ro.forEach(o),Jt=p(e),k=a(e,"DIV",{class:!0});var lt=s(k);y(Ie.$$.fragment,lt),ir=p(lt),yt=a(lt,"P",{});var xa=s(yt);lr=i(xa,"Constructs a BiT image processor."),xa.forEach(o),cr=p(lt),ee=a(lt,"DIV",{class:!0});var ao=s(ee);y(Pe.$$.fragment,ao),dr=p(ao),$t=a(ao,"P",{});var Ca=s($t);mr=i(Ca,"Preprocess an image or batch of images."),Ca.forEach(o),ao.forEach(o),lt.forEach(o),Yt=p(e),U=a(e,"H2",{class:!0});var so=s(U);te=a(so,"A",{id:!0,class:!0,href:!0});var Ea=s(te);Bt=a(Ea,"SPAN",{});var za=s(Bt);y(xe.$$.fragment,za),za.forEach(o),Ea.forEach(o),pr=p(so),Tt=a(so,"SPAN",{});var Aa=s(Tt);fr=i(Aa,"BitModel"),Aa.forEach(o),so.forEach(o),Xt=p(e),j=a(e,"DIV",{class:!0});var ct=s(j);y(Ce.$$.fragment,ct),hr=p(ct),Ee=a(ct,"P",{});var no=s(Ee);gr=i(no,`The bare BiT model outputting raw features without any specific head on top.
This model is a PyTorch `),ze=a(no,"A",{href:!0,rel:!0});var ka=s(ze);ur=i(ka,"torch.nn.Module"),ka.forEach(o),_r=i(no,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),no.forEach(o),vr=p(ct),E=a(ct,"DIV",{class:!0});var le=s(E);y(Ae.$$.fragment,le),br=p(le),V=a(le,"P",{});var dt=s(V);wr=i(dt,"The "),tt=a(dt,"A",{href:!0});var ja=s(tt);yr=i(ja,"BitModel"),ja.forEach(o),$r=i(dt," forward method, overrides the "),It=a(dt,"CODE",{});var Na=s(It);Br=i(Na,"__call__"),Na.forEach(o),Tr=i(dt," special method."),dt.forEach(o),Ir=p(le),y(oe.$$.fragment,le),Pr=p(le),y(re.$$.fragment,le),le.forEach(o),ct.forEach(o),Kt=p(e),H=a(e,"H2",{class:!0});var io=s(H);ae=a(io,"A",{id:!0,class:!0,href:!0});var Ma=s(ae);Pt=a(Ma,"SPAN",{});var Fa=s(Pt);y(ke.$$.fragment,Fa),Fa.forEach(o),Ma.forEach(o),xr=p(io),xt=a(io,"SPAN",{});var qa=s(xt);Cr=i(qa,"BitForImageClassification"),qa.forEach(o),io.forEach(o),Zt=p(e),x=a(e,"DIV",{class:!0});var ce=s(x);y(je.$$.fragment,ce),Er=p(ce),Ct=a(ce,"P",{});var Ra=s(Ct);zr=i(Ra,`BiT Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`),Ra.forEach(o),Ar=p(ce),Ne=a(ce,"P",{});var lo=s(Ne);kr=i(lo,"This model is a PyTorch "),Me=a(lo,"A",{href:!0,rel:!0});var La=s(Me);jr=i(La,"torch.nn.Module"),La.forEach(o),Nr=i(lo,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),lo.forEach(o),Mr=p(ce),z=a(ce,"DIV",{class:!0});var de=s(z);y(Fe.$$.fragment,de),Fr=p(de),G=a(de,"P",{});var mt=s(G);qr=i(mt,"The "),ot=a(mt,"A",{href:!0});var Da=s(ot);Rr=i(Da,"BitForImageClassification"),Da.forEach(o),Lr=i(mt," forward method, overrides the "),Et=a(mt,"CODE",{});var Sa=s(Et);Dr=i(Sa,"__call__"),Sa.forEach(o),Sr=i(mt," special method."),mt.forEach(o),Or=p(de),y(se.$$.fragment,de),Wr=p(de),y(ne.$$.fragment,de),de.forEach(o),ce.forEach(o),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(ts)),c(g,"id","big-transfer-bit"),c(g,"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(g,"href","#big-transfer-bit"),c(_,"class","relative group"),c(J,"id","overview"),c(J,"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(J,"href","#overview"),c(q,"class","relative group"),c(pe,"href","https://arxiv.org/abs/1912.11370"),c(pe,"rel","nofollow"),c(Oe,"href","resnet"),c(fe,"href","https://arxiv.org/abs/1803.08494"),c(fe,"rel","nofollow"),c(he,"href","https://arxiv.org/abs/1903.10520"),c(he,"rel","nofollow"),c(ge,"href","https://huggingface.co/nielsr"),c(ge,"rel","nofollow"),c(ue,"href","https://github.com/google-research/big_transfer"),c(ue,"rel","nofollow"),c(Y,"id","resources"),c(Y,"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(Y,"href","#resources"),c(L,"class","relative group"),c(Je,"href","/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitForImageClassification"),c(be,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(be,"rel","nofollow"),c(we,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(we,"rel","nofollow"),c(Xe,"href","../tasks/image_classification"),c(K,"id","transformers.BitConfig"),c(K,"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(K,"href","#transformers.BitConfig"),c(D,"class","relative group"),c(Ze,"href","/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitModel"),c(Be,"href","https://huggingface.co/google/bit-50"),c(Be,"rel","nofollow"),c(Qe,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(et,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Q,"id","transformers.BitImageProcessor"),c(Q,"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(Q,"href","#transformers.BitImageProcessor"),c(W,"class","relative group"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(te,"id","transformers.BitModel"),c(te,"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(te,"href","#transformers.BitModel"),c(U,"class","relative group"),c(ze,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ze,"rel","nofollow"),c(tt,"href","/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitModel"),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(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(ae,"id","transformers.BitForImageClassification"),c(ae,"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(ae,"href","#transformers.BitForImageClassification"),c(H,"class","relative group"),c(Me,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Me,"rel","nofollow"),c(ot,"href","/docs/transformers/v4.29.0/en/model_doc/bit#transformers.BitForImageClassification"),c(z,"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,"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,d){t(document.head,h),f(e,b,d),f(e,_,d),t(_,g),t(g,v),$(l,v,null),t(_,u),t(_,A),t(A,co),f(e,jt,d),f(e,q,d),t(q,J),t(J,pt),$(me,pt,null),t(q,mo),t(q,ft),t(ft,po),f(e,Nt,d),f(e,N,d),t(N,fo),t(N,pe),t(pe,ho),t(N,go),t(N,Oe),t(Oe,uo),t(N,_o),f(e,Mt,d),f(e,We,d),t(We,vo),f(e,Ft,d),f(e,Ue,d),t(Ue,ht),t(ht,bo),f(e,qt,d),f(e,Ve,d),t(Ve,wo),f(e,Rt,d),f(e,He,d),t(He,R),t(R,yo),t(R,fe),t(fe,$o),t(R,Bo),t(R,he),t(he,To),t(R,Io),f(e,Lt,d),f(e,M,d),t(M,Po),t(M,ge),t(ge,xo),t(M,Co),t(M,ue),t(ue,Eo),t(M,zo),f(e,Dt,d),f(e,L,d),t(L,Y),t(Y,gt),$(_e,gt,null),t(L,Ao),t(L,ut),t(ut,ko),f(e,St,d),f(e,Ge,d),t(Ge,jo),f(e,Ot,d),$(ve,e,d),f(e,Wt,d),f(e,X,d),t(X,F),t(F,Je),t(Je,No),t(F,Mo),t(F,be),t(be,Fo),t(F,qo),t(F,we),t(we,Ro),t(F,Lo),t(X,Do),t(X,Ye),t(Ye,So),t(Ye,Xe),t(Xe,Oo),f(e,Ut,d),f(e,Ke,d),t(Ke,Wo),f(e,Vt,d),f(e,D,d),t(D,K),t(K,_t),$(ye,_t,null),t(D,Uo),t(D,vt),t(vt,Vo),f(e,Ht,d),f(e,P,d),$($e,P,null),t(P,Ho),t(P,S),t(S,Go),t(S,Ze),t(Ze,Jo),t(S,Yo),t(S,Be),t(Be,Xo),t(S,Ko),t(P,Zo),t(P,O),t(O,Qo),t(O,Qe),t(Qe,er),t(O,tr),t(O,et),t(et,or),t(O,rr),t(P,ar),$(Z,P,null),f(e,Gt,d),f(e,W,d),t(W,Q),t(Q,bt),$(Te,bt,null),t(W,sr),t(W,wt),t(wt,nr),f(e,Jt,d),f(e,k,d),$(Ie,k,null),t(k,ir),t(k,yt),t(yt,lr),t(k,cr),t(k,ee),$(Pe,ee,null),t(ee,dr),t(ee,$t),t($t,mr),f(e,Yt,d),f(e,U,d),t(U,te),t(te,Bt),$(xe,Bt,null),t(U,pr),t(U,Tt),t(Tt,fr),f(e,Xt,d),f(e,j,d),$(Ce,j,null),t(j,hr),t(j,Ee),t(Ee,gr),t(Ee,ze),t(ze,ur),t(Ee,_r),t(j,vr),t(j,E),$(Ae,E,null),t(E,br),t(E,V),t(V,wr),t(V,tt),t(tt,yr),t(V,$r),t(V,It),t(It,Br),t(V,Tr),t(E,Ir),$(oe,E,null),t(E,Pr),$(re,E,null),f(e,Kt,d),f(e,H,d),t(H,ae),t(ae,Pt),$(ke,Pt,null),t(H,xr),t(H,xt),t(xt,Cr),f(e,Zt,d),f(e,x,d),$(je,x,null),t(x,Er),t(x,Ct),t(Ct,zr),t(x,Ar),t(x,Ne),t(Ne,kr),t(Ne,Me),t(Me,jr),t(Ne,Nr),t(x,Mr),t(x,z),$(Fe,z,null),t(z,Fr),t(z,G),t(G,qr),t(G,ot),t(ot,Rr),t(G,Lr),t(G,Et),t(Et,Dr),t(G,Sr),t(z,Or),$(se,z,null),t(z,Wr),$(ne,z,null),Qt=!0},p(e,[d]){const qe={};d&2&&(qe.$$scope={dirty:d,ctx:e}),Z.$set(qe);const zt={};d&2&&(zt.$$scope={dirty:d,ctx:e}),oe.$set(zt);const At={};d&2&&(At.$$scope={dirty:d,ctx:e}),re.$set(At);const kt={};d&2&&(kt.$$scope={dirty:d,ctx:e}),se.$set(kt);const Re={};d&2&&(Re.$$scope={dirty:d,ctx:e}),ne.$set(Re)},i(e){Qt||(B(l.$$.fragment,e),B(me.$$.fragment,e),B(_e.$$.fragment,e),B(ve.$$.fragment,e),B(ye.$$.fragment,e),B($e.$$.fragment,e),B(Z.$$.fragment,e),B(Te.$$.fragment,e),B(Ie.$$.fragment,e),B(Pe.$$.fragment,e),B(xe.$$.fragment,e),B(Ce.$$.fragment,e),B(Ae.$$.fragment,e),B(oe.$$.fragment,e),B(re.$$.fragment,e),B(ke.$$.fragment,e),B(je.$$.fragment,e),B(Fe.$$.fragment,e),B(se.$$.fragment,e),B(ne.$$.fragment,e),Qt=!0)},o(e){T(l.$$.fragment,e),T(me.$$.fragment,e),T(_e.$$.fragment,e),T(ve.$$.fragment,e),T(ye.$$.fragment,e),T($e.$$.fragment,e),T(Z.$$.fragment,e),T(Te.$$.fragment,e),T(Ie.$$.fragment,e),T(Pe.$$.fragment,e),T(xe.$$.fragment,e),T(Ce.$$.fragment,e),T(Ae.$$.fragment,e),T(oe.$$.fragment,e),T(re.$$.fragment,e),T(ke.$$.fragment,e),T(je.$$.fragment,e),T(Fe.$$.fragment,e),T(se.$$.fragment,e),T(ne.$$.fragment,e),Qt=!1},d(e){o(h),e&&o(b),e&&o(_),I(l),e&&o(jt),e&&o(q),I(me),e&&o(Nt),e&&o(N),e&&o(Mt),e&&o(We),e&&o(Ft),e&&o(Ue),e&&o(qt),e&&o(Ve),e&&o(Rt),e&&o(He),e&&o(Lt),e&&o(M),e&&o(Dt),e&&o(L),I(_e),e&&o(St),e&&o(Ge),e&&o(Ot),I(ve,e),e&&o(Wt),e&&o(X),e&&o(Ut),e&&o(Ke),e&&o(Vt),e&&o(D),I(ye),e&&o(Ht),e&&o(P),I($e),I(Z),e&&o(Gt),e&&o(W),I(Te),e&&o(Jt),e&&o(k),I(Ie),I(Pe),e&&o(Yt),e&&o(U),I(xe),e&&o(Xt),e&&o(j),I(Ce),I(Ae),I(oe),I(re),e&&o(Kt),e&&o(H),I(ke),e&&o(Zt),e&&o(x),I(je),I(Fe),I(se),I(ne)}}}const ts={local:"big-transfer-bit",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.BitConfig",title:"BitConfig"},{local:"transformers.BitImageProcessor",title:"BitImageProcessor"},{local:"transformers.BitModel",title:"BitModel"},{local:"transformers.BitForImageClassification",title:"BitForImageClassification"}],title:"Big Transfer (BiT)"};function os(C){return Ga(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ds extends Wa{constructor(h){super();Ua(this,h,os,es,Va,{})}}export{ds as default,ts as metadata};
