import{s as Ko,f as ea,o as ta,n as rt}from"../chunks/scheduler.9bc65507.js";import{S as oa,i as aa,g as o,s as l,u as _,A as na,h as a,f as t,c as i,j as f,v as T,y as p,k as m,o as s,a as r,w as v,d as b,t as y,x as w}from"../chunks/index.78c82d43.js";import{T as Oo}from"../chunks/Tip.87d55b76.js";import{D as Je}from"../chunks/Docstring.4e7352e2.js";import{C as mo}from"../chunks/CodeBlock.73e038be.js";import{I as ke}from"../chunks/IconCopyLink.bedaa44d.js";import{E as co}from"../chunks/ExampleCodeBlock.872b014d.js";import{P as sa}from"../chunks/PipelineTag.75b0f707.js";function ra(S){let c,M="Example:",u,h,g;return h=new mo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEFTVENvbmZpZyUyQyUyMEFTVE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEFTVCUyME1JVCUyRmFzdC1maW5ldHVuZWQtYXVkaW9zZXQtMTAtMTAtMC40NTkzJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEFTVENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBNSVQlMkZhc3QtZmluZXR1bmVkLWF1ZGlvc2V0LTEwLTEwLTAuNDU5MyUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwQVNUTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ASTConfig, ASTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AST MIT/ast-finetuned-audioset-10-10-0.4593 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ASTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the MIT/ast-finetuned-audioset-10-10-0.4593 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ASTModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){c=o("p"),c.textContent=M,u=l(),_(h.$$.fragment)},l(d){c=a(d,"P",{"data-svelte-h":!0}),p(c)!=="svelte-11lpom8"&&(c.textContent=M),u=i(d),T(h.$$.fragment,d)},m(d,x){r(d,c,x),r(d,u,x),v(h,d,x),g=!0},p:rt,i(d){g||(b(h.$$.fragment,d),g=!0)},o(d){y(h.$$.fragment,d),g=!1},d(d){d&&(t(c),t(u)),w(h,d)}}}function la(S){let c,M=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=o("p"),c.innerHTML=M},l(u){c=a(u,"P",{"data-svelte-h":!0}),p(c)!=="svelte-fincs2"&&(c.innerHTML=M)},m(u,h){r(u,c,h)},p:rt,d(u){u&&t(c)}}}function ia(S){let c,M="Example:",u,h,g;return h=new mo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBU1RNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2RlbW8lMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkYXRhc2V0JTIwJTNEJTIwZGF0YXNldC5zb3J0KCUyMmlkJTIyKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMk1JVCUyRmFzdC1maW5ldHVuZWQtYXVkaW9zZXQtMTAtMTAtMC40NTkzJTIyKSUwQW1vZGVsJTIwJTNEJTIwQVNUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMk1JVCUyRmFzdC1maW5ldHVuZWQtYXVkaW9zZXQtMTAtMTAtMC40NTkzJTIyKSUwQSUwQSUyMyUyMGF1ZGlvJTIwZmlsZSUyMGlzJTIwZGVjb2RlZCUyMG9uJTIwdGhlJTIwZmx5JTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGRhdGFzZXQlNUIwJTVEJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUyQyUyMHNhbXBsaW5nX3JhdGUlM0RzYW1wbGluZ19yYXRlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, ASTModel
<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;hf-internal-testing/librispeech_asr_demo&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;MIT/ast-finetuned-audioset-10-10-0.4593&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ASTModel.from_pretrained(<span class="hljs-string">&quot;MIT/ast-finetuned-audioset-10-10-0.4593&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, 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">1214</span>, <span class="hljs-number">768</span>]`,wrap:!1}}),{c(){c=o("p"),c.textContent=M,u=l(),_(h.$$.fragment)},l(d){c=a(d,"P",{"data-svelte-h":!0}),p(c)!=="svelte-11lpom8"&&(c.textContent=M),u=i(d),T(h.$$.fragment,d)},m(d,x){r(d,c,x),r(d,u,x),v(h,d,x),g=!0},p:rt,i(d){g||(b(h.$$.fragment,d),g=!0)},o(d){y(h.$$.fragment,d),g=!1},d(d){d&&(t(c),t(u)),w(h,d)}}}function da(S){let c,M=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=o("p"),c.innerHTML=M},l(u){c=a(u,"P",{"data-svelte-h":!0}),p(c)!=="svelte-fincs2"&&(c.innerHTML=M)},m(u,h){r(u,c,h)},p:rt,d(u){u&&t(c)}}}function ca(S){let c,M="Example:",u,h,g;return h=new mo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9GZWF0dXJlRXh0cmFjdG9yJTJDJTIwQVNURm9yQXVkaW9DbGFzc2lmaWNhdGlvbiUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2RlbW8lMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkYXRhc2V0JTIwJTNEJTIwZGF0YXNldC5zb3J0KCUyMmlkJTIyKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IuZnJvbV9wcmV0cmFpbmVkKCUyMk1JVCUyRmFzdC1maW5ldHVuZWQtYXVkaW9zZXQtMTAtMTAtMC40NTkzJTIyKSUwQW1vZGVsJTIwJTNEJTIwQVNURm9yQXVkaW9DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyTUlUJTJGYXN0LWZpbmV0dW5lZC1hdWRpb3NldC0xMC0xMC0wLjQ1OTMlMjIpJTBBJTBBJTIzJTIwYXVkaW8lMjBmaWxlJTIwaXMlMjBkZWNvZGVkJTIwb24lMjB0aGUlMjBmbHklMEFpbnB1dHMlMjAlM0QlMjBmZWF0dXJlX2V4dHJhY3RvcihkYXRhc2V0JTVCMCU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyYXJyYXklMjIlNUQlMkMlMjBzYW1wbGluZ19yYXRlJTNEc2FtcGxpbmdfcmF0ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJnbWF4KGxvZ2l0cyUyQyUyMGRpbSUzRC0xKS5pdGVtKCklMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfY2xhc3NfaWRzJTVEJTBBcHJlZGljdGVkX2xhYmVsJTBBJTBBJTIzJTIwY29tcHV0ZSUyMGxvc3MlMjAtJTIwdGFyZ2V0X2xhYmVsJTIwaXMlMjBlLmcuJTIwJTIyZG93biUyMiUwQXRhcmdldF9sYWJlbCUyMCUzRCUyMG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QjAlNUQlMEFpbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCbW9kZWwuY29uZmlnLmxhYmVsMmlkJTVCdGFyZ2V0X2xhYmVsJTVEJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, ASTForAudioClassification
<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><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;MIT/ast-finetuned-audioset-10-10-0.4593&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ASTForAudioClassification.from_pretrained(<span class="hljs-string">&quot;MIT/ast-finetuned-audioset-10-10-0.4593&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, 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>predicted_class_ids = torch.argmax(logits, dim=-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = model.config.id2label[predicted_class_ids]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label
<span class="hljs-string">&#x27;Speech&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute loss - target_label is e.g. &quot;down&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_label = model.config.id2label[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = torch.tensor([model.config.label2id[target_label]])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.17</span>`,wrap:!1}}),{c(){c=o("p"),c.textContent=M,u=l(),_(h.$$.fragment)},l(d){c=a(d,"P",{"data-svelte-h":!0}),p(c)!=="svelte-11lpom8"&&(c.textContent=M),u=i(d),T(h.$$.fragment,d)},m(d,x){r(d,c,x),r(d,u,x),v(h,d,x),g=!0},p:rt,i(d){g||(b(h.$$.fragment,d),g=!0)},o(d){y(h.$$.fragment,d),g=!1},d(d){d&&(t(c),t(u)),w(h,d)}}}function ma(S){let c,M,u,h,g,d,x,oe,Et,je,po="Audio Spectrogram Transformer",lt,U,I,Qe,ae,Wt,Fe,uo="Overview",it,ne,ho=`The Audio Spectrogram Transformer model was proposed in <a href="https://arxiv.org/abs/2104.01778" rel="nofollow">AST: Audio Spectrogram Transformer</a> by Yuan Gong, Yu-An Chung, James Glass.
The Audio Spectrogram Transformer applies a <a href="vit">Vision Transformer</a> to audio, by turning audio into an image (spectrogram). The model obtains state-of-the-art results
for audio classification.`,dt,se,fo="The abstract from the paper is the following:",ct,re,go="<em>In the past decade, convolutional neural networks (CNNs) have been widely adopted as the main building block for end-to-end audio classification models, which aim to learn a direct mapping from audio spectrograms to corresponding labels. To better capture long-range global context, a recent trend is to add a self-attention mechanism on top of the CNN, forming a CNN-attention hybrid model. However, it is unclear whether the reliance on a CNN is necessary, and if neural networks purely based on attention are sufficient to obtain good performance in audio classification. In this paper, we answer the question by introducing the Audio Spectrogram Transformer (AST), the first convolution-free, purely attention-based model for audio classification. We evaluate AST on various audio classification benchmarks, where it achieves new state-of-the-art results of 0.485 mAP on AudioSet, 95.6% accuracy on ESC-50, and 98.1% accuracy on Speech Commands V2.</em>",mt,le,_o="Tips:",pt,ie,To=`<li>When fine-tuning the Audio Spectrogram Transformer (AST) on your own dataset, it’s recommended to take care of the input normalization (to make
sure the input has mean of 0 and std of 0.5). <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor">ASTFeatureExtractor</a> takes care of this. Note that it uses the AudioSet
mean and std by default. You can check <a href="https://github.com/YuanGongND/ast/blob/master/src/get_norm_stats.py" rel="nofollow"><code>ast/src/get_norm_stats.py</code></a> to see how
the authors compute the stats for a downstream dataset.</li> <li>Note that the AST needs a low learning rate (the authors use a 10 times smaller learning rate compared to their CNN model proposed in the
<a href="https://arxiv.org/abs/2102.01243" rel="nofollow">PSLA paper</a>) and converges quickly, so please search for a suitable learning rate and learning rate scheduler for your task.</li>`,ut,Z,vo,ht,de,bo='Audio pectrogram Transformer architecture. Taken from the <a href="https://arxiv.org/abs/2104.01778">original paper</a>.',ft,ce,yo=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/YuanGongND/ast" rel="nofollow">here</a>.`,gt,N,V,De,me,It,Ue,wo="Resources",_t,pe,Mo="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with the Audio Spectrogram Transformer.",Tt,ue,vt,he,xo='<li>A notebook illustrating inference with AST for audio classification can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/AST" rel="nofollow">here</a>.</li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification">ASTForAudioClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb" rel="nofollow">notebook</a>.</li> <li>See also: <a href="../tasks/audio_classification">Audio classification</a>.</li>',bt,fe,Co="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",yt,G,q,Oe,ge,Zt,Ne,$o="ASTConfig",wt,$,_e,Vt,Ge,Ao=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel">ASTModel</a>. It is used to instantiate an AST
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 AST
<a href="https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593" rel="nofollow">MIT/ast-finetuned-audioset-10-10-0.4593</a>
architecture.`,qt,ze,So=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Rt,R,Mt,z,X,Ke,Te,Xt,Ee,Jo="ASTFeatureExtractor",xt,C,ve,Bt,We,ko="Constructs a Audio Spectrogram Transformer (AST) feature extractor.",Yt,Ie,jo=`This feature extractor inherits from <a href="/docs/transformers/v4.34.0/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor">SequenceFeatureExtractor</a> which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`,Ht,Ze,Fo=`This class extracts mel-filter bank features from raw speech using TorchAudio, pads/truncates them to a fixed
length and normalizes them using a mean and standard deviation.`,Lt,B,be,Pt,Ve,Uo="Main method to featurize and prepare for the model one or several sequence(s).",Ct,E,Y,et,ye,Qt,qe,No="ASTModel",$t,j,we,Dt,Re,Go=`The bare AST Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Ot,J,Me,Kt,Xe,zo='The <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel">ASTModel</a> forward method, overrides the <code>__call__</code> special method.',eo,H,to,L,At,W,P,tt,xe,oo,Be,Eo="ASTForAudioClassification",St,A,Ce,ao,Ye,Wo=`Audio Spectrogram Transformer model with an audio classification head on top (a linear layer on top of the pooled
output) e.g. for datasets like AudioSet, Speech Commands v2.`,no,He,Io=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,so,k,$e,ro,Le,Zo='The <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification">ASTForAudioClassification</a> forward method, overrides the <code>__call__</code> special method.',lo,Q,io,D,Jt,ot,kt;return oe=new ke({}),ae=new ke({}),me=new ke({}),ue=new sa({props:{pipeline:"audio-classification"}}),ge=new ke({}),_e=new Je({props:{name:"class transformers.ASTConfig",anchor:"transformers.ASTConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"patch_size",val:" = 16"},{name:"qkv_bias",val:" = True"},{name:"frequency_stride",val:" = 10"},{name:"time_stride",val:" = 10"},{name:"max_length",val:" = 1024"},{name:"num_mel_bins",val:" = 128"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ASTConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ASTConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ASTConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ASTConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ASTConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. 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.ASTConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ASTConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ASTConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ASTConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ASTConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ASTConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.ASTConfig.frequency_stride",description:`<strong>frequency_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Frequency stride to use when patchifying the spectrograms.`,name:"frequency_stride"},{anchor:"transformers.ASTConfig.time_stride",description:`<strong>time_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Temporal stride to use when patchifying the spectrograms.`,name:"time_stride"},{anchor:"transformers.ASTConfig.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Temporal dimension of the spectrograms.`,name:"max_length"},{anchor:"transformers.ASTConfig.num_mel_bins",description:`<strong>num_mel_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Frequency dimension of the spectrograms (number of Mel-frequency bins).`,name:"num_mel_bins"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py#L31"}}),R=new co({props:{anchor:"transformers.ASTConfig.example",$$slots:{default:[ra]},$$scope:{ctx:S}}}),Te=new ke({}),ve=new Je({props:{name:"class transformers.ASTFeatureExtractor",anchor:"transformers.ASTFeatureExtractor",parameters:[{name:"feature_size",val:" = 1"},{name:"sampling_rate",val:" = 16000"},{name:"num_mel_bins",val:" = 128"},{name:"max_length",val:" = 1024"},{name:"padding_value",val:" = 0.0"},{name:"do_normalize",val:" = True"},{name:"mean",val:" = -4.2677393"},{name:"std",val:" = 4.5689974"},{name:"return_attention_mask",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ASTFeatureExtractor.feature_size",description:`<strong>feature_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The feature dimension of the extracted features.`,name:"feature_size"},{anchor:"transformers.ASTFeatureExtractor.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 16000) &#x2014;
The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.ASTFeatureExtractor.num_mel_bins",description:`<strong>num_mel_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of Mel-frequency bins.`,name:"num_mel_bins"},{anchor:"transformers.ASTFeatureExtractor.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Maximum length to which to pad/truncate the extracted features.`,name:"max_length"},{anchor:"transformers.ASTFeatureExtractor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the log-Mel features using <code>mean</code> and <code>std</code>.`,name:"do_normalize"},{anchor:"transformers.ASTFeatureExtractor.mean",description:`<strong>mean</strong> (<code>float</code>, <em>optional</em>, defaults to -4.2677393) &#x2014;
The mean value used to normalize the log-Mel features. Uses the AudioSet mean by default.`,name:"mean"},{anchor:"transformers.ASTFeatureExtractor.std",description:`<strong>std</strong> (<code>float</code>, <em>optional</em>, defaults to 4.5689974) &#x2014;
The standard deviation value used to normalize the log-Mel features. Uses the AudioSet standard deviation
by default.`,name:"std"},{anchor:"transformers.ASTFeatureExtractor.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a> should return <code>attention_mask</code>.`,name:"return_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L33"}}),be=new Je({props:{name:"__call__",anchor:"transformers.ASTFeatureExtractor.__call__",parameters:[{name:"raw_speech",val:": typing.Union[numpy.ndarray, typing.List[float], typing.List[numpy.ndarray], typing.List[typing.List[float]]]"},{name:"sampling_rate",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ASTFeatureExtractor.__call__.raw_speech",description:`<strong>raw_speech</strong> (<code>np.ndarray</code>, <code>List[float]</code>, <code>List[np.ndarray]</code>, <code>List[List[float]]</code>) &#x2014;
The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float
values, a list of numpy arrays or a list of list of float values. Must be mono channel audio, not
stereo, i.e. single float per timestep.`,name:"raw_speech"},{anchor:"transformers.ASTFeatureExtractor.__call__.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The sampling rate at which the <code>raw_speech</code> input was sampled. It is strongly recommended to pass
<code>sampling_rate</code> at the forward call to prevent silent errors.`,name:"sampling_rate"},{anchor:"transformers.ASTFeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L125"}}),ye=new ke({}),we=new Je({props:{name:"class transformers.ASTModel",anchor:"transformers.ASTModel",parameters:[{name:"config",val:": ASTConfig"}],parametersDescription:[{anchor:"transformers.ASTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</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.34.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.34.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L445"}}),Me=new Je({props:{name:"forward",anchor:"transformers.ASTModel.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ASTModel.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, max_length, num_mel_bins)</code>) &#x2014;
Float values mel features extracted from the raw audio waveform. Raw audio waveform can be obtained by
loading a <code>.flac</code> or <code>.wav</code> audio file into an array of type <code>List[float]</code> or a <code>numpy.ndarray</code>, <em>e.g.</em> via
the soundfile library (<code>pip install soundfile</code>). To prepare the array into <code>input_features</code>, the
<a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTModel.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.ASTModel.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.34.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.34.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L469",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</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.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — 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>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</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>) — 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, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new Oo({props:{$$slots:{default:[la]},$$scope:{ctx:S}}}),L=new co({props:{anchor:"transformers.ASTModel.forward.example",$$slots:{default:[ia]},$$scope:{ctx:S}}}),xe=new ke({}),Ce=new Je({props:{name:"class transformers.ASTForAudioClassification",anchor:"transformers.ASTForAudioClassification",parameters:[{name:"config",val:": ASTConfig"}],parametersDescription:[{anchor:"transformers.ASTForAudioClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</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.34.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.34.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L545"}}),$e=new Je({props:{name:"forward",anchor:"transformers.ASTForAudioClassification.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ASTForAudioClassification.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, max_length, num_mel_bins)</code>) &#x2014;
Float values mel features extracted from the raw audio waveform. Raw audio waveform can be obtained by
loading a <code>.flac</code> or <code>.wav</code> audio file into an array of type <code>List[float]</code> or a <code>numpy.ndarray</code>, <em>e.g.</em> via
the soundfile library (<code>pip install soundfile</code>). To prepare the array into <code>input_features</code>, the
<a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/v4.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTForAudioClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTForAudioClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTForAudioClassification.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.ASTForAudioClassification.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.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ASTForAudioClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the audio classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), 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.34.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L558",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</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.34.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</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>) — 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, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Q=new Oo({props:{$$slots:{default:[da]},$$scope:{ctx:S}}}),D=new co({props:{anchor:"transformers.ASTForAudioClassification.forward.example",$$slots:{default:[ca]},$$scope:{ctx:S}}}),{c(){c=o("meta"),M=l(),u=o("p"),h=l(),g=o("h1"),d=o("a"),x=o("span"),_(oe.$$.fragment),Et=l(),je=o("span"),je.textContent=po,lt=l(),U=o("h2"),I=o("a"),Qe=o("span"),_(ae.$$.fragment),Wt=l(),Fe=o("span"),Fe.textContent=uo,it=l(),ne=o("p"),ne.innerHTML=ho,dt=l(),se=o("p"),se.textContent=fo,ct=l(),re=o("p"),re.innerHTML=go,mt=l(),le=o("p"),le.textContent=_o,pt=l(),ie=o("ul"),ie.innerHTML=To,ut=l(),Z=o("img"),ht=l(),de=o("small"),de.innerHTML=bo,ft=l(),ce=o("p"),ce.innerHTML=yo,gt=l(),N=o("h2"),V=o("a"),De=o("span"),_(me.$$.fragment),It=l(),Ue=o("span"),Ue.textContent=wo,_t=l(),pe=o("p"),pe.textContent=Mo,Tt=l(),_(ue.$$.fragment),vt=l(),he=o("ul"),he.innerHTML=xo,bt=l(),fe=o("p"),fe.textContent=Co,yt=l(),G=o("h2"),q=o("a"),Oe=o("span"),_(ge.$$.fragment),Zt=l(),Ne=o("span"),Ne.textContent=$o,wt=l(),$=o("div"),_(_e.$$.fragment),Vt=l(),Ge=o("p"),Ge.innerHTML=Ao,qt=l(),ze=o("p"),ze.innerHTML=So,Rt=l(),_(R.$$.fragment),Mt=l(),z=o("h2"),X=o("a"),Ke=o("span"),_(Te.$$.fragment),Xt=l(),Ee=o("span"),Ee.textContent=Jo,xt=l(),C=o("div"),_(ve.$$.fragment),Bt=l(),We=o("p"),We.textContent=ko,Yt=l(),Ie=o("p"),Ie.innerHTML=jo,Ht=l(),Ze=o("p"),Ze.textContent=Fo,Lt=l(),B=o("div"),_(be.$$.fragment),Pt=l(),Ve=o("p"),Ve.textContent=Uo,Ct=l(),E=o("h2"),Y=o("a"),et=o("span"),_(ye.$$.fragment),Qt=l(),qe=o("span"),qe.textContent=No,$t=l(),j=o("div"),_(we.$$.fragment),Dt=l(),Re=o("p"),Re.innerHTML=Go,Ot=l(),J=o("div"),_(Me.$$.fragment),Kt=l(),Xe=o("p"),Xe.innerHTML=zo,eo=l(),_(H.$$.fragment),to=l(),_(L.$$.fragment),At=l(),W=o("h2"),P=o("a"),tt=o("span"),_(xe.$$.fragment),oo=l(),Be=o("span"),Be.textContent=Eo,St=l(),A=o("div"),_(Ce.$$.fragment),ao=l(),Ye=o("p"),Ye.textContent=Wo,no=l(),He=o("p"),He.innerHTML=Io,so=l(),k=o("div"),_($e.$$.fragment),ro=l(),Le=o("p"),Le.innerHTML=Zo,lo=l(),_(Q.$$.fragment),io=l(),_(D.$$.fragment),Jt=l(),ot=o("p"),this.h()},l(e){const n=na("svelte-1phssyn",document.head);c=a(n,"META",{name:!0,content:!0}),n.forEach(t),M=i(e),u=a(e,"P",{}),f(u).forEach(t),h=i(e),g=a(e,"H1",{class:!0});var Ae=f(g);d=a(Ae,"A",{id:!0,class:!0,href:!0});var at=f(d);x=a(at,"SPAN",{});var nt=f(x);T(oe.$$.fragment,nt),nt.forEach(t),at.forEach(t),Et=i(Ae),je=a(Ae,"SPAN",{"data-svelte-h":!0}),p(je)!=="svelte-lzd5ln"&&(je.textContent=po),Ae.forEach(t),lt=i(e),U=a(e,"H2",{class:!0});var Se=f(U);I=a(Se,"A",{id:!0,class:!0,href:!0});var st=f(I);Qe=a(st,"SPAN",{});var Vo=f(Qe);T(ae.$$.fragment,Vo),Vo.forEach(t),st.forEach(t),Wt=i(Se),Fe=a(Se,"SPAN",{"data-svelte-h":!0}),p(Fe)!=="svelte-1jsw1pg"&&(Fe.textContent=uo),Se.forEach(t),it=i(e),ne=a(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-q8s2fy"&&(ne.innerHTML=ho),dt=i(e),se=a(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-vfdo9a"&&(se.textContent=fo),ct=i(e),re=a(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-oul8j1"&&(re.innerHTML=go),mt=i(e),le=a(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-axv494"&&(le.textContent=_o),pt=i(e),ie=a(e,"UL",{"data-svelte-h":!0}),p(ie)!=="svelte-12y6iz7"&&(ie.innerHTML=To),ut=i(e),Z=a(e,"IMG",{src:!0,alt:!0,width:!0}),ht=i(e),de=a(e,"SMALL",{"data-svelte-h":!0}),p(de)!=="svelte-794mev"&&(de.innerHTML=bo),ft=i(e),ce=a(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-bcz63p"&&(ce.innerHTML=yo),gt=i(e),N=a(e,"H2",{class:!0});var jt=f(N);V=a(jt,"A",{id:!0,class:!0,href:!0});var qo=f(V);De=a(qo,"SPAN",{});var Ro=f(De);T(me.$$.fragment,Ro),Ro.forEach(t),qo.forEach(t),It=i(jt),Ue=a(jt,"SPAN",{"data-svelte-h":!0}),p(Ue)!=="svelte-w4zzv6"&&(Ue.textContent=wo),jt.forEach(t),_t=i(e),pe=a(e,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-w2mpe2"&&(pe.textContent=Mo),Tt=i(e),T(ue.$$.fragment,e),vt=i(e),he=a(e,"UL",{"data-svelte-h":!0}),p(he)!=="svelte-1trm9io"&&(he.innerHTML=xo),bt=i(e),fe=a(e,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-1xesile"&&(fe.textContent=Co),yt=i(e),G=a(e,"H2",{class:!0});var Ft=f(G);q=a(Ft,"A",{id:!0,class:!0,href:!0});var Xo=f(q);Oe=a(Xo,"SPAN",{});var Bo=f(Oe);T(ge.$$.fragment,Bo),Bo.forEach(t),Xo.forEach(t),Zt=i(Ft),Ne=a(Ft,"SPAN",{"data-svelte-h":!0}),p(Ne)!=="svelte-w6uyhp"&&(Ne.textContent=$o),Ft.forEach(t),wt=i(e),$=a(e,"DIV",{class:!0});var O=f($);T(_e.$$.fragment,O),Vt=i(O),Ge=a(O,"P",{"data-svelte-h":!0}),p(Ge)!=="svelte-1uto2c7"&&(Ge.innerHTML=Ao),qt=i(O),ze=a(O,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-10kqkkl"&&(ze.innerHTML=So),Rt=i(O),T(R.$$.fragment,O),O.forEach(t),Mt=i(e),z=a(e,"H2",{class:!0});var Ut=f(z);X=a(Ut,"A",{id:!0,class:!0,href:!0});var Yo=f(X);Ke=a(Yo,"SPAN",{});var Ho=f(Ke);T(Te.$$.fragment,Ho),Ho.forEach(t),Yo.forEach(t),Xt=i(Ut),Ee=a(Ut,"SPAN",{"data-svelte-h":!0}),p(Ee)!=="svelte-12t8l3t"&&(Ee.textContent=Jo),Ut.forEach(t),xt=i(e),C=a(e,"DIV",{class:!0});var F=f(C);T(ve.$$.fragment,F),Bt=i(F),We=a(F,"P",{"data-svelte-h":!0}),p(We)!=="svelte-1vcyh3y"&&(We.textContent=ko),Yt=i(F),Ie=a(F,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-bnr2z1"&&(Ie.innerHTML=jo),Ht=i(F),Ze=a(F,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-uq4h1m"&&(Ze.textContent=Fo),Lt=i(F),B=a(F,"DIV",{class:!0});var Nt=f(B);T(be.$$.fragment,Nt),Pt=i(Nt),Ve=a(Nt,"P",{"data-svelte-h":!0}),p(Ve)!=="svelte-1a6wgfx"&&(Ve.textContent=Uo),Nt.forEach(t),F.forEach(t),Ct=i(e),E=a(e,"H2",{class:!0});var Gt=f(E);Y=a(Gt,"A",{id:!0,class:!0,href:!0});var Lo=f(Y);et=a(Lo,"SPAN",{});var Po=f(et);T(ye.$$.fragment,Po),Po.forEach(t),Lo.forEach(t),Qt=i(Gt),qe=a(Gt,"SPAN",{"data-svelte-h":!0}),p(qe)!=="svelte-h2kk9i"&&(qe.textContent=No),Gt.forEach(t),$t=i(e),j=a(e,"DIV",{class:!0});var Pe=f(j);T(we.$$.fragment,Pe),Dt=i(Pe),Re=a(Pe,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-1eae68l"&&(Re.innerHTML=Go),Ot=i(Pe),J=a(Pe,"DIV",{class:!0});var K=f(J);T(Me.$$.fragment,K),Kt=i(K),Xe=a(K,"P",{"data-svelte-h":!0}),p(Xe)!=="svelte-aecsz3"&&(Xe.innerHTML=zo),eo=i(K),T(H.$$.fragment,K),to=i(K),T(L.$$.fragment,K),K.forEach(t),Pe.forEach(t),At=i(e),W=a(e,"H2",{class:!0});var zt=f(W);P=a(zt,"A",{id:!0,class:!0,href:!0});var Qo=f(P);tt=a(Qo,"SPAN",{});var Do=f(tt);T(xe.$$.fragment,Do),Do.forEach(t),Qo.forEach(t),oo=i(zt),Be=a(zt,"SPAN",{"data-svelte-h":!0}),p(Be)!=="svelte-etlms"&&(Be.textContent=Eo),zt.forEach(t),St=i(e),A=a(e,"DIV",{class:!0});var ee=f(A);T(Ce.$$.fragment,ee),ao=i(ee),Ye=a(ee,"P",{"data-svelte-h":!0}),p(Ye)!=="svelte-1b8t75l"&&(Ye.textContent=Wo),no=i(ee),He=a(ee,"P",{"data-svelte-h":!0}),p(He)!=="svelte-1gjh92c"&&(He.innerHTML=Io),so=i(ee),k=a(ee,"DIV",{class:!0});var te=f(k);T($e.$$.fragment,te),ro=i(te),Le=a(te,"P",{"data-svelte-h":!0}),p(Le)!=="svelte-6dbq7t"&&(Le.innerHTML=Zo),lo=i(te),T(Q.$$.fragment,te),io=i(te),T(D.$$.fragment,te),te.forEach(t),ee.forEach(t),Jt=i(e),ot=a(e,"P",{}),f(ot).forEach(t),this.h()},h(){m(c,"name","hf:doc:metadata"),m(c,"content",JSON.stringify(pa)),m(d,"id","audio-spectrogram-transformer"),m(d,"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"),m(d,"href","#audio-spectrogram-transformer"),m(g,"class","relative group"),m(I,"id","overview"),m(I,"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"),m(I,"href","#overview"),m(U,"class","relative group"),ea(Z.src,vo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/audio_spectogram_transformer_architecture.png")||m(Z,"src",vo),m(Z,"alt","drawing"),m(Z,"width","600"),m(V,"id","resources"),m(V,"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"),m(V,"href","#resources"),m(N,"class","relative group"),m(q,"id","transformers.ASTConfig"),m(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"),m(q,"href","#transformers.ASTConfig"),m(G,"class","relative group"),m($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(X,"id","transformers.ASTFeatureExtractor"),m(X,"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"),m(X,"href","#transformers.ASTFeatureExtractor"),m(z,"class","relative group"),m(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Y,"id","transformers.ASTModel"),m(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"),m(Y,"href","#transformers.ASTModel"),m(E,"class","relative group"),m(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(P,"id","transformers.ASTForAudioClassification"),m(P,"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"),m(P,"href","#transformers.ASTForAudioClassification"),m(W,"class","relative group"),m(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){s(document.head,c),r(e,M,n),r(e,u,n),r(e,h,n),r(e,g,n),s(g,d),s(d,x),v(oe,x,null),s(g,Et),s(g,je),r(e,lt,n),r(e,U,n),s(U,I),s(I,Qe),v(ae,Qe,null),s(U,Wt),s(U,Fe),r(e,it,n),r(e,ne,n),r(e,dt,n),r(e,se,n),r(e,ct,n),r(e,re,n),r(e,mt,n),r(e,le,n),r(e,pt,n),r(e,ie,n),r(e,ut,n),r(e,Z,n),r(e,ht,n),r(e,de,n),r(e,ft,n),r(e,ce,n),r(e,gt,n),r(e,N,n),s(N,V),s(V,De),v(me,De,null),s(N,It),s(N,Ue),r(e,_t,n),r(e,pe,n),r(e,Tt,n),v(ue,e,n),r(e,vt,n),r(e,he,n),r(e,bt,n),r(e,fe,n),r(e,yt,n),r(e,G,n),s(G,q),s(q,Oe),v(ge,Oe,null),s(G,Zt),s(G,Ne),r(e,wt,n),r(e,$,n),v(_e,$,null),s($,Vt),s($,Ge),s($,qt),s($,ze),s($,Rt),v(R,$,null),r(e,Mt,n),r(e,z,n),s(z,X),s(X,Ke),v(Te,Ke,null),s(z,Xt),s(z,Ee),r(e,xt,n),r(e,C,n),v(ve,C,null),s(C,Bt),s(C,We),s(C,Yt),s(C,Ie),s(C,Ht),s(C,Ze),s(C,Lt),s(C,B),v(be,B,null),s(B,Pt),s(B,Ve),r(e,Ct,n),r(e,E,n),s(E,Y),s(Y,et),v(ye,et,null),s(E,Qt),s(E,qe),r(e,$t,n),r(e,j,n),v(we,j,null),s(j,Dt),s(j,Re),s(j,Ot),s(j,J),v(Me,J,null),s(J,Kt),s(J,Xe),s(J,eo),v(H,J,null),s(J,to),v(L,J,null),r(e,At,n),r(e,W,n),s(W,P),s(P,tt),v(xe,tt,null),s(W,oo),s(W,Be),r(e,St,n),r(e,A,n),v(Ce,A,null),s(A,ao),s(A,Ye),s(A,no),s(A,He),s(A,so),s(A,k),v($e,k,null),s(k,ro),s(k,Le),s(k,lo),v(Q,k,null),s(k,io),v(D,k,null),r(e,Jt,n),r(e,ot,n),kt=!0},p(e,[n]){const Ae={};n&2&&(Ae.$$scope={dirty:n,ctx:e}),R.$set(Ae);const at={};n&2&&(at.$$scope={dirty:n,ctx:e}),H.$set(at);const nt={};n&2&&(nt.$$scope={dirty:n,ctx:e}),L.$set(nt);const Se={};n&2&&(Se.$$scope={dirty:n,ctx:e}),Q.$set(Se);const st={};n&2&&(st.$$scope={dirty:n,ctx:e}),D.$set(st)},i(e){kt||(b(oe.$$.fragment,e),b(ae.$$.fragment,e),b(me.$$.fragment,e),b(ue.$$.fragment,e),b(ge.$$.fragment,e),b(_e.$$.fragment,e),b(R.$$.fragment,e),b(Te.$$.fragment,e),b(ve.$$.fragment,e),b(be.$$.fragment,e),b(ye.$$.fragment,e),b(we.$$.fragment,e),b(Me.$$.fragment,e),b(H.$$.fragment,e),b(L.$$.fragment,e),b(xe.$$.fragment,e),b(Ce.$$.fragment,e),b($e.$$.fragment,e),b(Q.$$.fragment,e),b(D.$$.fragment,e),kt=!0)},o(e){y(oe.$$.fragment,e),y(ae.$$.fragment,e),y(me.$$.fragment,e),y(ue.$$.fragment,e),y(ge.$$.fragment,e),y(_e.$$.fragment,e),y(R.$$.fragment,e),y(Te.$$.fragment,e),y(ve.$$.fragment,e),y(be.$$.fragment,e),y(ye.$$.fragment,e),y(we.$$.fragment,e),y(Me.$$.fragment,e),y(H.$$.fragment,e),y(L.$$.fragment,e),y(xe.$$.fragment,e),y(Ce.$$.fragment,e),y($e.$$.fragment,e),y(Q.$$.fragment,e),y(D.$$.fragment,e),kt=!1},d(e){e&&(t(M),t(u),t(h),t(g),t(lt),t(U),t(it),t(ne),t(dt),t(se),t(ct),t(re),t(mt),t(le),t(pt),t(ie),t(ut),t(Z),t(ht),t(de),t(ft),t(ce),t(gt),t(N),t(_t),t(pe),t(Tt),t(vt),t(he),t(bt),t(fe),t(yt),t(G),t(wt),t($),t(Mt),t(z),t(xt),t(C),t(Ct),t(E),t($t),t(j),t(At),t(W),t(St),t(A),t(Jt),t(ot)),t(c),w(oe),w(ae),w(me),w(ue,e),w(ge),w(_e),w(R),w(Te),w(ve),w(be),w(ye),w(we),w(Me),w(H),w(L),w(xe),w(Ce),w($e),w(Q),w(D)}}}const pa={local:"audio-spectrogram-transformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.ASTConfig",title:"ASTConfig"},{local:"transformers.ASTFeatureExtractor",title:"ASTFeatureExtractor"},{local:"transformers.ASTModel",title:"ASTModel"},{local:"transformers.ASTForAudioClassification",title:"ASTForAudioClassification"}],title:"Audio Spectrogram Transformer"};function ua(S){return ta(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wa extends oa{constructor(c){super(),aa(this,c,ua,ma,Ko,{})}}export{wa as component};
