import{S as Js,i as js,s as Fs,e as a,k as m,w as y,t as n,M as Us,c as r,d as o,m as u,a as s,x as v,h as i,b as l,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(),y(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=i(g,"Example:"),g.forEach(o),_=u(d),v(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=i(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=i(j,"Module"),j.forEach(o),T=i(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(),y(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=i(g,"Example:"),g.forEach(o),_=u(d),v(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=i(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=i(j,"Module"),j.forEach(o),T=i(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(),y(h.$$.fragment)},l(d){p=r(d,"P",{});var g=s(p);b=i(g,"Example:"),g.forEach(o),_=u(d),v(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,ye,Ko,ea,ve,ta,oa,eo,Z,ee,$t,we,aa,Et,ra,to,at,sa,oo,Ae,ao,I,Me,na,Se,ia,la,da,G,rt,ca,ma,$e,ua,fa,Ee,pa,ha,ga,Ce,_a,st,Ta,ba,ro,nt,ya,so,q,te,Ct,xe,va,xt,wa,no,E,ke,Aa,R,Ma,it,Sa,$a,Je,Ea,Ca,xa,X,ka,lt,Ja,ja,dt,Fa,Ua,Na,oe,io,Y,ae,kt,je,Ia,Jt,Ga,lo,$,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,ir,lr,ne,dr,ie,uo,Q,le,Wt,Ze,cr,zt,mr,fo,C,qe,ur,Vt,fr,pr,Re,hr,Xe,gr,_r,Tr,J,Ye,br,H,yr,ut,vr,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/main/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/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a> should return <code>attention_mask</code>.`,name:"return_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L33"}}),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/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py#L125"}}),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/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L445"}}),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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ASTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L469",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \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/main/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}}}),ie=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/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig">ASTConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L545"}}),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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_values"},{anchor:"transformers.ASTForAudioClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ASTForAudioClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ASTForAudioClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ASTForAudioClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ASTForAudioClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the audio classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py#L558",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTConfig"
>ASTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \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/main/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"),y(d.$$.fragment),g=m(),j=a("span"),xo=n("Audio Spectrogram Transformer"),Yt=m(),z=a("h2"),L=a("a"),wt=a("span"),y(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 "),ye=a("a"),Ko=n("nielsr"),ea=n(`.
The original code can be found `),ve=a("a"),ta=n("here"),oa=n("."),eo=m(),Z=a("h2"),ee=a("a"),$t=a("span"),y(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(),y(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"),ia=n("here"),la=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"),ya=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"),y(xe.$$.fragment),va=m(),xt=a("span"),wa=n("ASTConfig"),no=m(),E=a("div"),y(ke.$$.fragment),Aa=m(),R=a("p"),Ma=n("This is the configuration class to store the configuration of a "),it=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 "),lt=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(),y(oe.$$.fragment),io=m(),Y=a("h2"),ae=a("a"),kt=a("span"),y(je.$$.fragment),Ia=m(),Jt=a("span"),Ga=n("ASTFeatureExtractor"),lo=m(),$=a("div"),y(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"),y(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"),y(Ie.$$.fragment),Ha=m(),It=a("span"),La=n("ASTModel"),mo=m(),F=a("div"),y(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"),y(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__"),ir=n(" special method."),lr=m(),y(ne.$$.fragment),dr=m(),y(ie.$$.fragment),uo=m(),Q=a("h2"),le=a("a"),Wt=a("span"),y(Ze.$$.fragment),cr=m(),zt=a("span"),mr=n("ASTForAudioClassification"),fo=m(),C=a("div"),y(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"),y(Ye.$$.fragment),br=m(),H=a("p"),yr=n("The "),ut=a("a"),vr=n("ASTForAudioClassification"),wr=n(" forward method, overrides the "),Zt=a("code"),Ar=n("__call__"),Mr=n(" special method."),Sr=m(),y(de.$$.fragment),$r=m(),y(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);v(d.$$.fragment,Rt),Rt.forEach(o),qt.forEach(o),g=u(Be),j=r(Be,"SPAN",{});var Xt=s(j);xo=i(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);v(he.$$.fragment,jr),jr.forEach(o),Jr.forEach(o),ko=u(Pe),At=r(Pe,"SPAN",{});var Fr=s(At);Jo=i(Fr,"Overview"),Fr.forEach(o),Pe.forEach(o),Bt=u(e),U=r(e,"P",{});var ft=s(U);jo=i(ft,"The Audio Spectrogram Transformer model was proposed in "),ge=r(ft,"A",{href:!0,rel:!0});var Ur=s(ge);Fo=i(Ur,"AST: Audio Spectrogram Transformer"),Ur.forEach(o),Uo=i(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=i(Nr,"Vision Transformer"),Nr.forEach(o),Io=i(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=i(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=i(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=i(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=i(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=i(Vr,"ASTFeatureExtractor"),Vr.forEach(o),qo=i(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=i(qr,"ast/src/get_norm_stats.py"),qr.forEach(o),Zr.forEach(o),Xo=i(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=i(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=i(Rr,"PSLA paper"),Rr.forEach(o),Qo=i(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=i(_o,"Audio pectrogram Transformer architecture. Taken from the "),ot=r(_o,"A",{href:!0});var Xr=s(ot);Lo=i(Xr,"original paper"),Xr.forEach(o),Do=i(_o,"."),_o.forEach(o),Kt=u(e),N=r(e,"P",{});var ht=s(N);Oo=i(ht,"This model was contributed by "),ye=r(ht,"A",{href:!0,rel:!0});var Yr=s(ye);Ko=i(Yr,"nielsr"),Yr.forEach(o),ea=i(ht,`.
The original code can be found `),ve=r(ht,"A",{href:!0,rel:!0});var Br=s(ve);ta=i(Br,"here"),Br.forEach(o),oa=i(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);v(we.$$.fragment,Qr),Qr.forEach(o),Pr.forEach(o),aa=u(To),Et=r(To,"SPAN",{});var Hr=s(Et);ra=i(Hr,"Resources"),Hr.forEach(o),To.forEach(o),to=u(e),at=r(e,"P",{});var Lr=s(at);sa=i(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),v(Ae.$$.fragment,e),ao=u(e),I=r(e,"UL",{});var gt=s(I);Me=r(gt,"LI",{});var bo=s(Me);na=i(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);ia=i(Dr,"here"),Dr.forEach(o),la=i(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=i(Or,"ASTForAudioClassification"),Or.forEach(o),ma=i(Qe," is supported by this "),$e=r(Qe,"A",{href:!0,rel:!0});var Kr=s($e);ua=i(Kr,"example script"),Kr.forEach(o),fa=i(Qe," and "),Ee=r(Qe,"A",{href:!0,rel:!0});var es=s(Ee);pa=i(es,"notebook"),es.forEach(o),ha=i(Qe,"."),Qe.forEach(o),ga=u(gt),Ce=r(gt,"LI",{});var yo=s(Ce);_a=i(yo,"See also: "),st=r(yo,"A",{href:!0});var ts=s(st);Ta=i(ts,"Audio classification"),ts.forEach(o),ba=i(yo,"."),yo.forEach(o),gt.forEach(o),ro=u(e),nt=r(e,"P",{});var os=s(nt);ya=i(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 vo=s(q);te=r(vo,"A",{id:!0,class:!0,href:!0});var as=s(te);Ct=r(as,"SPAN",{});var rs=s(Ct);v(xe.$$.fragment,rs),rs.forEach(o),as.forEach(o),va=u(vo),xt=r(vo,"SPAN",{});var ss=s(xt);wa=i(ss,"ASTConfig"),ss.forEach(o),vo.forEach(o),no=u(e),E=r(e,"DIV",{class:!0});var me=s(E);v(ke.$$.fragment,me),Aa=u(me),R=r(me,"P",{});var _t=s(R);Ma=i(_t,"This is the configuration class to store the configuration of a "),it=r(_t,"A",{href:!0});var ns=s(it);Sa=i(ns,"ASTModel"),ns.forEach(o),$a=i(_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 is=s(Je);Ea=i(is,"MIT/ast-finetuned-audioset-10-10-0.4593"),is.forEach(o),Ca=i(_t,`
architecture.`),_t.forEach(o),xa=u(me),X=r(me,"P",{});var Tt=s(X);ka=i(Tt,"Configuration objects inherit from "),lt=r(Tt,"A",{href:!0});var ls=s(lt);Ja=i(ls,"PretrainedConfig"),ls.forEach(o),ja=i(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=i(ds,"PretrainedConfig"),ds.forEach(o),Ua=i(Tt," for more information."),Tt.forEach(o),Na=u(me),v(oe.$$.fragment,me),me.forEach(o),io=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);v(je.$$.fragment,ms),ms.forEach(o),cs.forEach(o),Ia=u(wo),Jt=r(wo,"SPAN",{});var us=s(Jt);Ga=i(us,"ASTFeatureExtractor"),us.forEach(o),wo.forEach(o),lo=u(e),$=r(e,"DIV",{class:!0});var W=s($);v(Fe.$$.fragment,W),Wa=u(W),jt=r(W,"P",{});var fs=s(jt);za=i(fs,"Constructs a Audio Spectrogram Transformer (AST) feature extractor."),fs.forEach(o),Va=u(W),Ue=r(W,"P",{});var Ao=s(Ue);Za=i(Ao,"This feature extractor inherits from "),ct=r(Ao,"A",{href:!0});var ps=s(ct);qa=i(ps,"SequenceFeatureExtractor"),ps.forEach(o),Ra=i(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=i(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);v(Ne.$$.fragment,Mo),Pa=u(Mo),Ut=r(Mo,"P",{});var gs=s(Ut);Qa=i(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);v(Ie.$$.fragment,Ts),Ts.forEach(o),_s.forEach(o),Ha=u(So),It=r(So,"SPAN",{});var bs=s(It);La=i(bs,"ASTModel"),bs.forEach(o),So.forEach(o),mo=u(e),F=r(e,"DIV",{class:!0});var bt=s(F);v(Ge.$$.fragment,bt),Da=u(bt),We=r(bt,"P",{});var $o=s(We);Oa=i($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 ys=s(ze);Ka=i(ys,"torch.nn.Module"),ys.forEach(o),er=i($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);v(Ve.$$.fragment,ue),or=u(ue),P=r(ue,"P",{});var yt=s(P);ar=i(yt,"The "),mt=r(yt,"A",{href:!0});var vs=s(mt);rr=i(vs,"ASTModel"),vs.forEach(o),sr=i(yt," forward method, overrides the "),Gt=r(yt,"CODE",{});var ws=s(Gt);nr=i(ws,"__call__"),ws.forEach(o),ir=i(yt," special method."),yt.forEach(o),lr=u(ue),v(ne.$$.fragment,ue),dr=u(ue),v(ie.$$.fragment,ue),ue.forEach(o),bt.forEach(o),uo=u(e),Q=r(e,"H2",{class:!0});var Eo=s(Q);le=r(Eo,"A",{id:!0,class:!0,href:!0});var As=s(le);Wt=r(As,"SPAN",{});var Ms=s(Wt);v(Ze.$$.fragment,Ms),Ms.forEach(o),As.forEach(o),cr=u(Eo),zt=r(Eo,"SPAN",{});var Ss=s(zt);mr=i(Ss,"ASTForAudioClassification"),Ss.forEach(o),Eo.forEach(o),fo=u(e),C=r(e,"DIV",{class:!0});var fe=s(C);v(qe.$$.fragment,fe),ur=u(fe),Vt=r(fe,"P",{});var $s=s(Vt);fr=i($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=i(Co,"This model is a PyTorch "),Xe=r(Co,"A",{href:!0,rel:!0});var Es=s(Xe);gr=i(Es,"torch.nn.Module"),Es.forEach(o),_r=i(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);v(Ye.$$.fragment,pe),br=u(pe),H=r(pe,"P",{});var vt=s(H);yr=i(vt,"The "),ut=r(vt,"A",{href:!0});var Cs=s(ut);vr=i(Cs,"ASTForAudioClassification"),Cs.forEach(o),wr=i(vt," forward method, overrides the "),Zt=r(vt,"CODE",{});var xs=s(Zt);Ar=i(xs,"__call__"),xs.forEach(o),Mr=i(vt," special method."),vt.forEach(o),Sr=u(pe),v(de.$$.fragment,pe),$r=u(pe),v(ce.$$.fragment,pe),pe.forEach(o),fe.forEach(o),this.h()},h(){l(p,"name","hf:doc:metadata"),l(p,"content",JSON.stringify(Xs)),l(h,"id","audio-spectrogram-transformer"),l(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"),l(h,"href","#audio-spectrogram-transformer"),l(_,"class","relative group"),l(L,"id","overview"),l(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"),l(L,"href","#overview"),l(z,"class","relative group"),l(ge,"href","https://arxiv.org/abs/2104.01778"),l(ge,"rel","nofollow"),l(De,"href","vit"),l(tt,"href","/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTFeatureExtractor"),l(_e,"href","https://github.com/YuanGongND/ast/blob/master/src/get_norm_stats.py"),l(_e,"rel","nofollow"),l(be,"href","https://arxiv.org/abs/2102.01243"),l(be,"rel","nofollow"),Ns(O.src,kr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/audio_spectogram_transformer_architecture.png")||l(O,"src",kr),l(O,"alt","drawing"),l(O,"width","600"),l(ot,"href","https://arxiv.org/abs/2104.01778"),l(ye,"href","https://huggingface.co/nielsr"),l(ye,"rel","nofollow"),l(ve,"href","https://github.com/YuanGongND/ast"),l(ve,"rel","nofollow"),l(ee,"id","resources"),l(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"),l(ee,"href","#resources"),l(Z,"class","relative group"),l(Se,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/AST"),l(Se,"rel","nofollow"),l(rt,"href","/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification"),l($e,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification"),l($e,"rel","nofollow"),l(Ee,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb"),l(Ee,"rel","nofollow"),l(st,"href","../tasks/audio_classification"),l(te,"id","transformers.ASTConfig"),l(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"),l(te,"href","#transformers.ASTConfig"),l(q,"class","relative group"),l(it,"href","/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel"),l(Je,"href","https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593"),l(Je,"rel","nofollow"),l(lt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(dt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ae,"id","transformers.ASTFeatureExtractor"),l(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"),l(ae,"href","#transformers.ASTFeatureExtractor"),l(Y,"class","relative group"),l(ct,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),l(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(se,"id","transformers.ASTModel"),l(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"),l(se,"href","#transformers.ASTModel"),l(B,"class","relative group"),l(ze,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(ze,"rel","nofollow"),l(mt,"href","/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTModel"),l(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(le,"id","transformers.ASTForAudioClassification"),l(le,"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"),l(le,"href","#transformers.ASTForAudioClassification"),l(Q,"class","relative group"),l(Xe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Xe,"rel","nofollow"),l(ut,"href","/docs/transformers/main/en/model_doc/audio-spectrogram-transformer#transformers.ASTForAudioClassification"),l(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(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,ye),t(ye,Ko),t(N,ea),t(N,ve),t(ve,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,ia),t(Me,la),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,ya),f(e,so,c),f(e,q,c),t(q,te),t(te,Ct),w(xe,Ct,null),t(q,va),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,it),t(it,Sa),t(R,$a),t(R,Je),t(Je,Ea),t(R,Ca),t(E,xa),t(E,X),t(X,ka),t(X,lt),t(lt,Ja),t(X,ja),t(X,dt),t(dt,Fa),t(X,Ua),t(E,Na),w(oe,E,null),f(e,io,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,lo,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,ir),t(k,lr),w(ne,k,null),t(k,dr),w(ie,k,null),f(e,uo,c),f(e,Q,c),t(Q,le),t(le,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,yr),t(H,ut),t(ut,vr),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}),ie.$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(ie.$$.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(ie.$$.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(io),e&&o(Y),S(je),e&&o(lo),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(ie),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};
