import{S as Js,i as js,s as Fs,e as a,k as m,w as v,t as n,M as Us,c as r,d as o,m as u,a as s,x as y,h as l,b as i,N as Ns,G as t,g as f,y as w,q as A,o as M,B as S,v as Is,L as Cr}from"../../chunks/vendor-hf-doc-builder.js";import{T as ks}from"../../chunks/Tip-hf-doc-builder.js";import{D as He}from"../../chunks/Docstring-hf-doc-builder.js";import{C as xr}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Le}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Er}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Gs}from"../../chunks/PipelineTag-hf-doc-builder.js";function Ws(x){let p,b,_,h,T;return h=new xr({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`}}),{c(){p=a("p"),b=n("Example:"),_=m(),v(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=l(g,"Example:"),g.forEach(o),_=u(d),y(h.$$.fragment,d)},m(d,g){f(d,p,g),t(p,b),f(d,_,g),w(h,d,g),T=!0},p:Cr,i(d){T||(A(h.$$.fragment,d),T=!0)},o(d){M(h.$$.fragment,d),T=!1},d(d){d&&o(p),d&&o(_),S(h,d)}}}function zs(x){let p,b,_,h,T;return{c(){p=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),h=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(d){p=r(d,"P",{});var g=s(p);b=l(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(g,"CODE",{});var j=s(_);h=l(j,"Module"),j.forEach(o),T=l(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(d,g){f(d,p,g),t(p,b),t(p,_),t(_,h),t(p,T)},d(d){d&&o(p)}}}function Vs(x){let p,b,_,h,T;return h=new xr({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>]`}}),{c(){p=a("p"),b=n("Example:"),_=m(),v(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=l(g,"Example:"),g.forEach(o),_=u(d),y(h.$$.fragment,d)},m(d,g){f(d,p,g),t(p,b),f(d,_,g),w(h,d,g),T=!0},p:Cr,i(d){T||(A(h.$$.fragment,d),T=!0)},o(d){M(h.$$.fragment,d),T=!1},d(d){d&&o(p),d&&o(_),S(h,d)}}}function Zs(x){let p,b,_,h,T;return{c(){p=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),h=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(d){p=r(d,"P",{});var g=s(p);b=l(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(g,"CODE",{});var j=s(_);h=l(j,"Module"),j.forEach(o),T=l(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(d,g){f(d,p,g),t(p,b),t(p,_),t(_,h),t(p,T)},d(d){d&&o(p)}}}function qs(x){let p,b,_,h,T;return h=new xr({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>`}}),{c(){p=a("p"),b=n("Example:"),_=m(),v(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=l(g,"Example:"),g.forEach(o),_=u(d),y(h.$$.fragment,d)},m(d,g){f(d,p,g),t(p,b),f(d,_,g),w(h,d,g),T=!0},p:Cr,i(d){T||(A(h.$$.fragment,d),T=!0)},o(d){M(h.$$.fragment,d),T=!1},d(d){d&&o(p),d&&o(_),S(h,d)}}}function Rs(x){let p,b,_,h,T,d,g,j,xo,Yt,z,L,wt,he,ko,At,Jo,Bt,U,jo,ge,Fo,Uo,De,No,Io,Pt,Oe,Go,Qt,Ke,Mt,Wo,Ht,et,zo,Lt,D,V,Vo,tt,Zo,qo,_e,St,Ro,Xo,Yo,Te,Bo,be,Po,Qo,Dt,O,kr,Ot,K,Ho,ot,Lo,Do,Kt,N,Oo,ve,Ko,ea,ye,ta,oa,eo,Z,ee,$t,we,aa,Et,ra,to,at,sa,oo,Ae,ao,I,Me,na,Se,la,ia,da,G,rt,ca,ma,$e,ua,fa,Ee,pa,ha,ga,Ce,_a,st,Ta,ba,ro,nt,va,so,q,te,Ct,xe,ya,xt,wa,no,E,ke,Aa,R,Ma,lt,Sa,$a,Je,Ea,Ca,xa,X,ka,it,Ja,ja,dt,Fa,Ua,Na,oe,lo,Y,ae,kt,je,Ia,Jt,Ga,io,$,Fe,Wa,jt,za,Va,Ue,Za,ct,qa,Ra,Xa,Ft,Ya,Ba,re,Ne,Pa,Ut,Qa,co,B,se,Nt,Ie,Ha,It,La,mo,F,Ge,Da,We,Oa,ze,Ka,er,tr,k,Ve,or,P,ar,mt,rr,sr,Gt,nr,lr,ir,ne,dr,le,uo,Q,ie,Wt,Ze,cr,zt,mr,fo,C,qe,ur,Vt,fr,pr,Re,hr,Xe,gr,_r,Tr,J,Ye,br,H,vr,ut,yr,wr,Zt,Ar,Mr,Sr,de,$r,ce,po;return d=new Le({}),he=new Le({}),we=new Le({}),Ae=new Gs({props:{pipeline:"audio-classification"}}),xe=new Le({}),ke=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.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ASTConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ASTConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ASTConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ASTConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ASTConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.ASTConfig.frequency_stride",description:`<strong>frequency_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Frequency stride to use when patchifying the spectrograms.`,name:"frequency_stride"},{anchor:"transformers.ASTConfig.time_stride",description:`<strong>time_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Temporal stride to use when patchifying the spectrograms.`,name:"time_stride"},{anchor:"transformers.ASTConfig.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Temporal dimension of the spectrograms.`,name:"max_length"},{anchor:"transformers.ASTConfig.num_mel_bins",description:`<strong>num_mel_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Frequency dimension of the spectrograms (number of Mel-frequency bins).`,name:"num_mel_bins"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py#L31"}}),oe=new Er({props:{anchor:"transformers.ASTConfig.example",$$slots:{default:[Ws]},$$scope:{ctx:x}}}),je=new Le({}),Fe=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/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a> should return <code>attention_mask</code>.`,name:"return_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L33"}}),Ne=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/v4.31.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L125"}}),Ie=new Le({}),Ge=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/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L445"}}),Ve=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/v4.31.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ASTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L469",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new ks({props:{$$slots:{default:[zs]},$$scope:{ctx:x}}}),le=new Er({props:{anchor:"transformers.ASTModel.forward.example",$$slots:{default:[Vs]},$$scope:{ctx:x}}}),Ze=new Le({}),qe=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/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L545"}}),Ye=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/v4.31.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTForAudioClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTForAudioClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTForAudioClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ASTForAudioClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ASTForAudioClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the audio classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L558",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),de=new ks({props:{$$slots:{default:[Zs]},$$scope:{ctx:x}}}),ce=new Er({props:{anchor:"transformers.ASTForAudioClassification.forward.example",$$slots:{default:[qs]},$$scope:{ctx:x}}}),{c(){p=a("meta"),b=m(),_=a("h1"),h=a("a"),T=a("span"),v(d.$$.fragment),g=m(),j=a("span"),xo=n("Audio Spectrogram Transformer"),Yt=m(),z=a("h2"),L=a("a"),wt=a("span"),v(he.$$.fragment),ko=m(),At=a("span"),Jo=n("Overview"),Bt=m(),U=a("p"),jo=n("The Audio Spectrogram Transformer model was proposed in "),ge=a("a"),Fo=n("AST: Audio Spectrogram Transformer"),Uo=n(` by Yuan Gong, Yu-An Chung, James Glass.
The Audio Spectrogram Transformer applies a `),De=a("a"),No=n("Vision Transformer"),Io=n(` to audio, by turning audio into an image (spectrogram). The model obtains state-of-the-art results
for audio classification.`),Pt=m(),Oe=a("p"),Go=n("The abstract from the paper is the following:"),Qt=m(),Ke=a("p"),Mt=a("em"),Wo=n("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."),Ht=m(),et=a("p"),zo=n("Tips:"),Lt=m(),D=a("ul"),V=a("li"),Vo=n(`When fine-tuning the Audio Spectrogram Transformer (AST) on your own dataset, it\u2019s recommended to take care of the input normalization (to make
sure the input has mean of 0 and std of 0.5). `),tt=a("a"),Zo=n("ASTFeatureExtractor"),qo=n(` takes care of this. Note that it uses the AudioSet
mean and std by default. You can check `),_e=a("a"),St=a("code"),Ro=n("ast/src/get_norm_stats.py"),Xo=n(` to see how
the authors compute the stats for a downstream dataset.`),Yo=m(),Te=a("li"),Bo=n(`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
`),be=a("a"),Po=n("PSLA paper"),Qo=n(") and converges quickly, so please search for a suitable learning rate and learning rate scheduler for your task."),Dt=m(),O=a("img"),Ot=m(),K=a("small"),Ho=n("Audio pectrogram Transformer architecture. Taken from the "),ot=a("a"),Lo=n("original paper"),Do=n("."),Kt=m(),N=a("p"),Oo=n("This model was contributed by "),ve=a("a"),Ko=n("nielsr"),ea=n(`.
The original code can be found `),ye=a("a"),ta=n("here"),oa=n("."),eo=m(),Z=a("h2"),ee=a("a"),$t=a("span"),v(we.$$.fragment),aa=m(),Et=a("span"),ra=n("Resources"),to=m(),at=a("p"),sa=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with the Audio Spectrogram Transformer."),oo=m(),v(Ae.$$.fragment),ao=m(),I=a("ul"),Me=a("li"),na=n("A notebook illustrating inference with AST for audio classification can be found "),Se=a("a"),la=n("here"),ia=n("."),da=m(),G=a("li"),rt=a("a"),ca=n("ASTForAudioClassification"),ma=n(" is supported by this "),$e=a("a"),ua=n("example script"),fa=n(" and "),Ee=a("a"),pa=n("notebook"),ha=n("."),ga=m(),Ce=a("li"),_a=n("See also: "),st=a("a"),Ta=n("Audio classification"),ba=n("."),ro=m(),nt=a("p"),va=n("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),so=m(),q=a("h2"),te=a("a"),Ct=a("span"),v(xe.$$.fragment),ya=m(),xt=a("span"),wa=n("ASTConfig"),no=m(),E=a("div"),v(ke.$$.fragment),Aa=m(),R=a("p"),Ma=n("This is the configuration class to store the configuration of a "),lt=a("a"),Sa=n("ASTModel"),$a=n(`. 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
`),Je=a("a"),Ea=n("MIT/ast-finetuned-audioset-10-10-0.4593"),Ca=n(`
architecture.`),xa=m(),X=a("p"),ka=n("Configuration objects inherit from "),it=a("a"),Ja=n("PretrainedConfig"),ja=n(` and can be used to control the model outputs. Read the
documentation from `),dt=a("a"),Fa=n("PretrainedConfig"),Ua=n(" for more information."),Na=m(),v(oe.$$.fragment),lo=m(),Y=a("h2"),ae=a("a"),kt=a("span"),v(je.$$.fragment),Ia=m(),Jt=a("span"),Ga=n("ASTFeatureExtractor"),io=m(),$=a("div"),v(Fe.$$.fragment),Wa=m(),jt=a("p"),za=n("Constructs a Audio Spectrogram Transformer (AST) feature extractor."),Va=m(),Ue=a("p"),Za=n("This feature extractor inherits from "),ct=a("a"),qa=n("SequenceFeatureExtractor"),Ra=n(` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),Xa=m(),Ft=a("p"),Ya=n(`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.`),Ba=m(),re=a("div"),v(Ne.$$.fragment),Pa=m(),Ut=a("p"),Qa=n("Main method to featurize and prepare for the model one or several sequence(s)."),co=m(),B=a("h2"),se=a("a"),Nt=a("span"),v(Ie.$$.fragment),Ha=m(),It=a("span"),La=n("ASTModel"),mo=m(),F=a("div"),v(Ge.$$.fragment),Da=m(),We=a("p"),Oa=n(`The bare AST Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ze=a("a"),Ka=n("torch.nn.Module"),er=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),tr=m(),k=a("div"),v(Ve.$$.fragment),or=m(),P=a("p"),ar=n("The "),mt=a("a"),rr=n("ASTModel"),sr=n(" forward method, overrides the "),Gt=a("code"),nr=n("__call__"),lr=n(" special method."),ir=m(),v(ne.$$.fragment),dr=m(),v(le.$$.fragment),uo=m(),Q=a("h2"),ie=a("a"),Wt=a("span"),v(Ze.$$.fragment),cr=m(),zt=a("span"),mr=n("ASTForAudioClassification"),fo=m(),C=a("div"),v(qe.$$.fragment),ur=m(),Vt=a("p"),fr=n(`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.`),pr=m(),Re=a("p"),hr=n("This model is a PyTorch "),Xe=a("a"),gr=n("torch.nn.Module"),_r=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tr=m(),J=a("div"),v(Ye.$$.fragment),br=m(),H=a("p"),vr=n("The "),ut=a("a"),yr=n("ASTForAudioClassification"),wr=n(" forward method, overrides the "),Zt=a("code"),Ar=n("__call__"),Mr=n(" special method."),Sr=m(),v(de.$$.fragment),$r=m(),v(ce.$$.fragment),this.h()},l(e){const c=Us('[data-svelte="svelte-1phssyn"]',document.head);p=r(c,"META",{name:!0,content:!0}),c.forEach(o),b=u(e),_=r(e,"H1",{class:!0});var Be=s(_);h=r(Be,"A",{id:!0,class:!0,href:!0});var qt=s(h);T=r(qt,"SPAN",{});var Rt=s(T);y(d.$$.fragment,Rt),Rt.forEach(o),qt.forEach(o),g=u(Be),j=r(Be,"SPAN",{});var Xt=s(j);xo=l(Xt,"Audio Spectrogram Transformer"),Xt.forEach(o),Be.forEach(o),Yt=u(e),z=r(e,"H2",{class:!0});var Pe=s(z);L=r(Pe,"A",{id:!0,class:!0,href:!0});var Jr=s(L);wt=r(Jr,"SPAN",{});var jr=s(wt);y(he.$$.fragment,jr),jr.forEach(o),Jr.forEach(o),ko=u(Pe),At=r(Pe,"SPAN",{});var Fr=s(At);Jo=l(Fr,"Overview"),Fr.forEach(o),Pe.forEach(o),Bt=u(e),U=r(e,"P",{});var ft=s(U);jo=l(ft,"The Audio Spectrogram Transformer model was proposed in "),ge=r(ft,"A",{href:!0,rel:!0});var Ur=s(ge);Fo=l(Ur,"AST: Audio Spectrogram Transformer"),Ur.forEach(o),Uo=l(ft,` by Yuan Gong, Yu-An Chung, James Glass.
The Audio Spectrogram Transformer applies a `),De=r(ft,"A",{href:!0});var Nr=s(De);No=l(Nr,"Vision Transformer"),Nr.forEach(o),Io=l(ft,` to audio, by turning audio into an image (spectrogram). The model obtains state-of-the-art results
for audio classification.`),ft.forEach(o),Pt=u(e),Oe=r(e,"P",{});var Ir=s(Oe);Go=l(Ir,"The abstract from the paper is the following:"),Ir.forEach(o),Qt=u(e),Ke=r(e,"P",{});var Gr=s(Ke);Mt=r(Gr,"EM",{});var Wr=s(Mt);Wo=l(Wr,"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."),Wr.forEach(o),Gr.forEach(o),Ht=u(e),et=r(e,"P",{});var zr=s(et);zo=l(zr,"Tips:"),zr.forEach(o),Lt=u(e),D=r(e,"UL",{});var ho=s(D);V=r(ho,"LI",{});var pt=s(V);Vo=l(pt,`When fine-tuning the Audio Spectrogram Transformer (AST) on your own dataset, it\u2019s recommended to take care of the input normalization (to make
sure the input has mean of 0 and std of 0.5). `),tt=r(pt,"A",{href:!0});var Vr=s(tt);Zo=l(Vr,"ASTFeatureExtractor"),Vr.forEach(o),qo=l(pt,` takes care of this. Note that it uses the AudioSet
mean and std by default. You can check `),_e=r(pt,"A",{href:!0,rel:!0});var Zr=s(_e);St=r(Zr,"CODE",{});var qr=s(St);Ro=l(qr,"ast/src/get_norm_stats.py"),qr.forEach(o),Zr.forEach(o),Xo=l(pt,` to see how
the authors compute the stats for a downstream dataset.`),pt.forEach(o),Yo=u(ho),Te=r(ho,"LI",{});var go=s(Te);Bo=l(go,`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
`),be=r(go,"A",{href:!0,rel:!0});var Rr=s(be);Po=l(Rr,"PSLA paper"),Rr.forEach(o),Qo=l(go,") and converges quickly, so please search for a suitable learning rate and learning rate scheduler for your task."),go.forEach(o),ho.forEach(o),Dt=u(e),O=r(e,"IMG",{src:!0,alt:!0,width:!0}),Ot=u(e),K=r(e,"SMALL",{});var _o=s(K);Ho=l(_o,"Audio pectrogram Transformer architecture. Taken from the "),ot=r(_o,"A",{href:!0});var Xr=s(ot);Lo=l(Xr,"original paper"),Xr.forEach(o),Do=l(_o,"."),_o.forEach(o),Kt=u(e),N=r(e,"P",{});var ht=s(N);Oo=l(ht,"This model was contributed by "),ve=r(ht,"A",{href:!0,rel:!0});var Yr=s(ve);Ko=l(Yr,"nielsr"),Yr.forEach(o),ea=l(ht,`.
The original code can be found `),ye=r(ht,"A",{href:!0,rel:!0});var Br=s(ye);ta=l(Br,"here"),Br.forEach(o),oa=l(ht,"."),ht.forEach(o),eo=u(e),Z=r(e,"H2",{class:!0});var To=s(Z);ee=r(To,"A",{id:!0,class:!0,href:!0});var Pr=s(ee);$t=r(Pr,"SPAN",{});var Qr=s($t);y(we.$$.fragment,Qr),Qr.forEach(o),Pr.forEach(o),aa=u(To),Et=r(To,"SPAN",{});var Hr=s(Et);ra=l(Hr,"Resources"),Hr.forEach(o),To.forEach(o),to=u(e),at=r(e,"P",{});var Lr=s(at);sa=l(Lr,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with the Audio Spectrogram Transformer."),Lr.forEach(o),oo=u(e),y(Ae.$$.fragment,e),ao=u(e),I=r(e,"UL",{});var gt=s(I);Me=r(gt,"LI",{});var bo=s(Me);na=l(bo,"A notebook illustrating inference with AST for audio classification can be found "),Se=r(bo,"A",{href:!0,rel:!0});var Dr=s(Se);la=l(Dr,"here"),Dr.forEach(o),ia=l(bo,"."),bo.forEach(o),da=u(gt),G=r(gt,"LI",{});var Qe=s(G);rt=r(Qe,"A",{href:!0});var Or=s(rt);ca=l(Or,"ASTForAudioClassification"),Or.forEach(o),ma=l(Qe," is supported by this "),$e=r(Qe,"A",{href:!0,rel:!0});var Kr=s($e);ua=l(Kr,"example script"),Kr.forEach(o),fa=l(Qe," and "),Ee=r(Qe,"A",{href:!0,rel:!0});var es=s(Ee);pa=l(es,"notebook"),es.forEach(o),ha=l(Qe,"."),Qe.forEach(o),ga=u(gt),Ce=r(gt,"LI",{});var vo=s(Ce);_a=l(vo,"See also: "),st=r(vo,"A",{href:!0});var ts=s(st);Ta=l(ts,"Audio classification"),ts.forEach(o),ba=l(vo,"."),vo.forEach(o),gt.forEach(o),ro=u(e),nt=r(e,"P",{});var os=s(nt);va=l(os,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),os.forEach(o),so=u(e),q=r(e,"H2",{class:!0});var yo=s(q);te=r(yo,"A",{id:!0,class:!0,href:!0});var as=s(te);Ct=r(as,"SPAN",{});var rs=s(Ct);y(xe.$$.fragment,rs),rs.forEach(o),as.forEach(o),ya=u(yo),xt=r(yo,"SPAN",{});var ss=s(xt);wa=l(ss,"ASTConfig"),ss.forEach(o),yo.forEach(o),no=u(e),E=r(e,"DIV",{class:!0});var me=s(E);y(ke.$$.fragment,me),Aa=u(me),R=r(me,"P",{});var _t=s(R);Ma=l(_t,"This is the configuration class to store the configuration of a "),lt=r(_t,"A",{href:!0});var ns=s(lt);Sa=l(ns,"ASTModel"),ns.forEach(o),$a=l(_t,`. 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
`),Je=r(_t,"A",{href:!0,rel:!0});var ls=s(Je);Ea=l(ls,"MIT/ast-finetuned-audioset-10-10-0.4593"),ls.forEach(o),Ca=l(_t,`
architecture.`),_t.forEach(o),xa=u(me),X=r(me,"P",{});var Tt=s(X);ka=l(Tt,"Configuration objects inherit from "),it=r(Tt,"A",{href:!0});var is=s(it);Ja=l(is,"PretrainedConfig"),is.forEach(o),ja=l(Tt,` and can be used to control the model outputs. Read the
documentation from `),dt=r(Tt,"A",{href:!0});var ds=s(dt);Fa=l(ds,"PretrainedConfig"),ds.forEach(o),Ua=l(Tt," for more information."),Tt.forEach(o),Na=u(me),y(oe.$$.fragment,me),me.forEach(o),lo=u(e),Y=r(e,"H2",{class:!0});var wo=s(Y);ae=r(wo,"A",{id:!0,class:!0,href:!0});var cs=s(ae);kt=r(cs,"SPAN",{});var ms=s(kt);y(je.$$.fragment,ms),ms.forEach(o),cs.forEach(o),Ia=u(wo),Jt=r(wo,"SPAN",{});var us=s(Jt);Ga=l(us,"ASTFeatureExtractor"),us.forEach(o),wo.forEach(o),io=u(e),$=r(e,"DIV",{class:!0});var W=s($);y(Fe.$$.fragment,W),Wa=u(W),jt=r(W,"P",{});var fs=s(jt);za=l(fs,"Constructs a Audio Spectrogram Transformer (AST) feature extractor."),fs.forEach(o),Va=u(W),Ue=r(W,"P",{});var Ao=s(Ue);Za=l(Ao,"This feature extractor inherits from "),ct=r(Ao,"A",{href:!0});var ps=s(ct);qa=l(ps,"SequenceFeatureExtractor"),ps.forEach(o),Ra=l(Ao,` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),Ao.forEach(o),Xa=u(W),Ft=r(W,"P",{});var hs=s(Ft);Ya=l(hs,`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.`),hs.forEach(o),Ba=u(W),re=r(W,"DIV",{class:!0});var Mo=s(re);y(Ne.$$.fragment,Mo),Pa=u(Mo),Ut=r(Mo,"P",{});var gs=s(Ut);Qa=l(gs,"Main method to featurize and prepare for the model one or several sequence(s)."),gs.forEach(o),Mo.forEach(o),W.forEach(o),co=u(e),B=r(e,"H2",{class:!0});var So=s(B);se=r(So,"A",{id:!0,class:!0,href:!0});var _s=s(se);Nt=r(_s,"SPAN",{});var Ts=s(Nt);y(Ie.$$.fragment,Ts),Ts.forEach(o),_s.forEach(o),Ha=u(So),It=r(So,"SPAN",{});var bs=s(It);La=l(bs,"ASTModel"),bs.forEach(o),So.forEach(o),mo=u(e),F=r(e,"DIV",{class:!0});var bt=s(F);y(Ge.$$.fragment,bt),Da=u(bt),We=r(bt,"P",{});var $o=s(We);Oa=l($o,`The bare AST Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ze=r($o,"A",{href:!0,rel:!0});var vs=s(ze);Ka=l(vs,"torch.nn.Module"),vs.forEach(o),er=l($o,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$o.forEach(o),tr=u(bt),k=r(bt,"DIV",{class:!0});var ue=s(k);y(Ve.$$.fragment,ue),or=u(ue),P=r(ue,"P",{});var vt=s(P);ar=l(vt,"The "),mt=r(vt,"A",{href:!0});var ys=s(mt);rr=l(ys,"ASTModel"),ys.forEach(o),sr=l(vt," forward method, overrides the "),Gt=r(vt,"CODE",{});var ws=s(Gt);nr=l(ws,"__call__"),ws.forEach(o),lr=l(vt," special method."),vt.forEach(o),ir=u(ue),y(ne.$$.fragment,ue),dr=u(ue),y(le.$$.fragment,ue),ue.forEach(o),bt.forEach(o),uo=u(e),Q=r(e,"H2",{class:!0});var Eo=s(Q);ie=r(Eo,"A",{id:!0,class:!0,href:!0});var As=s(ie);Wt=r(As,"SPAN",{});var Ms=s(Wt);y(Ze.$$.fragment,Ms),Ms.forEach(o),As.forEach(o),cr=u(Eo),zt=r(Eo,"SPAN",{});var Ss=s(zt);mr=l(Ss,"ASTForAudioClassification"),Ss.forEach(o),Eo.forEach(o),fo=u(e),C=r(e,"DIV",{class:!0});var fe=s(C);y(qe.$$.fragment,fe),ur=u(fe),Vt=r(fe,"P",{});var $s=s(Vt);fr=l($s,`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.`),$s.forEach(o),pr=u(fe),Re=r(fe,"P",{});var Co=s(Re);hr=l(Co,"This model is a PyTorch "),Xe=r(Co,"A",{href:!0,rel:!0});var Es=s(Xe);gr=l(Es,"torch.nn.Module"),Es.forEach(o),_r=l(Co,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Co.forEach(o),Tr=u(fe),J=r(fe,"DIV",{class:!0});var pe=s(J);y(Ye.$$.fragment,pe),br=u(pe),H=r(pe,"P",{});var yt=s(H);vr=l(yt,"The "),ut=r(yt,"A",{href:!0});var Cs=s(ut);yr=l(Cs,"ASTForAudioClassification"),Cs.forEach(o),wr=l(yt," forward method, overrides the "),Zt=r(yt,"CODE",{});var xs=s(Zt);Ar=l(xs,"__call__"),xs.forEach(o),Mr=l(yt," special method."),yt.forEach(o),Sr=u(pe),y(de.$$.fragment,pe),$r=u(pe),y(ce.$$.fragment,pe),pe.forEach(o),fe.forEach(o),this.h()},h(){i(p,"name","hf:doc:metadata"),i(p,"content",JSON.stringify(Xs)),i(h,"id","audio-spectrogram-transformer"),i(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(h,"href","#audio-spectrogram-transformer"),i(_,"class","relative group"),i(L,"id","overview"),i(L,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(L,"href","#overview"),i(z,"class","relative group"),i(ge,"href","https://arxiv.org/abs/2104.01778"),i(ge,"rel","nofollow"),i(De,"href","vit"),i(tt,"href","/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor"),i(_e,"href","https://github.com/YuanGongND/ast/blob/master/src/get_norm_stats.py"),i(_e,"rel","nofollow"),i(be,"href","https://arxiv.org/abs/2102.01243"),i(be,"rel","nofollow"),Ns(O.src,kr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/audio_spectogram_transformer_architecture.png")||i(O,"src",kr),i(O,"alt","drawing"),i(O,"width","600"),i(ot,"href","https://arxiv.org/abs/2104.01778"),i(ve,"href","https://huggingface.co/nielsr"),i(ve,"rel","nofollow"),i(ye,"href","https://github.com/YuanGongND/ast"),i(ye,"rel","nofollow"),i(ee,"id","resources"),i(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(ee,"href","#resources"),i(Z,"class","relative group"),i(Se,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/AST"),i(Se,"rel","nofollow"),i(rt,"href","/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification"),i($e,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification"),i($e,"rel","nofollow"),i(Ee,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb"),i(Ee,"rel","nofollow"),i(st,"href","../tasks/audio_classification"),i(te,"id","transformers.ASTConfig"),i(te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(te,"href","#transformers.ASTConfig"),i(q,"class","relative group"),i(lt,"href","/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel"),i(Je,"href","https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593"),i(Je,"rel","nofollow"),i(it,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(dt,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ae,"id","transformers.ASTFeatureExtractor"),i(ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(ae,"href","#transformers.ASTFeatureExtractor"),i(Y,"class","relative group"),i(ct,"href","/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),i(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(se,"id","transformers.ASTModel"),i(se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(se,"href","#transformers.ASTModel"),i(B,"class","relative group"),i(ze,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(ze,"rel","nofollow"),i(mt,"href","/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel"),i(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ie,"id","transformers.ASTForAudioClassification"),i(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(ie,"href","#transformers.ASTForAudioClassification"),i(Q,"class","relative group"),i(Xe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(Xe,"rel","nofollow"),i(ut,"href","/docs/transformers/v4.31.0/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification"),i(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,c){t(document.head,p),f(e,b,c),f(e,_,c),t(_,h),t(h,T),w(d,T,null),t(_,g),t(_,j),t(j,xo),f(e,Yt,c),f(e,z,c),t(z,L),t(L,wt),w(he,wt,null),t(z,ko),t(z,At),t(At,Jo),f(e,Bt,c),f(e,U,c),t(U,jo),t(U,ge),t(ge,Fo),t(U,Uo),t(U,De),t(De,No),t(U,Io),f(e,Pt,c),f(e,Oe,c),t(Oe,Go),f(e,Qt,c),f(e,Ke,c),t(Ke,Mt),t(Mt,Wo),f(e,Ht,c),f(e,et,c),t(et,zo),f(e,Lt,c),f(e,D,c),t(D,V),t(V,Vo),t(V,tt),t(tt,Zo),t(V,qo),t(V,_e),t(_e,St),t(St,Ro),t(V,Xo),t(D,Yo),t(D,Te),t(Te,Bo),t(Te,be),t(be,Po),t(Te,Qo),f(e,Dt,c),f(e,O,c),f(e,Ot,c),f(e,K,c),t(K,Ho),t(K,ot),t(ot,Lo),t(K,Do),f(e,Kt,c),f(e,N,c),t(N,Oo),t(N,ve),t(ve,Ko),t(N,ea),t(N,ye),t(ye,ta),t(N,oa),f(e,eo,c),f(e,Z,c),t(Z,ee),t(ee,$t),w(we,$t,null),t(Z,aa),t(Z,Et),t(Et,ra),f(e,to,c),f(e,at,c),t(at,sa),f(e,oo,c),w(Ae,e,c),f(e,ao,c),f(e,I,c),t(I,Me),t(Me,na),t(Me,Se),t(Se,la),t(Me,ia),t(I,da),t(I,G),t(G,rt),t(rt,ca),t(G,ma),t(G,$e),t($e,ua),t(G,fa),t(G,Ee),t(Ee,pa),t(G,ha),t(I,ga),t(I,Ce),t(Ce,_a),t(Ce,st),t(st,Ta),t(Ce,ba),f(e,ro,c),f(e,nt,c),t(nt,va),f(e,so,c),f(e,q,c),t(q,te),t(te,Ct),w(xe,Ct,null),t(q,ya),t(q,xt),t(xt,wa),f(e,no,c),f(e,E,c),w(ke,E,null),t(E,Aa),t(E,R),t(R,Ma),t(R,lt),t(lt,Sa),t(R,$a),t(R,Je),t(Je,Ea),t(R,Ca),t(E,xa),t(E,X),t(X,ka),t(X,it),t(it,Ja),t(X,ja),t(X,dt),t(dt,Fa),t(X,Ua),t(E,Na),w(oe,E,null),f(e,lo,c),f(e,Y,c),t(Y,ae),t(ae,kt),w(je,kt,null),t(Y,Ia),t(Y,Jt),t(Jt,Ga),f(e,io,c),f(e,$,c),w(Fe,$,null),t($,Wa),t($,jt),t(jt,za),t($,Va),t($,Ue),t(Ue,Za),t(Ue,ct),t(ct,qa),t(Ue,Ra),t($,Xa),t($,Ft),t(Ft,Ya),t($,Ba),t($,re),w(Ne,re,null),t(re,Pa),t(re,Ut),t(Ut,Qa),f(e,co,c),f(e,B,c),t(B,se),t(se,Nt),w(Ie,Nt,null),t(B,Ha),t(B,It),t(It,La),f(e,mo,c),f(e,F,c),w(Ge,F,null),t(F,Da),t(F,We),t(We,Oa),t(We,ze),t(ze,Ka),t(We,er),t(F,tr),t(F,k),w(Ve,k,null),t(k,or),t(k,P),t(P,ar),t(P,mt),t(mt,rr),t(P,sr),t(P,Gt),t(Gt,nr),t(P,lr),t(k,ir),w(ne,k,null),t(k,dr),w(le,k,null),f(e,uo,c),f(e,Q,c),t(Q,ie),t(ie,Wt),w(Ze,Wt,null),t(Q,cr),t(Q,zt),t(zt,mr),f(e,fo,c),f(e,C,c),w(qe,C,null),t(C,ur),t(C,Vt),t(Vt,fr),t(C,pr),t(C,Re),t(Re,hr),t(Re,Xe),t(Xe,gr),t(Re,_r),t(C,Tr),t(C,J),w(Ye,J,null),t(J,br),t(J,H),t(H,vr),t(H,ut),t(ut,yr),t(H,wr),t(H,Zt),t(Zt,Ar),t(H,Mr),t(J,Sr),w(de,J,null),t(J,$r),w(ce,J,null),po=!0},p(e,[c]){const Be={};c&2&&(Be.$$scope={dirty:c,ctx:e}),oe.$set(Be);const qt={};c&2&&(qt.$$scope={dirty:c,ctx:e}),ne.$set(qt);const Rt={};c&2&&(Rt.$$scope={dirty:c,ctx:e}),le.$set(Rt);const Xt={};c&2&&(Xt.$$scope={dirty:c,ctx:e}),de.$set(Xt);const Pe={};c&2&&(Pe.$$scope={dirty:c,ctx:e}),ce.$set(Pe)},i(e){po||(A(d.$$.fragment,e),A(he.$$.fragment,e),A(we.$$.fragment,e),A(Ae.$$.fragment,e),A(xe.$$.fragment,e),A(ke.$$.fragment,e),A(oe.$$.fragment,e),A(je.$$.fragment,e),A(Fe.$$.fragment,e),A(Ne.$$.fragment,e),A(Ie.$$.fragment,e),A(Ge.$$.fragment,e),A(Ve.$$.fragment,e),A(ne.$$.fragment,e),A(le.$$.fragment,e),A(Ze.$$.fragment,e),A(qe.$$.fragment,e),A(Ye.$$.fragment,e),A(de.$$.fragment,e),A(ce.$$.fragment,e),po=!0)},o(e){M(d.$$.fragment,e),M(he.$$.fragment,e),M(we.$$.fragment,e),M(Ae.$$.fragment,e),M(xe.$$.fragment,e),M(ke.$$.fragment,e),M(oe.$$.fragment,e),M(je.$$.fragment,e),M(Fe.$$.fragment,e),M(Ne.$$.fragment,e),M(Ie.$$.fragment,e),M(Ge.$$.fragment,e),M(Ve.$$.fragment,e),M(ne.$$.fragment,e),M(le.$$.fragment,e),M(Ze.$$.fragment,e),M(qe.$$.fragment,e),M(Ye.$$.fragment,e),M(de.$$.fragment,e),M(ce.$$.fragment,e),po=!1},d(e){o(p),e&&o(b),e&&o(_),S(d),e&&o(Yt),e&&o(z),S(he),e&&o(Bt),e&&o(U),e&&o(Pt),e&&o(Oe),e&&o(Qt),e&&o(Ke),e&&o(Ht),e&&o(et),e&&o(Lt),e&&o(D),e&&o(Dt),e&&o(O),e&&o(Ot),e&&o(K),e&&o(Kt),e&&o(N),e&&o(eo),e&&o(Z),S(we),e&&o(to),e&&o(at),e&&o(oo),S(Ae,e),e&&o(ao),e&&o(I),e&&o(ro),e&&o(nt),e&&o(so),e&&o(q),S(xe),e&&o(no),e&&o(E),S(ke),S(oe),e&&o(lo),e&&o(Y),S(je),e&&o(io),e&&o($),S(Fe),S(Ne),e&&o(co),e&&o(B),S(Ie),e&&o(mo),e&&o(F),S(Ge),S(Ve),S(ne),S(le),e&&o(uo),e&&o(Q),S(Ze),e&&o(fo),e&&o(C),S(qe),S(Ye),S(de),S(ce)}}}const Xs={local:"audio-spectrogram-transformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.ASTConfig",title:"ASTConfig"},{local:"transformers.ASTFeatureExtractor",title:"ASTFeatureExtractor"},{local:"transformers.ASTModel",title:"ASTModel"},{local:"transformers.ASTForAudioClassification",title:"ASTForAudioClassification"}],title:"Audio Spectrogram Transformer"};function Ys(x){return Is(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ks extends Js{constructor(p){super();js(this,p,Ys,Rs,Fs,{})}}export{Ks as default,Xs as metadata};
