import{s as Rt,f as Xt,o as Bt,n as Je}from"../chunks/scheduler.9bc65507.js";import{S as Yt,i as Ht,g as l,s as r,r as f,A as Lt,h as d,f as o,c as i,j as z,u as h,x as u,k as j,y as c,a,v as g,d as _,t as T,w as b}from"../chunks/index.707bf1b6.js";import{T as qt}from"../chunks/Tip.c2ecdbf4.js";import{D as he}from"../chunks/Docstring.17db21ae.js";import{C as bt}from"../chunks/CodeBlock.54a9f38d.js";import{E as Tt}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{P as Qt}from"../chunks/PipelineTag.44585822.js";import{H as ge}from"../chunks/Heading.342b1fa6.js";function Pt(A){let n,w="Example:",m,p,y;return p=new bt({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(){n=l("p"),n.textContent=w,m=r(),f(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),u(n)!=="svelte-11lpom8"&&(n.textContent=w),m=i(s),h(p.$$.fragment,s)},m(s,M){a(s,n,M),a(s,m,M),g(p,s,M),y=!0},p:Je,i(s){y||(_(p.$$.fragment,s),y=!0)},o(s){T(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),b(p,s)}}}function Dt(A){let n,w=`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(){n=l("p"),n.innerHTML=w},l(m){n=d(m,"P",{"data-svelte-h":!0}),u(n)!=="svelte-fincs2"&&(n.innerHTML=w)},m(m,p){a(m,n,p)},p:Je,d(m){m&&o(n)}}}function Ot(A){let n,w="Example:",m,p,y;return p=new bt({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(){n=l("p"),n.textContent=w,m=r(),f(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),u(n)!=="svelte-11lpom8"&&(n.textContent=w),m=i(s),h(p.$$.fragment,s)},m(s,M){a(s,n,M),a(s,m,M),g(p,s,M),y=!0},p:Je,i(s){y||(_(p.$$.fragment,s),y=!0)},o(s){T(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),b(p,s)}}}function Kt(A){let n,w=`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(){n=l("p"),n.innerHTML=w},l(m){n=d(m,"P",{"data-svelte-h":!0}),u(n)!=="svelte-fincs2"&&(n.innerHTML=w)},m(m,p){a(m,n,p)},p:Je,d(m){m&&o(n)}}}function eo(A){let n,w="Example:",m,p,y;return p=new bt({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(){n=l("p"),n.textContent=w,m=r(),f(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),u(n)!=="svelte-11lpom8"&&(n.textContent=w),m=i(s),h(p.$$.fragment,s)},m(s,M){a(s,n,M),a(s,m,M),g(p,s,M),y=!0},p:Je,i(s){y||(_(p.$$.fragment,s),y=!0)},o(s){T(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),b(p,s)}}}function to(A){let n,w,m,p,y,s,M,je,B,yt=`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.`,Fe,Y,wt="The abstract from the paper is the following:",Ue,H,Mt="<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>",ke,L,vt="Tips:",Ge,Q,$t=`<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/main/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>`,ze,W,xt,We,P,Ct='Audio pectrogram Transformer architecture. Taken from the <a href="https://arxiv.org/abs/2104.01778">original paper</a>.',Ne,D,At=`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>.`,Ie,O,Ze,K,St="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with the Audio Spectrogram Transformer.",Ve,ee,Ee,te,Jt='<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/main/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>',qe,oe,jt="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.",Re,ae,Xe,$,ne,Ke,_e,Ft=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/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.`,et,Te,Ut=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,tt,N,Be,se,Ye,v,re,ot,be,kt="Constructs a Audio Spectrogram Transformer (AST) feature extractor.",at,ye,Gt=`This feature extractor inherits from <a href="/docs/transformers/main/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.`,nt,we,zt=`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.`,st,I,ie,rt,Me,Wt="Main method to featurize and prepare for the model one or several sequence(s).",He,le,Le,F,de,it,ve,Nt=`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.`,lt,S,ce,dt,$e,It='The <a href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel">ASTModel</a> forward method, overrides the <code>__call__</code> special method.',ct,Z,mt,V,Qe,me,Pe,x,pe,pt,xe,Zt=`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.`,ut,Ce,Vt=`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.`,ft,J,ue,ht,Ae,Et='The <a href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification">ASTForAudioClassification</a> forward method, overrides the <code>__call__</code> special method.',gt,E,_t,q,De,Se,Oe;return y=new ge({props:{title:"Audio Spectrogram Transformer",local:"audio-spectrogram-transformer",headingTag:"h1"}}),M=new ge({props:{title:"Overview",local:"overview",headingTag:"h2"}}),O=new ge({props:{title:"Resources",local:"resources",headingTag:"h2"}}),ee=new Qt({props:{pipeline:"audio-classification"}}),ae=new ge({props:{title:"ASTConfig",local:"transformers.ASTConfig",headingTag:"h2"}}),ne=new he({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.0) &#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.0) &#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 16) &#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/main/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py#L31"}}),N=new Tt({props:{anchor:"transformers.ASTConfig.example",$$slots:{default:[Pt]},$$scope:{ctx:A}}}),se=new ge({props:{title:"ASTFeatureExtractor",local:"transformers.ASTFeatureExtractor",headingTag:"h2"}}),re=new he({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/main/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/main/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L33"}}),ie=new he({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/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/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L125"}}),le=new ge({props:{title:"ASTModel",local:"transformers.ASTModel",headingTag:"h2"}}),de=new he({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/main/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/main/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/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L445"}}),ce=new he({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/main/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/main/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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L469",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Z=new qt({props:{$$slots:{default:[Dt]},$$scope:{ctx:A}}}),V=new Tt({props:{anchor:"transformers.ASTModel.forward.example",$$slots:{default:[Ot]},$$scope:{ctx:A}}}),me=new ge({props:{title:"ASTForAudioClassification",local:"transformers.ASTForAudioClassification",headingTag:"h2"}}),pe=new he({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/main/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/main/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/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L545"}}),ue=new he({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/main/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/main/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/main/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/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L558",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),E=new qt({props:{$$slots:{default:[Kt]},$$scope:{ctx:A}}}),q=new Tt({props:{anchor:"transformers.ASTForAudioClassification.forward.example",$$slots:{default:[eo]},$$scope:{ctx:A}}}),{c(){n=l("meta"),w=r(),m=l("p"),p=r(),f(y.$$.fragment),s=r(),f(M.$$.fragment),je=r(),B=l("p"),B.innerHTML=yt,Fe=r(),Y=l("p"),Y.textContent=wt,Ue=r(),H=l("p"),H.innerHTML=Mt,ke=r(),L=l("p"),L.textContent=vt,Ge=r(),Q=l("ul"),Q.innerHTML=$t,ze=r(),W=l("img"),We=r(),P=l("small"),P.innerHTML=Ct,Ne=r(),D=l("p"),D.innerHTML=At,Ie=r(),f(O.$$.fragment),Ze=r(),K=l("p"),K.textContent=St,Ve=r(),f(ee.$$.fragment),Ee=r(),te=l("ul"),te.innerHTML=Jt,qe=r(),oe=l("p"),oe.textContent=jt,Re=r(),f(ae.$$.fragment),Xe=r(),$=l("div"),f(ne.$$.fragment),Ke=r(),_e=l("p"),_e.innerHTML=Ft,et=r(),Te=l("p"),Te.innerHTML=Ut,tt=r(),f(N.$$.fragment),Be=r(),f(se.$$.fragment),Ye=r(),v=l("div"),f(re.$$.fragment),ot=r(),be=l("p"),be.textContent=kt,at=r(),ye=l("p"),ye.innerHTML=Gt,nt=r(),we=l("p"),we.textContent=zt,st=r(),I=l("div"),f(ie.$$.fragment),rt=r(),Me=l("p"),Me.textContent=Wt,He=r(),f(le.$$.fragment),Le=r(),F=l("div"),f(de.$$.fragment),it=r(),ve=l("p"),ve.innerHTML=Nt,lt=r(),S=l("div"),f(ce.$$.fragment),dt=r(),$e=l("p"),$e.innerHTML=It,ct=r(),f(Z.$$.fragment),mt=r(),f(V.$$.fragment),Qe=r(),f(me.$$.fragment),Pe=r(),x=l("div"),f(pe.$$.fragment),pt=r(),xe=l("p"),xe.textContent=Zt,ut=r(),Ce=l("p"),Ce.innerHTML=Vt,ft=r(),J=l("div"),f(ue.$$.fragment),ht=r(),Ae=l("p"),Ae.innerHTML=Et,gt=r(),f(E.$$.fragment),_t=r(),f(q.$$.fragment),De=r(),Se=l("p"),this.h()},l(e){const t=Lt("svelte-u9bgzb",document.head);n=d(t,"META",{name:!0,content:!0}),t.forEach(o),w=i(e),m=d(e,"P",{}),z(m).forEach(o),p=i(e),h(y.$$.fragment,e),s=i(e),h(M.$$.fragment,e),je=i(e),B=d(e,"P",{"data-svelte-h":!0}),u(B)!=="svelte-q8s2fy"&&(B.innerHTML=yt),Fe=i(e),Y=d(e,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-vfdo9a"&&(Y.textContent=wt),Ue=i(e),H=d(e,"P",{"data-svelte-h":!0}),u(H)!=="svelte-oul8j1"&&(H.innerHTML=Mt),ke=i(e),L=d(e,"P",{"data-svelte-h":!0}),u(L)!=="svelte-axv494"&&(L.textContent=vt),Ge=i(e),Q=d(e,"UL",{"data-svelte-h":!0}),u(Q)!=="svelte-tol0hz"&&(Q.innerHTML=$t),ze=i(e),W=d(e,"IMG",{src:!0,alt:!0,width:!0}),We=i(e),P=d(e,"SMALL",{"data-svelte-h":!0}),u(P)!=="svelte-794mev"&&(P.innerHTML=Ct),Ne=i(e),D=d(e,"P",{"data-svelte-h":!0}),u(D)!=="svelte-bcz63p"&&(D.innerHTML=At),Ie=i(e),h(O.$$.fragment,e),Ze=i(e),K=d(e,"P",{"data-svelte-h":!0}),u(K)!=="svelte-w2mpe2"&&(K.textContent=St),Ve=i(e),h(ee.$$.fragment,e),Ee=i(e),te=d(e,"UL",{"data-svelte-h":!0}),u(te)!=="svelte-na1fma"&&(te.innerHTML=Jt),qe=i(e),oe=d(e,"P",{"data-svelte-h":!0}),u(oe)!=="svelte-1xesile"&&(oe.textContent=jt),Re=i(e),h(ae.$$.fragment,e),Xe=i(e),$=d(e,"DIV",{class:!0});var U=z($);h(ne.$$.fragment,U),Ke=i(U),_e=d(U,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-zrwefn"&&(_e.innerHTML=Ft),et=i(U),Te=d(U,"P",{"data-svelte-h":!0}),u(Te)!=="svelte-o55m63"&&(Te.innerHTML=Ut),tt=i(U),h(N.$$.fragment,U),U.forEach(o),Be=i(e),h(se.$$.fragment,e),Ye=i(e),v=d(e,"DIV",{class:!0});var C=z(v);h(re.$$.fragment,C),ot=i(C),be=d(C,"P",{"data-svelte-h":!0}),u(be)!=="svelte-1vcyh3y"&&(be.textContent=kt),at=i(C),ye=d(C,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-3gz575"&&(ye.innerHTML=Gt),nt=i(C),we=d(C,"P",{"data-svelte-h":!0}),u(we)!=="svelte-uq4h1m"&&(we.textContent=zt),st=i(C),I=d(C,"DIV",{class:!0});var fe=z(I);h(ie.$$.fragment,fe),rt=i(fe),Me=d(fe,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-1a6wgfx"&&(Me.textContent=Wt),fe.forEach(o),C.forEach(o),He=i(e),h(le.$$.fragment,e),Le=i(e),F=d(e,"DIV",{class:!0});var G=z(F);h(de.$$.fragment,G),it=i(G),ve=d(G,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-1eae68l"&&(ve.innerHTML=Nt),lt=i(G),S=d(G,"DIV",{class:!0});var k=z(S);h(ce.$$.fragment,k),dt=i(k),$e=d(k,"P",{"data-svelte-h":!0}),u($e)!=="svelte-dzmahx"&&($e.innerHTML=It),ct=i(k),h(Z.$$.fragment,k),mt=i(k),h(V.$$.fragment,k),k.forEach(o),G.forEach(o),Qe=i(e),h(me.$$.fragment,e),Pe=i(e),x=d(e,"DIV",{class:!0});var R=z(x);h(pe.$$.fragment,R),pt=i(R),xe=d(R,"P",{"data-svelte-h":!0}),u(xe)!=="svelte-1b8t75l"&&(xe.textContent=Zt),ut=i(R),Ce=d(R,"P",{"data-svelte-h":!0}),u(Ce)!=="svelte-1gjh92c"&&(Ce.innerHTML=Vt),ft=i(R),J=d(R,"DIV",{class:!0});var X=z(J);h(ue.$$.fragment,X),ht=i(X),Ae=d(X,"P",{"data-svelte-h":!0}),u(Ae)!=="svelte-1480gbz"&&(Ae.innerHTML=Et),gt=i(X),h(E.$$.fragment,X),_t=i(X),h(q.$$.fragment,X),X.forEach(o),R.forEach(o),De=i(e),Se=d(e,"P",{}),z(Se).forEach(o),this.h()},h(){j(n,"name","hf:doc:metadata"),j(n,"content",oo),Xt(W.src,xt="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/audio_spectogram_transformer_architecture.png")||j(W,"src",xt),j(W,"alt","drawing"),j(W,"width","600"),j($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,n),a(e,w,t),a(e,m,t),a(e,p,t),g(y,e,t),a(e,s,t),g(M,e,t),a(e,je,t),a(e,B,t),a(e,Fe,t),a(e,Y,t),a(e,Ue,t),a(e,H,t),a(e,ke,t),a(e,L,t),a(e,Ge,t),a(e,Q,t),a(e,ze,t),a(e,W,t),a(e,We,t),a(e,P,t),a(e,Ne,t),a(e,D,t),a(e,Ie,t),g(O,e,t),a(e,Ze,t),a(e,K,t),a(e,Ve,t),g(ee,e,t),a(e,Ee,t),a(e,te,t),a(e,qe,t),a(e,oe,t),a(e,Re,t),g(ae,e,t),a(e,Xe,t),a(e,$,t),g(ne,$,null),c($,Ke),c($,_e),c($,et),c($,Te),c($,tt),g(N,$,null),a(e,Be,t),g(se,e,t),a(e,Ye,t),a(e,v,t),g(re,v,null),c(v,ot),c(v,be),c(v,at),c(v,ye),c(v,nt),c(v,we),c(v,st),c(v,I),g(ie,I,null),c(I,rt),c(I,Me),a(e,He,t),g(le,e,t),a(e,Le,t),a(e,F,t),g(de,F,null),c(F,it),c(F,ve),c(F,lt),c(F,S),g(ce,S,null),c(S,dt),c(S,$e),c(S,ct),g(Z,S,null),c(S,mt),g(V,S,null),a(e,Qe,t),g(me,e,t),a(e,Pe,t),a(e,x,t),g(pe,x,null),c(x,pt),c(x,xe),c(x,ut),c(x,Ce),c(x,ft),c(x,J),g(ue,J,null),c(J,ht),c(J,Ae),c(J,gt),g(E,J,null),c(J,_t),g(q,J,null),a(e,De,t),a(e,Se,t),Oe=!0},p(e,[t]){const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),N.$set(U);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),Z.$set(C);const fe={};t&2&&(fe.$$scope={dirty:t,ctx:e}),V.$set(fe);const G={};t&2&&(G.$$scope={dirty:t,ctx:e}),E.$set(G);const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),q.$set(k)},i(e){Oe||(_(y.$$.fragment,e),_(M.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(ae.$$.fragment,e),_(ne.$$.fragment,e),_(N.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(le.$$.fragment,e),_(de.$$.fragment,e),_(ce.$$.fragment,e),_(Z.$$.fragment,e),_(V.$$.fragment,e),_(me.$$.fragment,e),_(pe.$$.fragment,e),_(ue.$$.fragment,e),_(E.$$.fragment,e),_(q.$$.fragment,e),Oe=!0)},o(e){T(y.$$.fragment,e),T(M.$$.fragment,e),T(O.$$.fragment,e),T(ee.$$.fragment,e),T(ae.$$.fragment,e),T(ne.$$.fragment,e),T(N.$$.fragment,e),T(se.$$.fragment,e),T(re.$$.fragment,e),T(ie.$$.fragment,e),T(le.$$.fragment,e),T(de.$$.fragment,e),T(ce.$$.fragment,e),T(Z.$$.fragment,e),T(V.$$.fragment,e),T(me.$$.fragment,e),T(pe.$$.fragment,e),T(ue.$$.fragment,e),T(E.$$.fragment,e),T(q.$$.fragment,e),Oe=!1},d(e){e&&(o(w),o(m),o(p),o(s),o(je),o(B),o(Fe),o(Y),o(Ue),o(H),o(ke),o(L),o(Ge),o(Q),o(ze),o(W),o(We),o(P),o(Ne),o(D),o(Ie),o(Ze),o(K),o(Ve),o(Ee),o(te),o(qe),o(oe),o(Re),o(Xe),o($),o(Be),o(Ye),o(v),o(He),o(Le),o(F),o(Qe),o(Pe),o(x),o(De),o(Se)),o(n),b(y,e),b(M,e),b(O,e),b(ee,e),b(ae,e),b(ne),b(N),b(se,e),b(re),b(ie),b(le,e),b(de),b(ce),b(Z),b(V),b(me,e),b(pe),b(ue),b(E),b(q)}}}const oo='{"title":"Audio Spectrogram Transformer","local":"audio-spectrogram-transformer","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"ASTConfig","local":"transformers.ASTConfig","sections":[],"depth":2},{"title":"ASTFeatureExtractor","local":"transformers.ASTFeatureExtractor","sections":[],"depth":2},{"title":"ASTModel","local":"transformers.ASTModel","sections":[],"depth":2},{"title":"ASTForAudioClassification","local":"transformers.ASTForAudioClassification","sections":[],"depth":2}],"depth":1}';function ao(A){return Bt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class uo extends Yt{constructor(n){super(),Ht(this,n,ao,to,Rt,{})}}export{uo as component};
