import{s as Xt,f as Bt,o as Yt,n as je}from"../chunks/scheduler.9bc65507.js";import{S as Ht,i as Qt,g as l,s as r,r as u,A as Lt,h as d,f as o,c as i,j as W,u as f,x as b,k as j,y as c,a,v as h,d as g,t as _,w as T}from"../chunks/index.707bf1b6.js";import{T as Rt}from"../chunks/Tip.c2ecdbf4.js";import{D as _e}from"../chunks/Docstring.570ddb64.js";import{C as vt}from"../chunks/CodeBlock.54a9f38d.js";import{E as yt}from"../chunks/ExampleCodeBlock.bc2be6bc.js";import{P as Pt}from"../chunks/PipelineTag.44585822.js";import{H as B,E as Dt}from"../chunks/EditOnGithub.922df6ba.js";function Ot(A){let n,v="Example:",m,p,y;return p=new vt({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=v,m=r(),u(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),m=i(s),f(p.$$.fragment,s)},m(s,w){a(s,n,w),a(s,m,w),h(p,s,w),y=!0},p:je,i(s){y||(g(p.$$.fragment,s),y=!0)},o(s){_(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),T(p,s)}}}function Kt(A){let n,v=`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=v},l(m){n=d(m,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(m,p){a(m,n,p)},p:je,d(m){m&&o(n)}}}function eo(A){let n,v="Example:",m,p,y;return p=new vt({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=v,m=r(),u(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),m=i(s),f(p.$$.fragment,s)},m(s,w){a(s,n,w),a(s,m,w),h(p,s,w),y=!0},p:je,i(s){y||(g(p.$$.fragment,s),y=!0)},o(s){_(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),T(p,s)}}}function to(A){let n,v=`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=v},l(m){n=d(m,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(m,p){a(m,n,p)},p:je,d(m){m&&o(n)}}}function oo(A){let n,v="Example:",m,p,y;return p=new vt({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=v,m=r(),u(p.$$.fragment)},l(s){n=d(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),m=i(s),f(p.$$.fragment,s)},m(s,w){a(s,n,w),a(s,m,w),h(p,s,w),y=!0},p:je,i(s){y||(g(p.$$.fragment,s),y=!0)},o(s){_(p.$$.fragment,s),y=!1},d(s){s&&(o(n),o(m)),T(p,s)}}}function ao(A){let n,v,m,p,y,s,w,Fe,Y,wt=`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.`,Ue,H,Mt="The abstract from the paper is the following:",ke,Q,$t="<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>",Ge,z,xt,We,L,Ct='Audio Spectrogram Transformer architecture. Taken from the <a href="https://arxiv.org/abs/2104.01778">original paper</a>.',ze,P,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,D,Ne,O,St=`<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.40.2/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,K,Ve,ee,Jt="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with the Audio Spectrogram Transformer.",Ee,te,qe,oe,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/v4.40.2/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>',Re,ae,Ft="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.",Xe,ne,Be,$,se,tt,Te,Ut=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.40.2/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.`,ot,be,kt=`Configuration objects inherit from <a href="/docs/transformers/v4.40.2/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.40.2/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,at,I,Ye,re,He,M,ie,nt,ye,Gt="Constructs a Audio Spectrogram Transformer (AST) feature extractor.",st,ve,Wt=`This feature extractor inherits from <a href="/docs/transformers/v4.40.2/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.`,rt,we,zt=`This class extracts mel-filter bank features from raw speech using TorchAudio if installed or using numpy
otherwise, pads/truncates them to a fixed length and normalizes them using a mean and standard deviation.`,it,N,le,lt,Me,It="Main method to featurize and prepare for the model one or several sequence(s).",Qe,de,Le,F,ce,dt,$e,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.`,ct,S,me,mt,xe,Zt='The <a href="/docs/transformers/v4.40.2/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel">ASTModel</a> forward method, overrides the <code>__call__</code> special method.',pt,Z,ut,V,Pe,pe,De,x,ue,ft,Ce,Vt=`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.`,ht,Ae,Et=`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.`,gt,J,fe,_t,Se,qt='The <a href="/docs/transformers/v4.40.2/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification">ASTForAudioClassification</a> forward method, overrides the <code>__call__</code> special method.',Tt,E,bt,q,Oe,he,Ke,Je,et;return y=new B({props:{title:"Audio Spectrogram Transformer",local:"audio-spectrogram-transformer",headingTag:"h1"}}),w=new B({props:{title:"Overview",local:"overview",headingTag:"h2"}}),D=new B({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),K=new B({props:{title:"Resources",local:"resources",headingTag:"h2"}}),te=new Pt({props:{pipeline:"audio-classification"}}),ne=new B({props:{title:"ASTConfig",local:"transformers.ASTConfig",headingTag:"h2"}}),se=new _e({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/v4.40.2/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py#L28"}}),I=new yt({props:{anchor:"transformers.ASTConfig.example",$$slots:{default:[Ot]},$$scope:{ctx:A}}}),re=new B({props:{title:"ASTFeatureExtractor",local:"transformers.ASTFeatureExtractor",headingTag:"h2"}}),ie=new _e({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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L39"}}),le=new _e({props:{name:"__call__",anchor:"transformers.ASTFeatureExtractor.__call__",parameters:[{name:"raw_speech",val:": Union"},{name:"sampling_rate",val:": Optional = None"},{name:"return_tensors",val:": Union = 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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L161"}}),de=new B({props:{title:"ASTModel",local:"transformers.ASTModel",headingTag:"h2"}}),ce=new _e({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.40.2/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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L427"}}),me=new _e({props:{name:"forward",anchor:"transformers.ASTModel.forward",parameters:[{name:"input_values",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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.40.2/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.40.2/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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L455",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/v4.40.2/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.40.2/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/v4.40.2/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Z=new Rt({props:{$$slots:{default:[Kt]},$$scope:{ctx:A}}}),V=new yt({props:{anchor:"transformers.ASTModel.forward.example",$$slots:{default:[eo]},$$scope:{ctx:A}}}),pe=new B({props:{title:"ASTForAudioClassification",local:"transformers.ASTForAudioClassification",headingTag:"h2"}}),ue=new _e({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.40.2/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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L524"}}),fe=new _e({props:{name:"forward",anchor:"transformers.ASTForAudioClassification.forward",parameters:[{name:"input_values",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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.40.2/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.40.2/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.40.2/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.40.2/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L544",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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