import{S as Zn,i as In,s as Fn,e as n,k as l,w as v,t as s,M as Rn,c as a,d as t,m as h,a as r,x as y,h as c,b as i,G as e,g as u,y as w,q as E,o as k,B as M,v as Vn,L as Nn}from"../../chunks/vendor-hf-doc-builder.js";import{T as qn}from"../../chunks/Tip-hf-doc-builder.js";import{D as je}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Qt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as no}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Un}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bn(G){let p,$,g,f,b;return f=new Qt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVuY29kZWNNb2RlbCUyQyUyMEVuY29kZWNDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwJTIyZmFjZWJvb2slMkZlbmNvZGVjXzI0a2h6JTIyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEVuY29kZWNDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwJTIyZmFjZWJvb2slMkZlbmNvZGVjXzI0a2h6JTIyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBFbmNvZGVjTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> EncodecModel, EncodecConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a &quot;facebook/encodec_24khz&quot; style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = EncodecConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the &quot;facebook/encodec_24khz&quot; style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EncodecModel(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=n("p"),$=s("Example:"),g=l(),v(f.$$.fragment)},l(d){p=a(d,"P",{});var _=r(p);$=c(_,"Example:"),_.forEach(t),g=h(d),y(f.$$.fragment,d)},m(d,_){u(d,p,_),e(p,$),u(d,g,_),w(f,d,_),b=!0},p:Nn,i(d){b||(E(f.$$.fragment,d),b=!0)},o(d){k(f.$$.fragment,d),b=!1},d(d){d&&t(p),d&&t(g),M(f,d)}}}function Gn(G){let p,$,g,f,b;return{c(){p=n("p"),$=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=s("Module"),b=s(`
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=a(d,"P",{});var _=r(p);$=c(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(_,"CODE",{});var X=r(g);f=c(X,"Module"),X.forEach(t),b=c(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(d,_){u(d,p,_),e(p,$),e(p,g),e(g,f),e(p,b)},d(d){d&&t(p)}}}function Xn(G){let p,$,g,f,b;return f=new Qt({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBFbmNvZGVjTW9kZWwlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmFzaHJhcSUyRmVzYzUwJTIyKSUwQWF1ZGlvX3NhbXBsZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCMCU1RCU1QiUyMmFycmF5JTIyJTVEJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJmYWNlYm9vayUyRmVuY29kZWNfMjRraHolMjIlMEFtb2RlbCUyMCUzRCUyMEVuY29kZWNNb2RlbC5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHJhd19hdWRpbyUzRGF1ZGlvX3NhbXBsZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWF1ZGlvX2NvZGVzJTIwJTNEJTIwb3V0cHV0cy5hdWRpb19jb2RlcyUwQWF1ZGlvX3ZhbHVlcyUyMCUzRCUyMG91dHB1dHMuYXVkaW9fdmFsdWVz",highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, EncodecModel

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;ashraq/esc50&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_sample = dataset[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;array&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;facebook/encodec_24khz&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EncodecModel.from_pretrained(model_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(model_id)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(raw_audio=audio_sample, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_codes = outputs.audio_codes
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_values = outputs.audio_values`}}),{c(){p=n("p"),$=s("Examples:"),g=l(),v(f.$$.fragment)},l(d){p=a(d,"P",{});var _=r(p);$=c(_,"Examples:"),_.forEach(t),g=h(d),y(f.$$.fragment,d)},m(d,_){u(d,p,_),e(p,$),u(d,g,_),w(f,d,_),b=!0},p:Nn,i(d){b||(E(f.$$.fragment,d),b=!0)},o(d){k(f.$$.fragment,d),b=!1},d(d){d&&t(p),d&&t(g),M(f,d)}}}function Pn(G){let p,$,g,f,b,d,_,X,Jo,ao,Z,P,qe,te,zo,Be,Wo,ro,A,Co,ne,Uo,No,so,xe,Zo,co,Je,Ge,Io,io,x,Fo,ae,Ro,Vo,re,qo,Bo,se,Go,Xo,ce,Po,Ao,lo,ie,ho,I,Y,Xe,de,Yo,Pe,So,mo,J,le,Ho,F,Qo,ze,Do,Lo,he,Oo,Ko,et,R,ot,We,tt,nt,Ce,at,rt,st,S,po,V,H,Ae,me,ct,Ye,it,uo,j,pe,dt,Se,lt,ht,ue,mt,Ue,pt,ut,ft,fe,gt,ge,_t,bt,vt,Q,_e,yt,He,wt,fo,q,D,Qe,be,Et,De,kt,go,T,ve,Mt,ye,Tt,Ne,$t,jt,xt,we,Jt,Ee,zt,Wt,Ct,C,ke,Ut,Le,Nt,Zt,Oe,It,Ft,L,Me,Rt,Ke,Vt,qt,z,Te,Bt,B,Gt,Ze,Xt,Pt,eo,At,Yt,St,O,Ht,K,_o;return d=new no({}),te=new no({}),ie=new Qt({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTJDJTIwQXVkaW8lMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwRW5jb2RlY01vZGVsJTJDJTIwQXV0b1Byb2Nlc3NvciUwQWxpYnJpc3BlZWNoX2R1bW15JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZsaWJyaXNwZWVjaF9hc3JfZHVtbXklMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEElMEFtb2RlbCUyMCUzRCUyMEVuY29kZWNNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZlbmNvZGVjXzI0a2h6JTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGZW5jb2RlY18yNGtoeiUyMiklMEFsaWJyaXNwZWVjaF9kdW1teSUyMCUzRCUyMGxpYnJpc3BlZWNoX2R1bW15LmNhc3RfY29sdW1uKCUyMmF1ZGlvJTIyJTJDJTIwQXVkaW8oc2FtcGxpbmdfcmF0ZSUzRHByb2Nlc3Nvci5zYW1wbGluZ19yYXRlKSklMEFhdWRpb19zYW1wbGUlMjAlM0QlMjBsaWJyaXNwZWVjaF9kdW1teSU1Qi0xJTVEJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihyYXdfYXVkaW8lM0RhdWRpb19zYW1wbGUlMkMlMjBzYW1wbGluZ19yYXRlJTNEcHJvY2Vzc29yLnNhbXBsaW5nX3JhdGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQWVuY29kZXJfb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmVuY29kZShpbnB1dHMlNUIlMjJpbnB1dF92YWx1ZXMlMjIlNUQlMkMlMjBpbnB1dHMlNUIlMjJwYWRkaW5nX21hc2slMjIlNUQpJTBBYXVkaW9fdmFsdWVzJTIwJTNEJTIwbW9kZWwuZGVjb2RlKGVuY29kZXJfb3V0cHV0cy5hdWRpb19jb2RlcyUyQyUyMGVuY29kZXJfb3V0cHV0cy5hdWRpb19zY2FsZXMlMkMlMjBpbnB1dHMlNUIlMjJwYWRkaW5nX21hc2slMjIlNUQpJTVCMCU1RCUwQSUyMyUyMG9yJTIwdGhlJTIwZXF1aXZhbGVudCUyMHdpdGglMjBhJTIwZm9yd2FyZCUyMHBhc3MlMEFhdWRpb192YWx1ZXMlMjAlM0QlMjBtb2RlbChpbnB1dHMlNUIlMjJpbnB1dF92YWx1ZXMlMjIlNUQlMkMlMjBpbnB1dHMlNUIlMjJwYWRkaW5nX21hc2slMjIlNUQpLmF1ZGlvX3ZhbHVlcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset, Audio
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> EncodecModel, AutoProcessor
<span class="hljs-meta">&gt;&gt;&gt; </span>librispeech_dummy = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&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>model = EncodecModel.from_pretrained(<span class="hljs-string">&quot;facebook/encodec_24khz&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/encodec_24khz&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>librispeech_dummy = librispeech_dummy.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=processor.sampling_rate))
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_sample = librispeech_dummy[-<span class="hljs-number">1</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(raw_audio=audio_sample, sampling_rate=processor.sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>encoder_outputs = model.encode(inputs[<span class="hljs-string">&quot;input_values&quot;</span>], inputs[<span class="hljs-string">&quot;padding_mask&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_values = model.decode(encoder_outputs.audio_codes, encoder_outputs.audio_scales, inputs[<span class="hljs-string">&quot;padding_mask&quot;</span>])[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or the equivalent with a forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_values = model(inputs[<span class="hljs-string">&quot;input_values&quot;</span>], inputs[<span class="hljs-string">&quot;padding_mask&quot;</span>]).audio_values`}}),de=new no({}),le=new je({props:{name:"class transformers.EncodecConfig",anchor:"transformers.EncodecConfig",parameters:[{name:"target_bandwidths",val:" = [1.5, 3.0, 6.0, 12.0, 24.0]"},{name:"sampling_rate",val:" = 24000"},{name:"audio_channels",val:" = 1"},{name:"normalize",val:" = False"},{name:"chunk_length_s",val:" = None"},{name:"overlap",val:" = None"},{name:"hidden_size",val:" = 128"},{name:"num_filters",val:" = 32"},{name:"num_residual_layers",val:" = 1"},{name:"upsampling_ratios",val:" = [8, 5, 4, 2]"},{name:"norm_type",val:" = 'weight_norm'"},{name:"kernel_size",val:" = 7"},{name:"last_kernel_size",val:" = 7"},{name:"residual_kernel_size",val:" = 3"},{name:"dilation_growth_rate",val:" = 2"},{name:"use_causal_conv",val:" = True"},{name:"pad_mode",val:" = 'reflect'"},{name:"compress",val:" = 2"},{name:"num_lstm_layers",val:" = 2"},{name:"trim_right_ratio",val:" = 1.0"},{name:"codebook_size",val:" = 1024"},{name:"codebook_dim",val:" = None"},{name:"use_conv_shortcut",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EncodecConfig.target_bandwidths",description:`<strong>target_bandwidths</strong> (<code>List[float]</code>, <em>optional</em>, defaults to <code>[1.5, 3.0, 6.0, 12.0, 24.0]</code>) &#x2014;
The range of diffent bandwiths the model can encode audio with.`,name:"target_bandwidths"},{anchor:"transformers.EncodecConfig.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 24000) &#x2014;
The sampling rate at which the audio waveform should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.EncodecConfig.audio_channels",description:`<strong>audio_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of channels in the audio data. Either 1 for mono or 2 for stereo.`,name:"audio_channels"},{anchor:"transformers.EncodecConfig.normalize",description:`<strong>normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the audio shall be normalized when passed.`,name:"normalize"},{anchor:"transformers.EncodecConfig.chunk_length_s",description:`<strong>chunk_length_s</strong> (<code>float</code>, <em>optional</em>) &#x2014;
If defined the audio is pre-processed into chunks of lengths <code>chunk_length_s</code> and then encoded.`,name:"chunk_length_s"},{anchor:"transformers.EncodecConfig.overlap",description:`<strong>overlap</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Defines the overlap between each chunk. It is used to compute the <code>chunk_stride</code> using the following
formulae : <code>int((1.0 - self.overlap) * self.chunk_length)</code>.`,name:"overlap"},{anchor:"transformers.EncodecConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Intermediate representation dimension.`,name:"hidden_size"},{anchor:"transformers.EncodecConfig.num_filters",description:`<strong>num_filters</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of convolution kernels of first <code>EncodecConv1d</code> down sampling layer.`,name:"num_filters"},{anchor:"transformers.EncodecConfig.num_residual_layers",description:`<strong>num_residual_layers</strong> (<code>int</code>,  <em>optional</em>, defaults to 1) &#x2014;
Number of residual layers.`,name:"num_residual_layers"},{anchor:"transformers.EncodecConfig.upsampling_ratios",description:`<strong>upsampling_ratios</strong> (<code>Sequence[int]</code> , <em>optional</em>, defaults to <code>[8, 5, 4, 2]</code>) &#x2014;
Kernel size and stride ratios. The encoder uses downsampling ratios instead of upsampling ratios, hence it
will use the ratios in the reverse order to the ones specified here that must match the decoder order.`,name:"upsampling_ratios"},{anchor:"transformers.EncodecConfig.norm_type",description:`<strong>norm_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;weight_norm&quot;</code>) &#x2014;
Normalization method. Should be in <code>[&quot;weight_norm&quot;, &quot;time_group_norm&quot;]</code>`,name:"norm_type"},{anchor:"transformers.EncodecConfig.kernel_size",description:`<strong>kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Kernel size for the initial convolution.`,name:"kernel_size"},{anchor:"transformers.EncodecConfig.last_kernel_size",description:`<strong>last_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Kernel size for the last convolution layer.`,name:"last_kernel_size"},{anchor:"transformers.EncodecConfig.residual_kernel_size",description:`<strong>residual_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Kernel size for the residual layers.`,name:"residual_kernel_size"},{anchor:"transformers.EncodecConfig.dilation_growth_rate",description:`<strong>dilation_growth_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
How much to increase the dilation with each layer.`,name:"dilation_growth_rate"},{anchor:"transformers.EncodecConfig.use_causal_conv",description:`<strong>use_causal_conv</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use fully causal convolution.`,name:"use_causal_conv"},{anchor:"transformers.EncodecConfig.pad_mode",description:`<strong>pad_mode</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;reflect&quot;</code>) &#x2014;
Padding mode for the convolutions.`,name:"pad_mode"},{anchor:"transformers.EncodecConfig.compress",description:`<strong>compress</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Reduced dimensionality in residual branches (from Demucs v3).`,name:"compress"},{anchor:"transformers.EncodecConfig.num_lstm_layers",description:`<strong>num_lstm_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Number of LSTM layers at the end of the encoder.`,name:"num_lstm_layers"},{anchor:"transformers.EncodecConfig.trim_right_ratio",description:`<strong>trim_right_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Ratio for trimming at the right of the transposed convolution under the <code>use_causal_conv = True</code> setup. If
equal to 1.0, it means that all the trimming is done at the right.`,name:"trim_right_ratio"},{anchor:"transformers.EncodecConfig.codebook_size",description:`<strong>codebook_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Number of discret codes that make up VQVAE.`,name:"codebook_size"},{anchor:"transformers.EncodecConfig.codebook_dim",description:`<strong>codebook_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Dimension of the codebook vectors. If not defined, uses <code>hidden_size</code>.`,name:"codebook_dim"},{anchor:"transformers.EncodecConfig.use_conv_shortcut",description:`<strong>use_conv_shortcut</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a convolutional layer as the &#x2018;skip&#x2019; connection in the <code>EncodecResnetBlock</code> block. If False,
an identity function will be used, giving a generic residual connection.`,name:"use_conv_shortcut"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/encodec/configuration_encodec.py#L35"}}),S=new Un({props:{anchor:"transformers.EncodecConfig.example",$$slots:{default:[Bn]},$$scope:{ctx:G}}}),me=new no({}),pe=new je({props:{name:"class transformers.EncodecFeatureExtractor",anchor:"transformers.EncodecFeatureExtractor",parameters:[{name:"feature_size",val:": int = 1"},{name:"sampling_rate",val:": int = 24000"},{name:"padding_value",val:": float = 0.0"},{name:"chunk_length_s",val:": float = None"},{name:"overlap",val:": float = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EncodecFeatureExtractor.feature_size",description:`<strong>feature_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The feature dimension of the extracted features. Use 1 for mono, 2 for stereo.`,name:"feature_size"},{anchor:"transformers.EncodecFeatureExtractor.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 24000) &#x2014;
The sampling rate at which the audio waveform should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.EncodecFeatureExtractor.padding_value",description:`<strong>padding_value</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The value that is used to fill the padding values.`,name:"padding_value"},{anchor:"transformers.EncodecFeatureExtractor.chunk_length_s",description:`<strong>chunk_length_s</strong> (<code>float</code>, <em>optional</em>) &#x2014;
If defined the audio is pre-processed into chunks of lengths <code>chunk_length_s</code> and then encoded.`,name:"chunk_length_s"},{anchor:"transformers.EncodecFeatureExtractor.overlap",description:`<strong>overlap</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Defines the overlap between each chunk. It is used to compute the <code>chunk_stride</code> using the following
formulae : <code>int((1.0 - self.overlap) * self.chunk_length)</code>.`,name:"overlap"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/encodec/feature_extraction_encodec.py#L29"}}),_e=new je({props:{name:"__call__",anchor:"transformers.EncodecFeatureExtractor.__call__",parameters:[{name:"raw_audio",val:": typing.Union[numpy.ndarray, typing.List[float], typing.List[numpy.ndarray], typing.List[typing.List[float]]]"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy, NoneType] = None"},{name:"truncation",val:": typing.Optional[bool] = False"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"sampling_rate",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.EncodecFeatureExtractor.__call__.raw_audio",description:`<strong>raw_audio</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 processed. 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. The numpy array must be of shape
<code>(num_samples,)</code> for mono audio (<code>feature_size = 1</code>), or <code>(2, num_samples)</code> for stereo audio
(<code>feature_size = 2</code>).`,name:"raw_audio"},{anchor:"transformers.EncodecFeatureExtractor.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.32.0/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Select a strategy to pad the returned sequences (according to the model&#x2019;s padding side and padding
index) among:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.EncodecFeatureExtractor.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates truncation to cut input sequences longer than <code>max_length</code> to <code>max_length</code>.`,name:"truncation"},{anchor:"transformers.EncodecFeatureExtractor.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum length of the returned list and optionally padding length (see above).`,name:"max_length"},{anchor:"transformers.EncodecFeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.32.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"},{anchor:"transformers.EncodecFeatureExtractor.__call__.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The sampling rate at which the <code>audio</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"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/encodec/feature_extraction_encodec.py#L84"}}),be=new no({}),ve=new je({props:{name:"class transformers.EncodecModel",anchor:"transformers.EncodecModel",parameters:[{name:"config",val:": EncodecConfig"}],parametersDescription:[{anchor:"transformers.EncodecModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/encodec#transformers.EncodecConfig">EncodecConfig</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.32.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.32.0/src/transformers/models/encodec/modeling_encodec.py#L535"}}),ke=new je({props:{name:"decode",anchor:"transformers.EncodecModel.decode",parameters:[{name:"audio_codes",val:": Tensor"},{name:"audio_scales",val:": Tensor"},{name:"padding_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EncodecModel.decode.audio_codes",description:`<strong>audio_codes</strong> (<code>torch.FloatTensor</code>  of shape <code>(batch_size, nb_chunks, chunk_length)</code>, <em>optional</em>) &#x2014;
Discret code embeddings computed using <code>model.encode</code>.`,name:"audio_codes"},{anchor:"transformers.EncodecModel.decode.audio_scales",description:`<strong>audio_scales</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, nb_chunks)</code>, <em>optional</em>) &#x2014;
Scaling factor for each <code>audio_codes</code> input.`,name:"audio_scales"},{anchor:"transformers.EncodecModel.decode.padding_mask",description:`<strong>padding_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, channels, sequence_length)</code>) &#x2014;
Padding mask used to pad the <code>input_values</code>.`,name:"padding_mask"},{anchor:"transformers.EncodecModel.decode.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.32.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.32.0/src/transformers/models/encodec/modeling_encodec.py#L712"}}),Me=new je({props:{name:"encode",anchor:"transformers.EncodecModel.encode",parameters:[{name:"input_values",val:": Tensor"},{name:"padding_mask",val:": Tensor = None"},{name:"bandwidth",val:": typing.Optional[float] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EncodecModel.encode.input_values",description:`<strong>input_values</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, channels, sequence_length)</code>) &#x2014;
Float values of the input audio waveform.`,name:"input_values"},{anchor:"transformers.EncodecModel.encode.padding_mask",description:`<strong>padding_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, channels, sequence_length)</code>) &#x2014;
Padding mask used to pad the <code>input_values</code>.`,name:"padding_mask"},{anchor:"transformers.EncodecModel.encode.bandwidth",description:`<strong>bandwidth</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The target bandwidth. Must be one of <code>config.target_bandwidths</code>. If <code>None</code>, uses the smallest possible
bandwidth. bandwidth is represented as a thousandth of what it is, e.g. 6kbps bandwidth is represented
as bandwidth == 6.0`,name:"bandwidth"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/encodec/modeling_encodec.py#L584",returnDescription:`
<p>A list of frames containing the discrete encoded codes for the input audio waveform, along with rescaling
factors for each chunk when <code>normalize</code> is True. Each frames is a tuple <code>(codebook, scale)</code>, with
<code>codebook</code> of shape <code>[batch_size, num_codebooks, frames]</code>.</p>
`}}),Te=new je({props:{name:"forward",anchor:"transformers.EncodecModel.forward",parameters:[{name:"input_values",val:": Tensor"},{name:"padding_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"bandwidth",val:": typing.Optional[float] = None"},{name:"audio_codes",val:": typing.Optional[torch.Tensor] = None"},{name:"audio_scales",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EncodecModel.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, channels, sequence_length)</code>, <em>optional</em>) &#x2014;
Raw audio input converted to Float and padded to the approriate length in order to be encoded using chunks
of length self.chunk_length and a stride of <code>config.chunk_stride</code>.`,name:"input_values"},{anchor:"transformers.EncodecModel.forward.padding_mask",description:`<strong>padding_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, channels, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid computing scaling factors on padding token indices (can we avoid computing conv on these+).
Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>padding_mask</code> should always be passed, unless the input was truncated or not padded. This is because in
order to process tensors effectively, the input audio should be padded so that <code>input_length % stride = step</code> with <code>step = chunk_length-stride</code>. This ensures that all chunks are of the same shape</p>

					</div>`,name:"padding_mask"},{anchor:"transformers.EncodecModel.forward.bandwidth",description:`<strong>bandwidth</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The target bandwidth. Must be one of <code>config.target_bandwidths</code>. If <code>None</code>, uses the smallest possible
bandwidth. bandwidth is represented as a thousandth of what it is, e.g. 6kbps bandwidth is represented as
<code>bandwidth == 6.0</code>`,name:"bandwidth"},{anchor:"transformers.EncodecModel.forward.audio_codes",description:`<strong>audio_codes</strong> (<code>torch.FloatTensor</code>  of shape <code>(batch_size, nb_chunks, chunk_length)</code>, <em>optional</em>) &#x2014;
Discret code embeddings computed using <code>model.encode</code>.`,name:"audio_codes"},{anchor:"transformers.EncodecModel.forward.audio_scales",description:`<strong>audio_scales</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, nb_chunks)</code>, <em>optional</em>) &#x2014;
Scaling factor for each <code>audio_codes</code> input.`,name:"audio_scales"},{anchor:"transformers.EncodecModel.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.32.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.32.0/src/transformers/models/encodec/modeling_encodec.py#L760",returnDescription:`
<p>A <code>transformers.models.encodec.modeling_encodec.EncodecOutput</code> 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.32.0/en/model_doc/encodec#transformers.EncodecConfig"
>EncodecConfig</a>) and inputs.</p>
<ul>
<li><strong>audio_codes</strong> (<code>torch.FloatTensor</code>  of shape <code>(batch_size, nb_chunks, chunk_length)</code>, <em>optional</em>) \u2014 Discret code embeddings computed using <code>model.encode</code>.</li>
<li><strong>audio_values</strong> (<code>torch.FlaotTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>)
Decoded audio values, obtained using the decoder part of Encodec.</li>
</ul>
`,returnType:`
<p><code>transformers.models.encodec.modeling_encodec.EncodecOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),O=new qn({props:{$$slots:{default:[Gn]},$$scope:{ctx:G}}}),K=new Un({props:{anchor:"transformers.EncodecModel.forward.example",$$slots:{default:[Xn]},$$scope:{ctx:G}}}),{c(){p=n("meta"),$=l(),g=n("h1"),f=n("a"),b=n("span"),v(d.$$.fragment),_=l(),X=n("span"),Jo=s("EnCodec"),ao=l(),Z=n("h2"),P=n("a"),qe=n("span"),v(te.$$.fragment),zo=l(),Be=n("span"),Wo=s("Overview"),ro=l(),A=n("p"),Co=s("The EnCodec neural codec model was proposed in "),ne=n("a"),Uo=s("High Fidelity Neural Audio Compression"),No=s(" by Alexandre D\xE9fossez, Jade Copet, Gabriel Synnaeve, Yossi Adi."),so=l(),xe=n("p"),Zo=s("The abstract from the paper is the following:"),co=l(),Je=n("p"),Ge=n("em"),Io=s("We introduce a state-of-the-art real-time, high-fidelity, audio codec leveraging neural networks. It consists in a streaming encoder-decoder architecture with quantized latent space trained in an end-to-end fashion. We simplify and speed-up the training by using a single multiscale spectrogram adversary that efficiently reduces artifacts and produce high-quality samples. We introduce a novel loss balancer mechanism to stabilize training: the weight of a loss now defines the fraction of the overall gradient it should represent, thus decoupling the choice of this hyper-parameter from the typical scale of the loss. Finally, we study how lightweight Transformer models can be used to further compress the obtained representation by up to 40%, while staying faster than real time. We provide a detailed description of the key design choices of the proposed model including: training objective, architectural changes and a study of various perceptual loss functions. We present an extensive subjective evaluation (MUSHRA tests) together with an ablation study for a range of bandwidths and audio domains, including speech, noisy-reverberant speech, and music. Our approach is superior to the baselines methods across all evaluated settings, considering both 24 kHz monophonic and 48 kHz stereophonic audio."),io=l(),x=n("p"),Fo=s("This model was contributed by "),ae=n("a"),Ro=s("Matthijs"),Vo=s(", "),re=n("a"),qo=s("Patrick Von Platen"),Bo=s(" and "),se=n("a"),Go=s("Arthur Zucker"),Xo=s(`.
The original code can be found `),ce=n("a"),Po=s("here"),Ao=s(`.
Here is a quick example of how to encode and decode an audio using this model:`),lo=l(),v(ie.$$.fragment),ho=l(),I=n("h2"),Y=n("a"),Xe=n("span"),v(de.$$.fragment),Yo=l(),Pe=n("span"),So=s("EncodecConfig"),mo=l(),J=n("div"),v(le.$$.fragment),Ho=l(),F=n("p"),Qo=s("This is the configuration class to store the configuration of an "),ze=n("a"),Do=s("EncodecModel"),Lo=s(`. It is used to instantiate a
Encodec 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
`),he=n("a"),Oo=s("facebook/encodec_24khz"),Ko=s(" architecture."),et=l(),R=n("p"),ot=s("Configuration objects inherit from "),We=n("a"),tt=s("PretrainedConfig"),nt=s(` and can be used to control the model outputs. Read the
documentation from `),Ce=n("a"),at=s("PretrainedConfig"),rt=s(" for more information."),st=l(),v(S.$$.fragment),po=l(),V=n("h2"),H=n("a"),Ae=n("span"),v(me.$$.fragment),ct=l(),Ye=n("span"),it=s("EncodecFeatureExtractor"),uo=l(),j=n("div"),v(pe.$$.fragment),dt=l(),Se=n("p"),lt=s("Constructs an EnCodec feature extractor."),ht=l(),ue=n("p"),mt=s("This feature extractor inherits from "),Ue=n("a"),pt=s("SequenceFeatureExtractor"),ut=s(` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),ft=l(),fe=n("p"),gt=s(`Instantiating a feature extractor with the defaults will yield a similar configuration to that of the
`),ge=n("a"),_t=s("facebook/encodec_24khz"),bt=s(" architecture."),vt=l(),Q=n("div"),v(_e.$$.fragment),yt=l(),He=n("p"),wt=s("Main method to featurize and prepare for the model one or several sequence(s)."),fo=l(),q=n("h2"),D=n("a"),Qe=n("span"),v(be.$$.fragment),Et=l(),De=n("span"),kt=s("EncodecModel"),go=l(),T=n("div"),v(ve.$$.fragment),Mt=l(),ye=n("p"),Tt=s(`The EnCodec neural audio codec model.
This model inherits from `),Ne=n("a"),$t=s("PreTrainedModel"),jt=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),xt=l(),we=n("p"),Jt=s("This model is also a PyTorch "),Ee=n("a"),zt=s("torch.nn.Module"),Wt=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ct=l(),C=n("div"),v(ke.$$.fragment),Ut=l(),Le=n("p"),Nt=s("Decodes the given frames into an output audio waveform."),Zt=l(),Oe=n("p"),It=s(`Note that the output might be a bit bigger than the input. In that case, any extra steps at the end can be
trimmed.`),Ft=l(),L=n("div"),v(Me.$$.fragment),Rt=l(),Ke=n("p"),Vt=s("Encodes the input audio waveform into discrete codes."),qt=l(),z=n("div"),v(Te.$$.fragment),Bt=l(),B=n("p"),Gt=s("The "),Ze=n("a"),Xt=s("EncodecModel"),Pt=s(" forward method, overrides the "),eo=n("code"),At=s("__call__"),Yt=s(" special method."),St=l(),v(O.$$.fragment),Ht=l(),v(K.$$.fragment),this.h()},l(o){const m=Rn('[data-svelte="svelte-1phssyn"]',document.head);p=a(m,"META",{name:!0,content:!0}),m.forEach(t),$=h(o),g=a(o,"H1",{class:!0});var $e=r(g);f=a($e,"A",{id:!0,class:!0,href:!0});var oo=r(f);b=a(oo,"SPAN",{});var to=r(b);y(d.$$.fragment,to),to.forEach(t),oo.forEach(t),_=h($e),X=a($e,"SPAN",{});var Dt=r(X);Jo=c(Dt,"EnCodec"),Dt.forEach(t),$e.forEach(t),ao=h(o),Z=a(o,"H2",{class:!0});var bo=r(Z);P=a(bo,"A",{id:!0,class:!0,href:!0});var Lt=r(P);qe=a(Lt,"SPAN",{});var Ot=r(qe);y(te.$$.fragment,Ot),Ot.forEach(t),Lt.forEach(t),zo=h(bo),Be=a(bo,"SPAN",{});var Kt=r(Be);Wo=c(Kt,"Overview"),Kt.forEach(t),bo.forEach(t),ro=h(o),A=a(o,"P",{});var vo=r(A);Co=c(vo,"The EnCodec neural codec model was proposed in "),ne=a(vo,"A",{href:!0,rel:!0});var en=r(ne);Uo=c(en,"High Fidelity Neural Audio Compression"),en.forEach(t),No=c(vo," by Alexandre D\xE9fossez, Jade Copet, Gabriel Synnaeve, Yossi Adi."),vo.forEach(t),so=h(o),xe=a(o,"P",{});var on=r(xe);Zo=c(on,"The abstract from the paper is the following:"),on.forEach(t),co=h(o),Je=a(o,"P",{});var tn=r(Je);Ge=a(tn,"EM",{});var nn=r(Ge);Io=c(nn,"We introduce a state-of-the-art real-time, high-fidelity, audio codec leveraging neural networks. It consists in a streaming encoder-decoder architecture with quantized latent space trained in an end-to-end fashion. We simplify and speed-up the training by using a single multiscale spectrogram adversary that efficiently reduces artifacts and produce high-quality samples. We introduce a novel loss balancer mechanism to stabilize training: the weight of a loss now defines the fraction of the overall gradient it should represent, thus decoupling the choice of this hyper-parameter from the typical scale of the loss. Finally, we study how lightweight Transformer models can be used to further compress the obtained representation by up to 40%, while staying faster than real time. We provide a detailed description of the key design choices of the proposed model including: training objective, architectural changes and a study of various perceptual loss functions. We present an extensive subjective evaluation (MUSHRA tests) together with an ablation study for a range of bandwidths and audio domains, including speech, noisy-reverberant speech, and music. Our approach is superior to the baselines methods across all evaluated settings, considering both 24 kHz monophonic and 48 kHz stereophonic audio."),nn.forEach(t),tn.forEach(t),io=h(o),x=a(o,"P",{});var U=r(x);Fo=c(U,"This model was contributed by "),ae=a(U,"A",{href:!0,rel:!0});var an=r(ae);Ro=c(an,"Matthijs"),an.forEach(t),Vo=c(U,", "),re=a(U,"A",{href:!0,rel:!0});var rn=r(re);qo=c(rn,"Patrick Von Platen"),rn.forEach(t),Bo=c(U," and "),se=a(U,"A",{href:!0,rel:!0});var sn=r(se);Go=c(sn,"Arthur Zucker"),sn.forEach(t),Xo=c(U,`.
The original code can be found `),ce=a(U,"A",{href:!0,rel:!0});var cn=r(ce);Po=c(cn,"here"),cn.forEach(t),Ao=c(U,`.
Here is a quick example of how to encode and decode an audio using this model:`),U.forEach(t),lo=h(o),y(ie.$$.fragment,o),ho=h(o),I=a(o,"H2",{class:!0});var yo=r(I);Y=a(yo,"A",{id:!0,class:!0,href:!0});var dn=r(Y);Xe=a(dn,"SPAN",{});var ln=r(Xe);y(de.$$.fragment,ln),ln.forEach(t),dn.forEach(t),Yo=h(yo),Pe=a(yo,"SPAN",{});var hn=r(Pe);So=c(hn,"EncodecConfig"),hn.forEach(t),yo.forEach(t),mo=h(o),J=a(o,"DIV",{class:!0});var ee=r(J);y(le.$$.fragment,ee),Ho=h(ee),F=a(ee,"P",{});var Ie=r(F);Qo=c(Ie,"This is the configuration class to store the configuration of an "),ze=a(Ie,"A",{href:!0});var mn=r(ze);Do=c(mn,"EncodecModel"),mn.forEach(t),Lo=c(Ie,`. It is used to instantiate a
Encodec 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
`),he=a(Ie,"A",{href:!0,rel:!0});var pn=r(he);Oo=c(pn,"facebook/encodec_24khz"),pn.forEach(t),Ko=c(Ie," architecture."),Ie.forEach(t),et=h(ee),R=a(ee,"P",{});var Fe=r(R);ot=c(Fe,"Configuration objects inherit from "),We=a(Fe,"A",{href:!0});var un=r(We);tt=c(un,"PretrainedConfig"),un.forEach(t),nt=c(Fe,` and can be used to control the model outputs. Read the
documentation from `),Ce=a(Fe,"A",{href:!0});var fn=r(Ce);at=c(fn,"PretrainedConfig"),fn.forEach(t),rt=c(Fe," for more information."),Fe.forEach(t),st=h(ee),y(S.$$.fragment,ee),ee.forEach(t),po=h(o),V=a(o,"H2",{class:!0});var wo=r(V);H=a(wo,"A",{id:!0,class:!0,href:!0});var gn=r(H);Ae=a(gn,"SPAN",{});var _n=r(Ae);y(me.$$.fragment,_n),_n.forEach(t),gn.forEach(t),ct=h(wo),Ye=a(wo,"SPAN",{});var bn=r(Ye);it=c(bn,"EncodecFeatureExtractor"),bn.forEach(t),wo.forEach(t),uo=h(o),j=a(o,"DIV",{class:!0});var N=r(j);y(pe.$$.fragment,N),dt=h(N),Se=a(N,"P",{});var vn=r(Se);lt=c(vn,"Constructs an EnCodec feature extractor."),vn.forEach(t),ht=h(N),ue=a(N,"P",{});var Eo=r(ue);mt=c(Eo,"This feature extractor inherits from "),Ue=a(Eo,"A",{href:!0});var yn=r(Ue);pt=c(yn,"SequenceFeatureExtractor"),yn.forEach(t),ut=c(Eo,` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),Eo.forEach(t),ft=h(N),fe=a(N,"P",{});var ko=r(fe);gt=c(ko,`Instantiating a feature extractor with the defaults will yield a similar configuration to that of the
`),ge=a(ko,"A",{href:!0,rel:!0});var wn=r(ge);_t=c(wn,"facebook/encodec_24khz"),wn.forEach(t),bt=c(ko," architecture."),ko.forEach(t),vt=h(N),Q=a(N,"DIV",{class:!0});var Mo=r(Q);y(_e.$$.fragment,Mo),yt=h(Mo),He=a(Mo,"P",{});var En=r(He);wt=c(En,"Main method to featurize and prepare for the model one or several sequence(s)."),En.forEach(t),Mo.forEach(t),N.forEach(t),fo=h(o),q=a(o,"H2",{class:!0});var To=r(q);D=a(To,"A",{id:!0,class:!0,href:!0});var kn=r(D);Qe=a(kn,"SPAN",{});var Mn=r(Qe);y(be.$$.fragment,Mn),Mn.forEach(t),kn.forEach(t),Et=h(To),De=a(To,"SPAN",{});var Tn=r(De);kt=c(Tn,"EncodecModel"),Tn.forEach(t),To.forEach(t),go=h(o),T=a(o,"DIV",{class:!0});var W=r(T);y(ve.$$.fragment,W),Mt=h(W),ye=a(W,"P",{});var $o=r(ye);Tt=c($o,`The EnCodec neural audio codec model.
This model inherits from `),Ne=a($o,"A",{href:!0});var $n=r(Ne);$t=c($n,"PreTrainedModel"),$n.forEach(t),jt=c($o,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),$o.forEach(t),xt=h(W),we=a(W,"P",{});var jo=r(we);Jt=c(jo,"This model is also a PyTorch "),Ee=a(jo,"A",{href:!0,rel:!0});var jn=r(Ee);zt=c(jn,"torch.nn.Module"),jn.forEach(t),Wt=c(jo,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jo.forEach(t),Ct=h(W),C=a(W,"DIV",{class:!0});var Re=r(C);y(ke.$$.fragment,Re),Ut=h(Re),Le=a(Re,"P",{});var xn=r(Le);Nt=c(xn,"Decodes the given frames into an output audio waveform."),xn.forEach(t),Zt=h(Re),Oe=a(Re,"P",{});var Jn=r(Oe);It=c(Jn,`Note that the output might be a bit bigger than the input. In that case, any extra steps at the end can be
trimmed.`),Jn.forEach(t),Re.forEach(t),Ft=h(W),L=a(W,"DIV",{class:!0});var xo=r(L);y(Me.$$.fragment,xo),Rt=h(xo),Ke=a(xo,"P",{});var zn=r(Ke);Vt=c(zn,"Encodes the input audio waveform into discrete codes."),zn.forEach(t),xo.forEach(t),qt=h(W),z=a(W,"DIV",{class:!0});var oe=r(z);y(Te.$$.fragment,oe),Bt=h(oe),B=a(oe,"P",{});var Ve=r(B);Gt=c(Ve,"The "),Ze=a(Ve,"A",{href:!0});var Wn=r(Ze);Xt=c(Wn,"EncodecModel"),Wn.forEach(t),Pt=c(Ve," forward method, overrides the "),eo=a(Ve,"CODE",{});var Cn=r(eo);At=c(Cn,"__call__"),Cn.forEach(t),Yt=c(Ve," special method."),Ve.forEach(t),St=h(oe),y(O.$$.fragment,oe),Ht=h(oe),y(K.$$.fragment,oe),oe.forEach(t),W.forEach(t),this.h()},h(){i(p,"name","hf:doc:metadata"),i(p,"content",JSON.stringify(An)),i(f,"id","encodec"),i(f,"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(f,"href","#encodec"),i(g,"class","relative group"),i(P,"id","overview"),i(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(P,"href","#overview"),i(Z,"class","relative group"),i(ne,"href","https://arxiv.org/abs/2210.13438"),i(ne,"rel","nofollow"),i(ae,"href","https://huggingface.co/Matthijs"),i(ae,"rel","nofollow"),i(re,"href","https://huggingface.co/patrickvonplaten"),i(re,"rel","nofollow"),i(se,"href","https://huggingface.co/ArthurZ"),i(se,"rel","nofollow"),i(ce,"href","https://github.com/facebookresearch/encodec"),i(ce,"rel","nofollow"),i(Y,"id","transformers.EncodecConfig"),i(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(Y,"href","#transformers.EncodecConfig"),i(I,"class","relative group"),i(ze,"href","/docs/transformers/v4.32.0/en/model_doc/encodec#transformers.EncodecModel"),i(he,"href","https://huggingface.co/facebook/encodec_24khz"),i(he,"rel","nofollow"),i(We,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(Ce,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),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(H,"id","transformers.EncodecFeatureExtractor"),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","#transformers.EncodecFeatureExtractor"),i(V,"class","relative group"),i(Ue,"href","/docs/transformers/v4.32.0/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),i(ge,"href","https://huggingface.co/facebook/encodec_24khz"),i(ge,"rel","nofollow"),i(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(D,"id","transformers.EncodecModel"),i(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(D,"href","#transformers.EncodecModel"),i(q,"class","relative group"),i(Ne,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),i(Ee,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(Ee,"rel","nofollow"),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"),i(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ze,"href","/docs/transformers/v4.32.0/en/model_doc/encodec#transformers.EncodecModel"),i(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,m){e(document.head,p),u(o,$,m),u(o,g,m),e(g,f),e(f,b),w(d,b,null),e(g,_),e(g,X),e(X,Jo),u(o,ao,m),u(o,Z,m),e(Z,P),e(P,qe),w(te,qe,null),e(Z,zo),e(Z,Be),e(Be,Wo),u(o,ro,m),u(o,A,m),e(A,Co),e(A,ne),e(ne,Uo),e(A,No),u(o,so,m),u(o,xe,m),e(xe,Zo),u(o,co,m),u(o,Je,m),e(Je,Ge),e(Ge,Io),u(o,io,m),u(o,x,m),e(x,Fo),e(x,ae),e(ae,Ro),e(x,Vo),e(x,re),e(re,qo),e(x,Bo),e(x,se),e(se,Go),e(x,Xo),e(x,ce),e(ce,Po),e(x,Ao),u(o,lo,m),w(ie,o,m),u(o,ho,m),u(o,I,m),e(I,Y),e(Y,Xe),w(de,Xe,null),e(I,Yo),e(I,Pe),e(Pe,So),u(o,mo,m),u(o,J,m),w(le,J,null),e(J,Ho),e(J,F),e(F,Qo),e(F,ze),e(ze,Do),e(F,Lo),e(F,he),e(he,Oo),e(F,Ko),e(J,et),e(J,R),e(R,ot),e(R,We),e(We,tt),e(R,nt),e(R,Ce),e(Ce,at),e(R,rt),e(J,st),w(S,J,null),u(o,po,m),u(o,V,m),e(V,H),e(H,Ae),w(me,Ae,null),e(V,ct),e(V,Ye),e(Ye,it),u(o,uo,m),u(o,j,m),w(pe,j,null),e(j,dt),e(j,Se),e(Se,lt),e(j,ht),e(j,ue),e(ue,mt),e(ue,Ue),e(Ue,pt),e(ue,ut),e(j,ft),e(j,fe),e(fe,gt),e(fe,ge),e(ge,_t),e(fe,bt),e(j,vt),e(j,Q),w(_e,Q,null),e(Q,yt),e(Q,He),e(He,wt),u(o,fo,m),u(o,q,m),e(q,D),e(D,Qe),w(be,Qe,null),e(q,Et),e(q,De),e(De,kt),u(o,go,m),u(o,T,m),w(ve,T,null),e(T,Mt),e(T,ye),e(ye,Tt),e(ye,Ne),e(Ne,$t),e(ye,jt),e(T,xt),e(T,we),e(we,Jt),e(we,Ee),e(Ee,zt),e(we,Wt),e(T,Ct),e(T,C),w(ke,C,null),e(C,Ut),e(C,Le),e(Le,Nt),e(C,Zt),e(C,Oe),e(Oe,It),e(T,Ft),e(T,L),w(Me,L,null),e(L,Rt),e(L,Ke),e(Ke,Vt),e(T,qt),e(T,z),w(Te,z,null),e(z,Bt),e(z,B),e(B,Gt),e(B,Ze),e(Ze,Xt),e(B,Pt),e(B,eo),e(eo,At),e(B,Yt),e(z,St),w(O,z,null),e(z,Ht),w(K,z,null),_o=!0},p(o,[m]){const $e={};m&2&&($e.$$scope={dirty:m,ctx:o}),S.$set($e);const oo={};m&2&&(oo.$$scope={dirty:m,ctx:o}),O.$set(oo);const to={};m&2&&(to.$$scope={dirty:m,ctx:o}),K.$set(to)},i(o){_o||(E(d.$$.fragment,o),E(te.$$.fragment,o),E(ie.$$.fragment,o),E(de.$$.fragment,o),E(le.$$.fragment,o),E(S.$$.fragment,o),E(me.$$.fragment,o),E(pe.$$.fragment,o),E(_e.$$.fragment,o),E(be.$$.fragment,o),E(ve.$$.fragment,o),E(ke.$$.fragment,o),E(Me.$$.fragment,o),E(Te.$$.fragment,o),E(O.$$.fragment,o),E(K.$$.fragment,o),_o=!0)},o(o){k(d.$$.fragment,o),k(te.$$.fragment,o),k(ie.$$.fragment,o),k(de.$$.fragment,o),k(le.$$.fragment,o),k(S.$$.fragment,o),k(me.$$.fragment,o),k(pe.$$.fragment,o),k(_e.$$.fragment,o),k(be.$$.fragment,o),k(ve.$$.fragment,o),k(ke.$$.fragment,o),k(Me.$$.fragment,o),k(Te.$$.fragment,o),k(O.$$.fragment,o),k(K.$$.fragment,o),_o=!1},d(o){t(p),o&&t($),o&&t(g),M(d),o&&t(ao),o&&t(Z),M(te),o&&t(ro),o&&t(A),o&&t(so),o&&t(xe),o&&t(co),o&&t(Je),o&&t(io),o&&t(x),o&&t(lo),M(ie,o),o&&t(ho),o&&t(I),M(de),o&&t(mo),o&&t(J),M(le),M(S),o&&t(po),o&&t(V),M(me),o&&t(uo),o&&t(j),M(pe),M(_e),o&&t(fo),o&&t(q),M(be),o&&t(go),o&&t(T),M(ve),M(ke),M(Me),M(Te),M(O),M(K)}}}const An={local:"encodec",sections:[{local:"overview",title:"Overview"},{local:"transformers.EncodecConfig",title:"EncodecConfig"},{local:"transformers.EncodecFeatureExtractor",title:"EncodecFeatureExtractor"},{local:"transformers.EncodecModel",title:"EncodecModel"}],title:"EnCodec"};function Yn(G){return Vn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kn extends Zn{constructor(p){super();In(this,p,Yn,Pn,Fn,{})}}export{Kn as default,An as metadata};
