import{S as Xn,i as An,s as Yn,e as a,k as c,w as h,t as s,M as Gn,c as o,d as r,m as l,a as n,x as g,h as i,b as d,G as e,g as E,y as _,q as v,o as x,B as y,v as Hn,L as On}from"../../chunks/vendor-hf-doc-builder.js";import{T as Qn}from"../../chunks/Tip-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Kn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Qt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as es}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ts(Oe){let u,D,$,w,T;return w=new Kn({props:{code:"JTIzJTIwV2UlMjBjYW4ndCUyMGluc3RhbnRpYXRlJTIwZGlyZWN0bHklMjB0aGUlMjBiYXNlJTIwY2xhc3MlMjAqRmVhdHVyZUV4dHJhY3Rpb25NaXhpbiolMjBub3IlMjAqU2VxdWVuY2VGZWF0dXJlRXh0cmFjdG9yKiUyMHNvJTIwbGV0J3MlMjBzaG93JTIwdGhlJTIwZXhhbXBsZXMlMjBvbiUyMGElMEElMjMlMjBkZXJpdmVkJTIwY2xhc3MlM0ElMjAqV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKiUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRndhdjJ2ZWMyLWJhc2UtOTYwaCUyMiUwQSklMjAlMjAlMjMlMjBEb3dubG9hZCUyMGZlYXR1cmVfZXh0cmFjdGlvbl9jb25maWclMjBmcm9tJTIwaHVnZ2luZ2ZhY2UuY28lMjBhbmQlMjBjYWNoZS4lMEFmZWF0dXJlX2V4dHJhY3RvciUyMCUzRCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3Rvci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRiUyMiUwQSklMjAlMjAlMjMlMjBFLmcuJTIwZmVhdHVyZV9leHRyYWN0b3IlMjAob3IlMjBtb2RlbCklMjB3YXMlMjBzYXZlZCUyMHVzaW5nJTIwKnNhdmVfcHJldHJhaW5lZCgnLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRicpKiUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yLmZyb21fcHJldHJhaW5lZCglMjIuJTJGdGVzdCUyRnNhdmVkX21vZGVsJTJGcHJlcHJvY2Vzc29yX2NvbmZpZy5qc29uJTIyKSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRndhdjJ2ZWMyLWJhc2UtOTYwaCUyMiUyQyUyMHJldHVybl9hdHRlbnRpb25fbWFzayUzREZhbHNlJTJDJTIwZm9vJTNERmFsc2UlMEEpJTBBYXNzZXJ0JTIwZmVhdHVyZV9leHRyYWN0b3IucmV0dXJuX2F0dGVudGlvbl9tYXNrJTIwaXMlMjBGYWxzZSUwQWZlYXR1cmVfZXh0cmFjdG9yJTJDJTIwdW51c2VkX2t3YXJncyUyMCUzRCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3Rvci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZmFjZWJvb2slMkZ3YXYydmVjMi1iYXNlLTk2MGglMjIlMkMlMjByZXR1cm5fYXR0ZW50aW9uX21hc2slM0RGYWxzZSUyQyUyMGZvbyUzREZhbHNlJTJDJTIwcmV0dXJuX3VudXNlZF9rd2FyZ3MlM0RUcnVlJTBBKSUwQWFzc2VydCUyMGZlYXR1cmVfZXh0cmFjdG9yLnJldHVybl9hdHRlbnRpb25fbWFzayUyMGlzJTIwRmFsc2UlMEFhc3NlcnQlMjB1bnVzZWRfa3dhcmdzJTIwJTNEJTNEJTIwJTdCJTIyZm9vJTIyJTNBJTIwRmFsc2UlN0Q=",highlighted:`<span class="hljs-comment"># We can&#x27;t instantiate directly the base class *FeatureExtractionMixin* nor *SequenceFeatureExtractor* so let&#x27;s show the examples on a</span>
<span class="hljs-comment"># derived class: *Wav2Vec2FeatureExtractor*</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>
)  <span class="hljs-comment"># Download feature_extraction_config from huggingface.co and cache.</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;./test/saved_model/&quot;</span>
)  <span class="hljs-comment"># E.g. feature_extractor (or model) was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)*</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/preprocessor_config.json&quot;</span>)
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>, return_attention_mask=<span class="hljs-literal">False</span>, foo=<span class="hljs-literal">False</span>
)
<span class="hljs-keyword">assert</span> feature_extractor.return_attention_mask <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
feature_extractor, unused_kwargs = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>, return_attention_mask=<span class="hljs-literal">False</span>, foo=<span class="hljs-literal">False</span>, return_unused_kwargs=<span class="hljs-literal">True</span>
)
<span class="hljs-keyword">assert</span> feature_extractor.return_attention_mask <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
<span class="hljs-keyword">assert</span> unused_kwargs == {<span class="hljs-string">&quot;foo&quot;</span>: <span class="hljs-literal">False</span>}`}}),{c(){u=a("p"),D=s("Examples:"),$=c(),h(w.$$.fragment)},l(m){u=o(m,"P",{});var M=n(u);D=i(M,"Examples:"),M.forEach(r),$=l(m),g(w.$$.fragment,m)},m(m,M){E(m,u,M),e(u,D),E(m,$,M),_(w,m,M),T=!0},p:On,i(m){T||(v(w.$$.fragment,m),T=!0)},o(m){x(w.$$.fragment,m),T=!1},d(m){m&&r(u),m&&r($),y(w,m)}}}function rs(Oe){let u,D,$,w,T,m,M,W;return{c(){u=a("p"),D=s("If the "),$=a("code"),w=s("processed_features"),T=s(` passed are dictionary of numpy arrays, PyTorch tensors or TensorFlow tensors, the
result will use the same type unless you provide a different tensor type with `),m=a("code"),M=s("return_tensors"),W=s(`. In the case of
PyTorch tensors, you will lose the specific device of your tensors however.`)},l(U){u=o(U,"P",{});var z=n(u);D=i(z,"If the "),$=o(z,"CODE",{});var J=n($);w=i(J,"processed_features"),J.forEach(r),T=i(z,` passed are dictionary of numpy arrays, PyTorch tensors or TensorFlow tensors, the
result will use the same type unless you provide a different tensor type with `),m=o(z,"CODE",{});var Qe=n(m);M=i(Qe,"return_tensors"),Qe.forEach(r),W=i(z,`. In the case of
PyTorch tensors, you will lose the specific device of your tensors however.`),z.forEach(r)},m(U,z){E(U,u,z),e(u,D),e(u,$),e($,w),e(u,T),e(u,m),e(m,M),e(u,W)},d(U){U&&r(u)}}}function as(Oe){let u,D,$,w,T,m,M,W,U,z,J,Qe,mt,Pr,kr,pt,jr,Dr,Kt,C,K,ft,be,Nr,ut,Lr,er,P,Ee,Zr,ht,Vr,Br,V,$e,Rr,L,qr,Ke,Wr,Ur,gt,Cr,Sr,et,Xr,Ar,Yr,ee,Gr,te,we,Hr,S,Or,_t,Qr,Kr,tt,ea,ta,tr,X,re,vt,Fe,ra,xt,aa,rr,Z,Ie,oa,yt,na,sa,N,Te,ia,bt,ca,la,A,da,Et,ma,pa,$t,fa,ua,ha,ae,ar,Y,oe,wt,Me,ga,Ft,_a,or,I,ze,va,G,xa,rt,ya,ba,It,Ea,$a,wa,Tt,Fa,Ia,ne,Je,Ta,Mt,Ma,za,se,Pe,Ja,k,Pa,zt,ka,ja,Jt,Da,Na,Pt,La,Za,kt,Va,Ba,nr,H,ie,jt,ke,Ra,Dt,qa,sr,p,je,Wa,Nt,Ua,Ca,ce,De,Sa,Ne,Xa,Lt,Aa,Ya,Ga,le,Le,Ha,Ze,Oa,Zt,Qa,Ka,eo,de,Ve,to,Be,ro,Vt,ao,oo,no,me,Re,so,O,io,Bt,co,lo,Rt,mo,po,fo,pe,qe,uo,j,ho,qt,go,_o,Wt,vo,xo,Ut,yo,bo,Ct,Eo,$o,wo,fe,We,Fo,St,Io,To,ue,Ue,Mo,Ce,zo,Xt,Jo,Po,ko,he,Se,jo,Q,Do,At,No,Lo,Yt,Zo,Vo,Bo,ge,Xe,Ro,Ae,qo,Gt,Wo,Uo,Co,_e,Ye,So,Ge,Xo,Ht,Ao,Yo,ir;return m=new Qt({}),be=new Qt({}),Ee=new F({props:{name:"class transformers.FeatureExtractionMixin",anchor:"transformers.FeatureExtractionMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L233"}}),$e=new F({props:{name:"from_pretrained",anchor:"transformers.FeatureExtractionMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"cache_dir",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": typing.Union[bool, str, NoneType] = None"},{name:"revision",val:": str = 'main'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FeatureExtractionMixin.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
This can be either:</p>
<ul>
<li>a string, the <em>model id</em> of a pretrained feature_extractor hosted inside a model repo on
huggingface.co. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or
namespaced under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>a path to a <em>directory</em> containing a feature extractor file saved using the
<a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained">save_pretrained()</a> method, e.g.,
<code>./my_model_directory/</code>.</li>
<li>a path or url to a saved feature extractor JSON <em>file</em>, e.g.,
<code>./my_model_directory/preprocessor_config.json</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model feature extractor should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force to (re-)download the feature extractor files and override the cached versions
if they exist.`,name:"force_download"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received file. Attempts to resume the download if such a file
exists.`,name:"resume_download"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}.</code> The proxies are used on each request.`,name:"proxies"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.token",description:`<strong>token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L257",returnDescription:`
<p>A feature extractor of type <a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"
>FeatureExtractionMixin</a>.</p>
`}}),ee=new es({props:{anchor:"transformers.FeatureExtractionMixin.from_pretrained.example",$$slots:{default:[ts]},$$scope:{ctx:Oe}}}),we=new F({props:{name:"save_pretrained",anchor:"transformers.FeatureExtractionMixin.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FeatureExtractionMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory where the feature extractor JSON file will be saved (will be created if it does not exist).`,name:"save_directory"},{anchor:"transformers.FeatureExtractionMixin.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).`,name:"push_to_hub"},{anchor:"transformers.FeatureExtractionMixin.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L369"}}),Fe=new Qt({}),Ie=new F({props:{name:"class transformers.SequenceFeatureExtractor",anchor:"transformers.SequenceFeatureExtractor",parameters:[{name:"feature_size",val:": int"},{name:"sampling_rate",val:": int"},{name:"padding_value",val:": float"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SequenceFeatureExtractor.feature_size",description:`<strong>feature_size</strong> (<code>int</code>) &#x2014;
The feature dimension of the extracted features.`,name:"feature_size"},{anchor:"transformers.SequenceFeatureExtractor.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>) &#x2014;
The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.SequenceFeatureExtractor.padding_value",description:`<strong>padding_value</strong> (<code>float</code>) &#x2014;
The value that is used to fill the padding values / vectors.`,name:"padding_value"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_sequence_utils.py#L29"}}),Te=new F({props:{name:"pad",anchor:"transformers.SequenceFeatureExtractor.pad",parameters:[{name:"processed_features",val:": typing.Union[transformers.feature_extraction_utils.BatchFeature, typing.List[transformers.feature_extraction_utils.BatchFeature], typing.Dict[str, transformers.feature_extraction_utils.BatchFeature], typing.Dict[str, typing.List[transformers.feature_extraction_utils.BatchFeature]], typing.List[typing.Dict[str, transformers.feature_extraction_utils.BatchFeature]]]"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = True"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"truncation",val:": bool = False"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.SequenceFeatureExtractor.pad.processed_features",description:`<strong>processed_features</strong> (<a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature">BatchFeature</a>, list of <a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature">BatchFeature</a>, <code>Dict[str, List[float]]</code>, <code>Dict[str, List[List[float]]</code> or <code>List[Dict[str, List[float]]]</code>) &#x2014;
Processed inputs. Can represent one input (<a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature">BatchFeature</a> or <code>Dict[str, List[float]]</code>) or a batch of
input values / vectors (list of <a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature">BatchFeature</a>, <em>Dict[str, List[List[float]]]</em> or <em>List[Dict[str,
List[float]]]</em>) so you can use this method during preprocessing as well as in a PyTorch Dataloader
collate function.</p>
<p>Instead of <code>List[float]</code> you can have tensors (numpy arrays, PyTorch tensors or TensorFlow tensors),
see the note above for the return type.`,name:"processed_features"},{anchor:"transformers.SequenceFeatureExtractor.pad.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Select a strategy to pad the returned sequences (according to the model&#x2019;s padding side and padding
index) among:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.SequenceFeatureExtractor.pad.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum length of the returned list and optionally padding length (see above).`,name:"max_length"},{anchor:"transformers.SequenceFeatureExtractor.pad.truncation",description:`<strong>truncation</strong> (<code>bool</code>) &#x2014;
Activates truncation to cut input sequences longer than <code>max_length</code> to <code>max_length</code>.`,name:"truncation"},{anchor:"transformers.SequenceFeatureExtractor.pad.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value.</p>
<p>This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
<code>&gt;= 7.5</code> (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.`,name:"pad_to_multiple_of"},{anchor:"transformers.SequenceFeatureExtractor.pad.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific feature_extractor&#x2019;s default.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.SequenceFeatureExtractor.pad.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_sequence_utils.py#L52"}}),ae=new Qn({props:{$$slots:{default:[rs]},$$scope:{ctx:Oe}}}),Me=new Qt({}),ze=new F({props:{name:"class transformers.BatchFeature",anchor:"transformers.BatchFeature",parameters:[{name:"data",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"tensor_type",val:": typing.Union[NoneType, str, transformers.utils.generic.TensorType] = None"}],parametersDescription:[{anchor:"transformers.BatchFeature.data",description:`<strong>data</strong> (<code>dict</code>) &#x2014;
Dictionary of lists/arrays/tensors returned by the <strong>call</strong>/pad methods (&#x2018;input_values&#x2019;, &#x2018;attention_mask&#x2019;,
etc.).`,name:"data"},{anchor:"transformers.BatchFeature.tensor_type",description:`<strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) &#x2014;
You can give a tensor_type here to convert the lists of integers in PyTorch/TensorFlow/Numpy Tensors at
initialization.`,name:"tensor_type"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L61"}}),Je=new F({props:{name:"convert_to_tensors",anchor:"transformers.BatchFeature.convert_to_tensors",parameters:[{name:"tensor_type",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.BatchFeature.convert_to_tensors.tensor_type",description:`<strong>tensor_type</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
The type of tensors to use. If <code>str</code>, should be one of the values of the enum <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>. If
<code>None</code>, no modification is done.`,name:"tensor_type"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L115"}}),Pe=new F({props:{name:"to",anchor:"transformers.BatchFeature.to",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BatchFeature.to.args",description:`<strong>args</strong> (<code>Tuple</code>) &#x2014;
Will be passed to the <code>to(...)</code> function of the tensors.`,name:"args"},{anchor:"transformers.BatchFeature.to.kwargs",description:`<strong>kwargs</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>to(...)</code> function of the tensors.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/feature_extraction_utils.py#L188",returnDescription:`
<p>The same instance after modification.</p>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),ke=new Qt({}),je=new F({props:{name:"class transformers.ImageFeatureExtractionMixin",anchor:"transformers.ImageFeatureExtractionMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L305"}}),De=new F({props:{name:"center_crop",anchor:"transformers.ImageFeatureExtractionMixin.center_crop",parameters:[{name:"image",val:""},{name:"size",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.center_crop.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code> of shape (n_channels, height, width) or (height, width, n_channels)) &#x2014;
The image to resize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.center_crop.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple[int, int]</code>) &#x2014;
The size to which crop the image.`,name:"size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L533",returnDescription:`
<p>A center cropped <code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code> of shape: (n_channels,
height, width).</p>
`,returnType:`
<p>new_image</p>
`}}),Le=new F({props:{name:"convert_rgb",anchor:"transformers.ImageFeatureExtractionMixin.convert_rgb",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.convert_rgb.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>) &#x2014;
The image to convert.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L347"}}),Ve=new F({props:{name:"expand_dims",anchor:"transformers.ImageFeatureExtractionMixin.expand_dims",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.expand_dims.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to expand.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L400"}}),Re=new F({props:{name:"flip_channel_order",anchor:"transformers.ImageFeatureExtractionMixin.flip_channel_order",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.flip_channel_order.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image whose color channels to flip. If <code>np.ndarray</code> or <code>torch.Tensor</code>, the channel dimension should
be first.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L608"}}),qe=new F({props:{name:"normalize",anchor:"transformers.ImageFeatureExtractionMixin.normalize",parameters:[{name:"image",val:""},{name:"mean",val:""},{name:"std",val:""},{name:"rescale",val:" = False"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.normalize.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to normalize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.mean",description:`<strong>mean</strong> (<code>List[float]</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The mean (per channel) to use for normalization.`,name:"mean"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.std",description:`<strong>std</strong> (<code>List[float]</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The standard deviation (per channel) to use for normalization.`,name:"std"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to rescale the image to be between 0 and 1. If a PIL image is provided, scaling will
happen automatically.`,name:"rescale"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L420"}}),We=new F({props:{name:"rescale",anchor:"transformers.ImageFeatureExtractionMixin.rescale",parameters:[{name:"image",val:": ndarray"},{name:"scale",val:": typing.Union[float, int]"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L361"}}),Ue=new F({props:{name:"resize",anchor:"transformers.ImageFeatureExtractionMixin.resize",parameters:[{name:"image",val:""},{name:"size",val:""},{name:"resample",val:" = None"},{name:"default_to_square",val:" = True"},{name:"max_size",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.resize.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to resize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple[int, int]</code>) &#x2014;
The size to use for resizing the image. If <code>size</code> is a sequence like (h, w), output size will be
matched to this.</p>
<p>If <code>size</code> is an int and <code>default_to_square</code> is <code>True</code>, then image will be resized to (size, size). If
<code>size</code> is an int and <code>default_to_square</code> is <code>False</code>, then smaller edge of the image will be matched to
this number. i.e, if height &gt; width, then image will be rescaled to (size * height / width, size).`,name:"size"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
The filter to user for resampling.`,name:"resample"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
How to convert <code>size</code> when it is a single int. If set to <code>True</code>, the <code>size</code> will be converted to a
square (<code>size</code>,<code>size</code>). If set to <code>False</code>, will replicate
<a href="https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.Resize" rel="nofollow"><code>torchvision.transforms.Resize</code></a>
with support for resizing only the smallest edge and providing an optional <code>max_size</code>.`,name:"default_to_square"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.max_size",description:`<strong>max_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The maximum allowed for the longer edge of the resized image: if the longer edge of the image is
greater than <code>max_size</code> after being resized according to <code>size</code>, then the image is resized again so
that the longer edge is equal to <code>max_size</code>. As a result, <code>size</code> might be overruled, i.e the smaller
edge may be shorter than <code>size</code>. Only used if <code>default_to_square</code> is <code>False</code>.`,name:"max_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L466",returnDescription:`
<p>A resized <code>PIL.Image.Image</code>.</p>
`,returnType:`
<p>image</p>
`}}),Se=new F({props:{name:"rotate",anchor:"transformers.ImageFeatureExtractionMixin.rotate",parameters:[{name:"image",val:""},{name:"angle",val:""},{name:"resample",val:" = None"},{name:"expand",val:" = 0"},{name:"center",val:" = None"},{name:"translate",val:" = None"},{name:"fillcolor",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.rotate.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to rotate. If <code>np.ndarray</code> or <code>torch.Tensor</code>, will be converted to <code>PIL.Image.Image</code> before
rotating.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L625",returnDescription:`
<p>A rotated <code>PIL.Image.Image</code>.</p>
`,returnType:`
<p>image</p>
`}}),Xe=new F({props:{name:"to_numpy_array",anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array",parameters:[{name:"image",val:""},{name:"rescale",val:" = None"},{name:"channel_first",val:" = True"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to convert to a NumPy array.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values floats between 0. and 1.). Will
default to <code>True</code> if the image is a PIL Image or an array/tensor of integers, <code>False</code> otherwise.`,name:"rescale"},{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.channel_first",description:`<strong>channel_first</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to permute the dimensions of the image to put the channel dimension first.`,name:"channel_first"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L368"}}),Ye=new F({props:{name:"to_pil_image",anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image",parameters:[{name:"image",val:""},{name:"rescale",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>numpy.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to convert to the PIL Image format.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will
default to <code>True</code> if the image type is a floating type, <code>False</code> otherwise.`,name:"rescale"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L317"}}),{c(){u=a("meta"),D=c(),$=a("h1"),w=a("a"),T=a("span"),h(m.$$.fragment),M=c(),W=a("span"),U=s("Feature Extractor"),z=c(),J=a("p"),Qe=s(`A feature extractor is in charge of preparing input features for audio or vision models. This includes feature extraction
from sequences, `),mt=a("em"),Pr=s("e.g."),kr=s(`, pre-processing audio files to Log-Mel Spectrogram features, feature extraction from images
`),pt=a("em"),jr=s("e.g."),Dr=s(` cropping image image files, but also padding, normalization, and conversion to Numpy, PyTorch, and TensorFlow
tensors.`),Kt=c(),C=a("h2"),K=a("a"),ft=a("span"),h(be.$$.fragment),Nr=c(),ut=a("span"),Lr=s("FeatureExtractionMixin"),er=c(),P=a("div"),h(Ee.$$.fragment),Zr=c(),ht=a("p"),Vr=s(`This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),Br=c(),V=a("div"),h($e.$$.fragment),Rr=c(),L=a("p"),qr=s("Instantiate a type of "),Ke=a("a"),Wr=s("FeatureExtractionMixin"),Ur=s(" from a feature extractor, "),gt=a("em"),Cr=s("e.g."),Sr=s(` a
derived class of `),et=a("a"),Xr=s("SequenceFeatureExtractor"),Ar=s("."),Yr=c(),h(ee.$$.fragment),Gr=c(),te=a("div"),h(we.$$.fragment),Hr=c(),S=a("p"),Or=s("Save a feature_extractor object to the directory "),_t=a("code"),Qr=s("save_directory"),Kr=s(`, so that it can be re-loaded using the
`),tt=a("a"),ea=s("from_pretrained()"),ta=s(" class method."),tr=c(),X=a("h2"),re=a("a"),vt=a("span"),h(Fe.$$.fragment),ra=c(),xt=a("span"),aa=s("SequenceFeatureExtractor"),rr=c(),Z=a("div"),h(Ie.$$.fragment),oa=c(),yt=a("p"),na=s("This is a general feature extraction class for speech recognition."),sa=c(),N=a("div"),h(Te.$$.fragment),ia=c(),bt=a("p"),ca=s(`Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the
max sequence length in the batch.`),la=c(),A=a("p"),da=s("Padding side (left/right) padding values are defined at the feature extractor level (with "),Et=a("code"),ma=s("self.padding_side"),pa=s(`,
`),$t=a("code"),fa=s("self.padding_value"),ua=s(")"),ha=c(),h(ae.$$.fragment),ar=c(),Y=a("h2"),oe=a("a"),wt=a("span"),h(Me.$$.fragment),ga=c(),Ft=a("span"),_a=s("BatchFeature"),or=c(),I=a("div"),h(ze.$$.fragment),va=c(),G=a("p"),xa=s("Holds the output of the "),rt=a("a"),ya=s("pad()"),ba=s(" and feature extractor specific "),It=a("code"),Ea=s("__call__"),$a=s(" methods."),wa=c(),Tt=a("p"),Fa=s("This class is derived from a python dictionary and can be used as a dictionary."),Ia=c(),ne=a("div"),h(Je.$$.fragment),Ta=c(),Mt=a("p"),Ma=s("Convert the inner content to tensors."),za=c(),se=a("div"),h(Pe.$$.fragment),Ja=c(),k=a("p"),Pa=s("Send all values to device by calling "),zt=a("code"),ka=s("v.to(*args, **kwargs)"),ja=s(` (PyTorch only). This should support casting in
different `),Jt=a("code"),Da=s("dtypes"),Na=s(" and sending the "),Pt=a("code"),La=s("BatchFeature"),Za=s(" to a different "),kt=a("code"),Va=s("device"),Ba=s("."),nr=c(),H=a("h2"),ie=a("a"),jt=a("span"),h(ke.$$.fragment),Ra=c(),Dt=a("span"),qa=s("ImageFeatureExtractionMixin"),sr=c(),p=a("div"),h(je.$$.fragment),Wa=c(),Nt=a("p"),Ua=s("Mixin that contain utilities for preparing image features."),Ca=c(),ce=a("div"),h(De.$$.fragment),Sa=c(),Ne=a("p"),Xa=s("Crops "),Lt=a("code"),Aa=s("image"),Ya=s(` to the given size using a center crop. Note that if the image is too small to be cropped to the
size given, it will be padded (so the returned result has the size asked).`),Ga=c(),le=a("div"),h(Le.$$.fragment),Ha=c(),Ze=a("p"),Oa=s("Converts "),Zt=a("code"),Qa=s("PIL.Image.Image"),Ka=s(" to RGB format."),eo=c(),de=a("div"),h(Ve.$$.fragment),to=c(),Be=a("p"),ro=s("Expands 2-dimensional "),Vt=a("code"),ao=s("image"),oo=s(" to 3 dimensions."),no=c(),me=a("div"),h(Re.$$.fragment),so=c(),O=a("p"),io=s("Flips the channel order of "),Bt=a("code"),co=s("image"),lo=s(` from RGB to BGR, or vice versa. Note that this will trigger a conversion of
`),Rt=a("code"),mo=s("image"),po=s(" to a NumPy array if it\u2019s a PIL Image."),fo=c(),pe=a("div"),h(qe.$$.fragment),uo=c(),j=a("p"),ho=s("Normalizes "),qt=a("code"),go=s("image"),_o=s(" with "),Wt=a("code"),vo=s("mean"),xo=s(" and "),Ut=a("code"),yo=s("std"),bo=s(". Note that this will trigger a conversion of "),Ct=a("code"),Eo=s("image"),$o=s(` to a NumPy array
if it\u2019s a PIL Image.`),wo=c(),fe=a("div"),h(We.$$.fragment),Fo=c(),St=a("p"),Io=s("Rescale a numpy image by scale amount"),To=c(),ue=a("div"),h(Ue.$$.fragment),Mo=c(),Ce=a("p"),zo=s("Resizes "),Xt=a("code"),Jo=s("image"),Po=s(". Enforces conversion of input to PIL.Image."),ko=c(),he=a("div"),h(Se.$$.fragment),jo=c(),Q=a("p"),Do=s("Returns a rotated copy of "),At=a("code"),No=s("image"),Lo=s(". This method returns a copy of "),Yt=a("code"),Zo=s("image"),Vo=s(`, rotated the given number of degrees
counter clockwise around its centre.`),Bo=c(),ge=a("div"),h(Xe.$$.fragment),Ro=c(),Ae=a("p"),qo=s("Converts "),Gt=a("code"),Wo=s("image"),Uo=s(` to a numpy array. Optionally rescales it and puts the channel dimension as the first
dimension.`),Co=c(),_e=a("div"),h(Ye.$$.fragment),So=c(),Ge=a("p"),Xo=s("Converts "),Ht=a("code"),Ao=s("image"),Yo=s(` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),this.h()},l(t){const f=Gn('[data-svelte="svelte-1phssyn"]',document.head);u=o(f,"META",{name:!0,content:!0}),f.forEach(r),D=l(t),$=o(t,"H1",{class:!0});var He=n($);w=o(He,"A",{id:!0,class:!0,href:!0});var Ot=n(w);T=o(Ot,"SPAN",{});var Go=n(T);g(m.$$.fragment,Go),Go.forEach(r),Ot.forEach(r),M=l(He),W=o(He,"SPAN",{});var Ho=n(W);U=i(Ho,"Feature Extractor"),Ho.forEach(r),He.forEach(r),z=l(t),J=o(t,"P",{});var at=n(J);Qe=i(at,`A feature extractor is in charge of preparing input features for audio or vision models. This includes feature extraction
from sequences, `),mt=o(at,"EM",{});var Oo=n(mt);Pr=i(Oo,"e.g."),Oo.forEach(r),kr=i(at,`, pre-processing audio files to Log-Mel Spectrogram features, feature extraction from images
`),pt=o(at,"EM",{});var Qo=n(pt);jr=i(Qo,"e.g."),Qo.forEach(r),Dr=i(at,` cropping image image files, but also padding, normalization, and conversion to Numpy, PyTorch, and TensorFlow
tensors.`),at.forEach(r),Kt=l(t),C=o(t,"H2",{class:!0});var cr=n(C);K=o(cr,"A",{id:!0,class:!0,href:!0});var Ko=n(K);ft=o(Ko,"SPAN",{});var en=n(ft);g(be.$$.fragment,en),en.forEach(r),Ko.forEach(r),Nr=l(cr),ut=o(cr,"SPAN",{});var tn=n(ut);Lr=i(tn,"FeatureExtractionMixin"),tn.forEach(r),cr.forEach(r),er=l(t),P=o(t,"DIV",{class:!0});var ve=n(P);g(Ee.$$.fragment,ve),Zr=l(ve),ht=o(ve,"P",{});var rn=n(ht);Vr=i(rn,`This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),rn.forEach(r),Br=l(ve),V=o(ve,"DIV",{class:!0});var ot=n(V);g($e.$$.fragment,ot),Rr=l(ot),L=o(ot,"P",{});var xe=n(L);qr=i(xe,"Instantiate a type of "),Ke=o(xe,"A",{href:!0});var an=n(Ke);Wr=i(an,"FeatureExtractionMixin"),an.forEach(r),Ur=i(xe," from a feature extractor, "),gt=o(xe,"EM",{});var on=n(gt);Cr=i(on,"e.g."),on.forEach(r),Sr=i(xe,` a
derived class of `),et=o(xe,"A",{href:!0});var nn=n(et);Xr=i(nn,"SequenceFeatureExtractor"),nn.forEach(r),Ar=i(xe,"."),xe.forEach(r),Yr=l(ot),g(ee.$$.fragment,ot),ot.forEach(r),Gr=l(ve),te=o(ve,"DIV",{class:!0});var lr=n(te);g(we.$$.fragment,lr),Hr=l(lr),S=o(lr,"P",{});var nt=n(S);Or=i(nt,"Save a feature_extractor object to the directory "),_t=o(nt,"CODE",{});var sn=n(_t);Qr=i(sn,"save_directory"),sn.forEach(r),Kr=i(nt,`, so that it can be re-loaded using the
`),tt=o(nt,"A",{href:!0});var cn=n(tt);ea=i(cn,"from_pretrained()"),cn.forEach(r),ta=i(nt," class method."),nt.forEach(r),lr.forEach(r),ve.forEach(r),tr=l(t),X=o(t,"H2",{class:!0});var dr=n(X);re=o(dr,"A",{id:!0,class:!0,href:!0});var ln=n(re);vt=o(ln,"SPAN",{});var dn=n(vt);g(Fe.$$.fragment,dn),dn.forEach(r),ln.forEach(r),ra=l(dr),xt=o(dr,"SPAN",{});var mn=n(xt);aa=i(mn,"SequenceFeatureExtractor"),mn.forEach(r),dr.forEach(r),rr=l(t),Z=o(t,"DIV",{class:!0});var st=n(Z);g(Ie.$$.fragment,st),oa=l(st),yt=o(st,"P",{});var pn=n(yt);na=i(pn,"This is a general feature extraction class for speech recognition."),pn.forEach(r),sa=l(st),N=o(st,"DIV",{class:!0});var ye=n(N);g(Te.$$.fragment,ye),ia=l(ye),bt=o(ye,"P",{});var fn=n(bt);ca=i(fn,`Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the
max sequence length in the batch.`),fn.forEach(r),la=l(ye),A=o(ye,"P",{});var it=n(A);da=i(it,"Padding side (left/right) padding values are defined at the feature extractor level (with "),Et=o(it,"CODE",{});var un=n(Et);ma=i(un,"self.padding_side"),un.forEach(r),pa=i(it,`,
`),$t=o(it,"CODE",{});var hn=n($t);fa=i(hn,"self.padding_value"),hn.forEach(r),ua=i(it,")"),it.forEach(r),ha=l(ye),g(ae.$$.fragment,ye),ye.forEach(r),st.forEach(r),ar=l(t),Y=o(t,"H2",{class:!0});var mr=n(Y);oe=o(mr,"A",{id:!0,class:!0,href:!0});var gn=n(oe);wt=o(gn,"SPAN",{});var _n=n(wt);g(Me.$$.fragment,_n),_n.forEach(r),gn.forEach(r),ga=l(mr),Ft=o(mr,"SPAN",{});var vn=n(Ft);_a=i(vn,"BatchFeature"),vn.forEach(r),mr.forEach(r),or=l(t),I=o(t,"DIV",{class:!0});var B=n(I);g(ze.$$.fragment,B),va=l(B),G=o(B,"P",{});var ct=n(G);xa=i(ct,"Holds the output of the "),rt=o(ct,"A",{href:!0});var xn=n(rt);ya=i(xn,"pad()"),xn.forEach(r),ba=i(ct," and feature extractor specific "),It=o(ct,"CODE",{});var yn=n(It);Ea=i(yn,"__call__"),yn.forEach(r),$a=i(ct," methods."),ct.forEach(r),wa=l(B),Tt=o(B,"P",{});var bn=n(Tt);Fa=i(bn,"This class is derived from a python dictionary and can be used as a dictionary."),bn.forEach(r),Ia=l(B),ne=o(B,"DIV",{class:!0});var pr=n(ne);g(Je.$$.fragment,pr),Ta=l(pr),Mt=o(pr,"P",{});var En=n(Mt);Ma=i(En,"Convert the inner content to tensors."),En.forEach(r),pr.forEach(r),za=l(B),se=o(B,"DIV",{class:!0});var fr=n(se);g(Pe.$$.fragment,fr),Ja=l(fr),k=o(fr,"P",{});var R=n(k);Pa=i(R,"Send all values to device by calling "),zt=o(R,"CODE",{});var $n=n(zt);ka=i($n,"v.to(*args, **kwargs)"),$n.forEach(r),ja=i(R,` (PyTorch only). This should support casting in
different `),Jt=o(R,"CODE",{});var wn=n(Jt);Da=i(wn,"dtypes"),wn.forEach(r),Na=i(R," and sending the "),Pt=o(R,"CODE",{});var Fn=n(Pt);La=i(Fn,"BatchFeature"),Fn.forEach(r),Za=i(R," to a different "),kt=o(R,"CODE",{});var In=n(kt);Va=i(In,"device"),In.forEach(r),Ba=i(R,"."),R.forEach(r),fr.forEach(r),B.forEach(r),nr=l(t),H=o(t,"H2",{class:!0});var ur=n(H);ie=o(ur,"A",{id:!0,class:!0,href:!0});var Tn=n(ie);jt=o(Tn,"SPAN",{});var Mn=n(jt);g(ke.$$.fragment,Mn),Mn.forEach(r),Tn.forEach(r),Ra=l(ur),Dt=o(ur,"SPAN",{});var zn=n(Dt);qa=i(zn,"ImageFeatureExtractionMixin"),zn.forEach(r),ur.forEach(r),sr=l(t),p=o(t,"DIV",{class:!0});var b=n(p);g(je.$$.fragment,b),Wa=l(b),Nt=o(b,"P",{});var Jn=n(Nt);Ua=i(Jn,"Mixin that contain utilities for preparing image features."),Jn.forEach(r),Ca=l(b),ce=o(b,"DIV",{class:!0});var hr=n(ce);g(De.$$.fragment,hr),Sa=l(hr),Ne=o(hr,"P",{});var gr=n(Ne);Xa=i(gr,"Crops "),Lt=o(gr,"CODE",{});var Pn=n(Lt);Aa=i(Pn,"image"),Pn.forEach(r),Ya=i(gr,` to the given size using a center crop. Note that if the image is too small to be cropped to the
size given, it will be padded (so the returned result has the size asked).`),gr.forEach(r),hr.forEach(r),Ga=l(b),le=o(b,"DIV",{class:!0});var _r=n(le);g(Le.$$.fragment,_r),Ha=l(_r),Ze=o(_r,"P",{});var vr=n(Ze);Oa=i(vr,"Converts "),Zt=o(vr,"CODE",{});var kn=n(Zt);Qa=i(kn,"PIL.Image.Image"),kn.forEach(r),Ka=i(vr," to RGB format."),vr.forEach(r),_r.forEach(r),eo=l(b),de=o(b,"DIV",{class:!0});var xr=n(de);g(Ve.$$.fragment,xr),to=l(xr),Be=o(xr,"P",{});var yr=n(Be);ro=i(yr,"Expands 2-dimensional "),Vt=o(yr,"CODE",{});var jn=n(Vt);ao=i(jn,"image"),jn.forEach(r),oo=i(yr," to 3 dimensions."),yr.forEach(r),xr.forEach(r),no=l(b),me=o(b,"DIV",{class:!0});var br=n(me);g(Re.$$.fragment,br),so=l(br),O=o(br,"P",{});var lt=n(O);io=i(lt,"Flips the channel order of "),Bt=o(lt,"CODE",{});var Dn=n(Bt);co=i(Dn,"image"),Dn.forEach(r),lo=i(lt,` from RGB to BGR, or vice versa. Note that this will trigger a conversion of
`),Rt=o(lt,"CODE",{});var Nn=n(Rt);mo=i(Nn,"image"),Nn.forEach(r),po=i(lt," to a NumPy array if it\u2019s a PIL Image."),lt.forEach(r),br.forEach(r),fo=l(b),pe=o(b,"DIV",{class:!0});var Er=n(pe);g(qe.$$.fragment,Er),uo=l(Er),j=o(Er,"P",{});var q=n(j);ho=i(q,"Normalizes "),qt=o(q,"CODE",{});var Ln=n(qt);go=i(Ln,"image"),Ln.forEach(r),_o=i(q," with "),Wt=o(q,"CODE",{});var Zn=n(Wt);vo=i(Zn,"mean"),Zn.forEach(r),xo=i(q," and "),Ut=o(q,"CODE",{});var Vn=n(Ut);yo=i(Vn,"std"),Vn.forEach(r),bo=i(q,". Note that this will trigger a conversion of "),Ct=o(q,"CODE",{});var Bn=n(Ct);Eo=i(Bn,"image"),Bn.forEach(r),$o=i(q,` to a NumPy array
if it\u2019s a PIL Image.`),q.forEach(r),Er.forEach(r),wo=l(b),fe=o(b,"DIV",{class:!0});var $r=n(fe);g(We.$$.fragment,$r),Fo=l($r),St=o($r,"P",{});var Rn=n(St);Io=i(Rn,"Rescale a numpy image by scale amount"),Rn.forEach(r),$r.forEach(r),To=l(b),ue=o(b,"DIV",{class:!0});var wr=n(ue);g(Ue.$$.fragment,wr),Mo=l(wr),Ce=o(wr,"P",{});var Fr=n(Ce);zo=i(Fr,"Resizes "),Xt=o(Fr,"CODE",{});var qn=n(Xt);Jo=i(qn,"image"),qn.forEach(r),Po=i(Fr,". Enforces conversion of input to PIL.Image."),Fr.forEach(r),wr.forEach(r),ko=l(b),he=o(b,"DIV",{class:!0});var Ir=n(he);g(Se.$$.fragment,Ir),jo=l(Ir),Q=o(Ir,"P",{});var dt=n(Q);Do=i(dt,"Returns a rotated copy of "),At=o(dt,"CODE",{});var Wn=n(At);No=i(Wn,"image"),Wn.forEach(r),Lo=i(dt,". This method returns a copy of "),Yt=o(dt,"CODE",{});var Un=n(Yt);Zo=i(Un,"image"),Un.forEach(r),Vo=i(dt,`, rotated the given number of degrees
counter clockwise around its centre.`),dt.forEach(r),Ir.forEach(r),Bo=l(b),ge=o(b,"DIV",{class:!0});var Tr=n(ge);g(Xe.$$.fragment,Tr),Ro=l(Tr),Ae=o(Tr,"P",{});var Mr=n(Ae);qo=i(Mr,"Converts "),Gt=o(Mr,"CODE",{});var Cn=n(Gt);Wo=i(Cn,"image"),Cn.forEach(r),Uo=i(Mr,` to a numpy array. Optionally rescales it and puts the channel dimension as the first
dimension.`),Mr.forEach(r),Tr.forEach(r),Co=l(b),_e=o(b,"DIV",{class:!0});var zr=n(_e);g(Ye.$$.fragment,zr),So=l(zr),Ge=o(zr,"P",{});var Jr=n(Ge);Xo=i(Jr,"Converts "),Ht=o(Jr,"CODE",{});var Sn=n(Ht);Ao=i(Sn,"image"),Sn.forEach(r),Yo=i(Jr,` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),Jr.forEach(r),zr.forEach(r),b.forEach(r),this.h()},h(){d(u,"name","hf:doc:metadata"),d(u,"content",JSON.stringify(os)),d(w,"id","feature-extractor"),d(w,"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"),d(w,"href","#feature-extractor"),d($,"class","relative group"),d(K,"id","transformers.FeatureExtractionMixin"),d(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"),d(K,"href","#transformers.FeatureExtractionMixin"),d(C,"class","relative group"),d(Ke,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"),d(et,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),d(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(tt,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),d(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(re,"id","transformers.SequenceFeatureExtractor"),d(re,"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"),d(re,"href","#transformers.SequenceFeatureExtractor"),d(X,"class","relative group"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(oe,"id","transformers.BatchFeature"),d(oe,"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"),d(oe,"href","#transformers.BatchFeature"),d(Y,"class","relative group"),d(rt,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad"),d(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ie,"id","transformers.ImageFeatureExtractionMixin"),d(ie,"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"),d(ie,"href","#transformers.ImageFeatureExtractionMixin"),d(H,"class","relative group"),d(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,f){e(document.head,u),E(t,D,f),E(t,$,f),e($,w),e(w,T),_(m,T,null),e($,M),e($,W),e(W,U),E(t,z,f),E(t,J,f),e(J,Qe),e(J,mt),e(mt,Pr),e(J,kr),e(J,pt),e(pt,jr),e(J,Dr),E(t,Kt,f),E(t,C,f),e(C,K),e(K,ft),_(be,ft,null),e(C,Nr),e(C,ut),e(ut,Lr),E(t,er,f),E(t,P,f),_(Ee,P,null),e(P,Zr),e(P,ht),e(ht,Vr),e(P,Br),e(P,V),_($e,V,null),e(V,Rr),e(V,L),e(L,qr),e(L,Ke),e(Ke,Wr),e(L,Ur),e(L,gt),e(gt,Cr),e(L,Sr),e(L,et),e(et,Xr),e(L,Ar),e(V,Yr),_(ee,V,null),e(P,Gr),e(P,te),_(we,te,null),e(te,Hr),e(te,S),e(S,Or),e(S,_t),e(_t,Qr),e(S,Kr),e(S,tt),e(tt,ea),e(S,ta),E(t,tr,f),E(t,X,f),e(X,re),e(re,vt),_(Fe,vt,null),e(X,ra),e(X,xt),e(xt,aa),E(t,rr,f),E(t,Z,f),_(Ie,Z,null),e(Z,oa),e(Z,yt),e(yt,na),e(Z,sa),e(Z,N),_(Te,N,null),e(N,ia),e(N,bt),e(bt,ca),e(N,la),e(N,A),e(A,da),e(A,Et),e(Et,ma),e(A,pa),e(A,$t),e($t,fa),e(A,ua),e(N,ha),_(ae,N,null),E(t,ar,f),E(t,Y,f),e(Y,oe),e(oe,wt),_(Me,wt,null),e(Y,ga),e(Y,Ft),e(Ft,_a),E(t,or,f),E(t,I,f),_(ze,I,null),e(I,va),e(I,G),e(G,xa),e(G,rt),e(rt,ya),e(G,ba),e(G,It),e(It,Ea),e(G,$a),e(I,wa),e(I,Tt),e(Tt,Fa),e(I,Ia),e(I,ne),_(Je,ne,null),e(ne,Ta),e(ne,Mt),e(Mt,Ma),e(I,za),e(I,se),_(Pe,se,null),e(se,Ja),e(se,k),e(k,Pa),e(k,zt),e(zt,ka),e(k,ja),e(k,Jt),e(Jt,Da),e(k,Na),e(k,Pt),e(Pt,La),e(k,Za),e(k,kt),e(kt,Va),e(k,Ba),E(t,nr,f),E(t,H,f),e(H,ie),e(ie,jt),_(ke,jt,null),e(H,Ra),e(H,Dt),e(Dt,qa),E(t,sr,f),E(t,p,f),_(je,p,null),e(p,Wa),e(p,Nt),e(Nt,Ua),e(p,Ca),e(p,ce),_(De,ce,null),e(ce,Sa),e(ce,Ne),e(Ne,Xa),e(Ne,Lt),e(Lt,Aa),e(Ne,Ya),e(p,Ga),e(p,le),_(Le,le,null),e(le,Ha),e(le,Ze),e(Ze,Oa),e(Ze,Zt),e(Zt,Qa),e(Ze,Ka),e(p,eo),e(p,de),_(Ve,de,null),e(de,to),e(de,Be),e(Be,ro),e(Be,Vt),e(Vt,ao),e(Be,oo),e(p,no),e(p,me),_(Re,me,null),e(me,so),e(me,O),e(O,io),e(O,Bt),e(Bt,co),e(O,lo),e(O,Rt),e(Rt,mo),e(O,po),e(p,fo),e(p,pe),_(qe,pe,null),e(pe,uo),e(pe,j),e(j,ho),e(j,qt),e(qt,go),e(j,_o),e(j,Wt),e(Wt,vo),e(j,xo),e(j,Ut),e(Ut,yo),e(j,bo),e(j,Ct),e(Ct,Eo),e(j,$o),e(p,wo),e(p,fe),_(We,fe,null),e(fe,Fo),e(fe,St),e(St,Io),e(p,To),e(p,ue),_(Ue,ue,null),e(ue,Mo),e(ue,Ce),e(Ce,zo),e(Ce,Xt),e(Xt,Jo),e(Ce,Po),e(p,ko),e(p,he),_(Se,he,null),e(he,jo),e(he,Q),e(Q,Do),e(Q,At),e(At,No),e(Q,Lo),e(Q,Yt),e(Yt,Zo),e(Q,Vo),e(p,Bo),e(p,ge),_(Xe,ge,null),e(ge,Ro),e(ge,Ae),e(Ae,qo),e(Ae,Gt),e(Gt,Wo),e(Ae,Uo),e(p,Co),e(p,_e),_(Ye,_e,null),e(_e,So),e(_e,Ge),e(Ge,Xo),e(Ge,Ht),e(Ht,Ao),e(Ge,Yo),ir=!0},p(t,[f]){const He={};f&2&&(He.$$scope={dirty:f,ctx:t}),ee.$set(He);const Ot={};f&2&&(Ot.$$scope={dirty:f,ctx:t}),ae.$set(Ot)},i(t){ir||(v(m.$$.fragment,t),v(be.$$.fragment,t),v(Ee.$$.fragment,t),v($e.$$.fragment,t),v(ee.$$.fragment,t),v(we.$$.fragment,t),v(Fe.$$.fragment,t),v(Ie.$$.fragment,t),v(Te.$$.fragment,t),v(ae.$$.fragment,t),v(Me.$$.fragment,t),v(ze.$$.fragment,t),v(Je.$$.fragment,t),v(Pe.$$.fragment,t),v(ke.$$.fragment,t),v(je.$$.fragment,t),v(De.$$.fragment,t),v(Le.$$.fragment,t),v(Ve.$$.fragment,t),v(Re.$$.fragment,t),v(qe.$$.fragment,t),v(We.$$.fragment,t),v(Ue.$$.fragment,t),v(Se.$$.fragment,t),v(Xe.$$.fragment,t),v(Ye.$$.fragment,t),ir=!0)},o(t){x(m.$$.fragment,t),x(be.$$.fragment,t),x(Ee.$$.fragment,t),x($e.$$.fragment,t),x(ee.$$.fragment,t),x(we.$$.fragment,t),x(Fe.$$.fragment,t),x(Ie.$$.fragment,t),x(Te.$$.fragment,t),x(ae.$$.fragment,t),x(Me.$$.fragment,t),x(ze.$$.fragment,t),x(Je.$$.fragment,t),x(Pe.$$.fragment,t),x(ke.$$.fragment,t),x(je.$$.fragment,t),x(De.$$.fragment,t),x(Le.$$.fragment,t),x(Ve.$$.fragment,t),x(Re.$$.fragment,t),x(qe.$$.fragment,t),x(We.$$.fragment,t),x(Ue.$$.fragment,t),x(Se.$$.fragment,t),x(Xe.$$.fragment,t),x(Ye.$$.fragment,t),ir=!1},d(t){r(u),t&&r(D),t&&r($),y(m),t&&r(z),t&&r(J),t&&r(Kt),t&&r(C),y(be),t&&r(er),t&&r(P),y(Ee),y($e),y(ee),y(we),t&&r(tr),t&&r(X),y(Fe),t&&r(rr),t&&r(Z),y(Ie),y(Te),y(ae),t&&r(ar),t&&r(Y),y(Me),t&&r(or),t&&r(I),y(ze),y(Je),y(Pe),t&&r(nr),t&&r(H),y(ke),t&&r(sr),t&&r(p),y(je),y(De),y(Le),y(Ve),y(Re),y(qe),y(We),y(Ue),y(Se),y(Xe),y(Ye)}}}const os={local:"feature-extractor",sections:[{local:"transformers.FeatureExtractionMixin",title:"FeatureExtractionMixin"},{local:"transformers.SequenceFeatureExtractor",title:"SequenceFeatureExtractor"},{local:"transformers.BatchFeature",title:"BatchFeature"},{local:"transformers.ImageFeatureExtractionMixin",title:"ImageFeatureExtractionMixin"}],title:"Feature Extractor"};function ns(Oe){return Hn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ps extends Xn{constructor(u){super();An(this,u,ns,as,Yn,{})}}export{ps as default,os as metadata};
