import{s as tt,o as st,n as pn}from"../chunks/scheduler.25b97de1.js";import{S as ot,i as at,g as d,s,r as u,A as lt,h as c,f as t,c as o,j as k,u as m,x as w,k as B,y as i,a,v as M,d as h,t as y,w as J}from"../chunks/index.d9030fc9.js";import{T as rt}from"../chunks/Tip.baa67368.js";import{D as Te}from"../chunks/Docstring.ffac8efa.js";import{C as ke}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Zn}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as Z,E as it}from"../chunks/EditOnGithub.91d95064.js";function dt(W){let r,j="Example:",T,p,f;return p=new ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yQXVkaW9Gb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBRd2VuMkF1ZGlvQ29uZmlnJTJDJTIwUXdlbjJBdWRpb0VuY29kZXJDb25maWclMkMlMjBRd2VuMkNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBRd2VuMkF1ZGlvRW5jb2RlciUyMGNvbmZpZyUwQWF1ZGlvX2NvbmZpZyUyMCUzRCUyMFF3ZW4yQXVkaW9FbmNvZGVyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUXdlbjIlMjBjb25maWclMEF0ZXh0X2NvbmZpZyUyMCUzRCUyMFF3ZW4yQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUXdlbjJBdWRpbyUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUXdlbjJBdWRpb0NvbmZpZyhhdWRpb19jb25maWclMkMlMjB0ZXh0X2NvbmZpZyklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwcXdlbjItYXVkaW8lMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFF3ZW4yQXVkaW9Gb3JDb25kaXRpb25hbEdlbmVyYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2AudioForConditionalGeneration, Qwen2AudioConfig, Qwen2AudioEncoderConfig, Qwen2Config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2AudioEncoder config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_config = Qwen2AudioEncoderConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2 config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text_config = Qwen2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2Audio configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Qwen2AudioConfig(audio_config, text_config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the qwen2-audio style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2AudioForConditionalGeneration(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){r=d("p"),r.textContent=j,T=s(),u(p.$$.fragment)},l(l){r=c(l,"P",{"data-svelte-h":!0}),w(r)!=="svelte-11lpom8"&&(r.textContent=j),T=o(l),m(p.$$.fragment,l)},m(l,g){a(l,r,g),a(l,T,g),M(p,l,g),f=!0},p:pn,i(l){f||(h(p.$$.fragment,l),f=!0)},o(l){y(p.$$.fragment,l),f=!1},d(l){l&&(t(r),t(T)),J(p,l)}}}function ct(W){let r,j="Example:",T,p,f;return p=new ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yQXVkaW9FbmNvZGVyQ29uZmlnJTJDJTIwUXdlbjJBdWRpb0VuY29kZXIlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUXdlbjJBdWRpb0VuY29kZXJDb25maWclMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUXdlbjJBdWRpb0VuY29kZXJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBRd2VuMkF1ZGlvRW5jb2RlciUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMEFtb2RlbCUyMCUzRCUyMFF3ZW4yQXVkaW9FbmNvZGVyKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2AudioEncoderConfig, Qwen2AudioEncoder

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2AudioEncoderConfig</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Qwen2AudioEncoderConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2AudioEncoder (with random weights)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2AudioEncoder(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){r=d("p"),r.textContent=j,T=s(),u(p.$$.fragment)},l(l){r=c(l,"P",{"data-svelte-h":!0}),w(r)!=="svelte-11lpom8"&&(r.textContent=j),T=o(l),m(p.$$.fragment,l)},m(l,g){a(l,r,g),a(l,T,g),M(p,l,g),f=!0},p:pn,i(l){f||(h(p.$$.fragment,l),f=!0)},o(l){y(p.$$.fragment,l),f=!1},d(l){l&&(t(r),t(T)),J(p,l)}}}function pt(W){let r,j=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=d("p"),r.innerHTML=j},l(T){r=c(T,"P",{"data-svelte-h":!0}),w(r)!=="svelte-fincs2"&&(r.innerHTML=j)},m(T,p){a(T,r,p)},p:pn,d(T){T&&t(r)}}}function ut(W){let r,j="Example:",T,p,f;return p=new ke({props:{code:"ZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjB1cmxsaWIucmVxdWVzdCUyMGltcG9ydCUyMHVybG9wZW4lMEFpbXBvcnQlMjBsaWJyb3NhJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBRd2VuMkF1ZGlvRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBRd2VuMkF1ZGlvRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItQXVkaW8tN0IlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLUF1ZGlvLTdCJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMiUzQyU3Q2F1ZGlvX2JvcyU3QyUzRSUzQyU3Q0FVRElPJTdDJTNFJTNDJTdDYXVkaW9fZW9zJTdDJTNFR2VuZXJhdGUlMjB0aGUlMjBjYXB0aW9uJTIwaW4lMjBFbmdsaXNoJTNBJTIyJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZxaWFud2VuLXJlcy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZRd2VuMi1BdWRpbyUyRmF1ZGlvJTJGZ2xhc3MtYnJlYWtpbmctMTUxMjU2Lm1wMyUyMiUwQWF1ZGlvJTJDJTIwXyUyMCUzRCUyMGxpYnJvc2EubG9hZChCeXRlc0lPKHVybG9wZW4odXJsKS5yZWFkKCkpJTJDJTIwc3IlM0RzZWxmLnByb2Nlc3Nvci5mZWF0dXJlX2V4dHJhY3Rvci5zYW1wbGluZ19yYXRlKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEcHJvbXB0JTJDJTIwYXVkaW9zJTNEYXVkaW8lMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNEMzApJTBBcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> librosa
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Qwen2AudioForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2AudioForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;&lt;|audio_bos|&gt;&lt;|AUDIO|&gt;&lt;|audio_eos|&gt;Generate the caption in English:&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/glass-breaking-151256.mp3&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio, _ = librosa.load(BytesIO(urlopen(url).read()), sr=self.processor.feature_extractor.sampling_rate)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=prompt, audios=audio, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(**inputs, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;Generate the caption in English: Glass is breaking.&quot;</span>`,wrap:!1}}),{c(){r=d("p"),r.textContent=j,T=s(),u(p.$$.fragment)},l(l){r=c(l,"P",{"data-svelte-h":!0}),w(r)!=="svelte-11lpom8"&&(r.textContent=j),T=o(l),m(p.$$.fragment,l)},m(l,g){a(l,r,g),a(l,T,g),M(p,l,g),f=!0},p:pn,i(l){f||(h(p.$$.fragment,l),f=!0)},o(l){y(p.$$.fragment,l),f=!1},d(l){l&&(t(r),t(T)),J(p,l)}}}function mt(W){let r,j,T,p,f,l,g,qe,x,kn="The Qwen2-Audio is the new model series of large audio-language models from the Qwen team. Qwen2-Audio is capable of accepting various audio signal inputs and performing audio analysis or direct textual responses with regard to speech instructions. We introduce two distinct audio interaction modes:",Ge,E,Bn="<li>voice chat: users can freely engage in voice interactions with Qwen2-Audio without text input</li> <li>audio analysis: users could provide audio and text instructions for analysis during the interaction</li>",Xe,$,qn='It was proposed in <a href="https://arxiv.org/abs/2407.10759" rel="nofollow">Qwen2-Audio Technical Report</a> by Yunfei Chu, Jin Xu, Qian Yang, Haojie Wei, Xipin Wei, Zhifang Guo, Yichong Leng, Yuanjun Lv, Jinzheng He, Junyang Lin, Chang Zhou, Jingren Zhou.',Re,Y,Gn="The abstract from the paper is the following:",Ve,H,Xn="<em>We introduce the latest progress of Qwen-Audio, a large-scale audio-language model called Qwen2-Audio, which is capable of accepting various audio signal inputs and performing audio analysis or direct textual responses with regard to speech instructions. In contrast to complex hierarchical tags, we have simplified the pre-training process by utilizing natural language prompts for different data and tasks, and have further expanded the data volume. We have boosted the instruction-following capability of Qwen2-Audio and implemented two distinct audio interaction modes for voice chat and audio analysis. In the voice chat mode, users can freely engage in voice interactions with Qwen2-Audio without text input. In the audio analysis mode, users could provide audio and text instructions for analysis during the interaction. Note that we do not use any system prompts to switch between voice chat and audio analysis modes. Qwen2-Audio is capable of intelligently comprehending the content within audio and following voice commands to respond appropriately. For instance, in an audio segment that simultaneously contains sounds, multi-speaker conversations, and a voice command, Qwen2-Audio can directly understand the command and provide an interpretation and response to the audio. Additionally, DPO has optimized the model’s performance in terms of factuality and adherence to desired behavior. According to the evaluation results from AIR-Bench, Qwen2-Audio outperformed previous SOTAs, such as Gemini-1.5-pro, in tests focused on audio-centric instruction-following capabilities. Qwen2-Audio is open-sourced with the aim of fostering the advancement of the multi-modal language community.</em>",Ne,S,Fe,L,Rn='<code>Qwen2-Audio-7B</code> and <code>Qwen2-Audio-7B-Instruct</code> can be found on the <a href="https://huggingface.co/Qwen" rel="nofollow">Huggingface Hub</a>',ze,P,Vn="In the following, we demonstrate how to use <code>Qwen2-Audio-7B-Instruct</code> for the inference, supporting both voice chat and audio analysis modes. Note that we have used the ChatML format for dialog, in this demo we show how to leverage <code>apply_chat_template</code> for this purpose.",xe,D,Ee,K,Nn="In the voice chat mode, users can freely engage in voice interactions with Qwen2-Audio without text input:",$e,O,Ye,ee,He,ne,Fn="In the audio analysis, users could provide both audio and text instructions for analysis:",Se,te,Le,se,Pe,oe,zn="We also support batch inference:",De,ae,Ke,le,Oe,U,re,un,fe,xn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioForConditionalGeneration">Qwen2AudioForConditionalGeneration</a>. It is used to instantiate an
Qwen2-Audio 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 Qwen2-Audio.`,mn,ge,En='e.g. <a href="https://huggingface.co/Qwen/Qwen2-Audio-7B" rel="nofollow">Qwen/Qwen2-Audio-7B</a>',Mn,je,$n=`Configuration objects inherit from <a href="/docs/transformers/pr_30950/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30950/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,hn,q,en,ie,nn,I,de,yn,Ue,Yn=`This is the configuration class to store the configuration of a <code>Qwen2AudioEncoder</code>. It is used to instantiate a
Qwen2-Audio audio encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the audio encoder of the Qwen2-Audio
architecture.`,Jn,Ie,Hn='e.g. <a href="https://huggingface.co/Qwen/Qwen2-Audio-7B" rel="nofollow">Qwen/Qwen2-Audio-7B</a>',wn,be,Sn=`Configuration objects inherit from <a href="/docs/transformers/pr_30950/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30950/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Tn,G,tn,ce,sn,b,pe,fn,_e,Ln="Constructs a Qwen2Audio processor which wraps a Qwen2Audio feature extractor and a Qwen2Audio tokenizer into a single processor.",gn,Ce,Pn=`<a href="/docs/transformers/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioProcessor">Qwen2AudioProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_30950/en/model_doc/whisper#transformers.WhisperFeatureExtractor">WhisperFeatureExtractor</a> and <a href="/docs/transformers/pr_30950/en/model_doc/qwen2#transformers.Qwen2TokenizerFast">Qwen2TokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioProcessor.decode">decode()</a> for more information.`,jn,X,ue,Un,ve,Dn=`This method forwards all its arguments to Qwen2TokenizerFast’s <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,In,R,me,bn,Qe,Kn=`This method forwards all its arguments to Qwen2TokenizerFast’s <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,on,Me,an,_,he,_n,Ae,On=`The QWEN2AUDIO model which consists of a audio backbone and a language model.
This model inherits from <a href="/docs/transformers/pr_30950/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Cn,We,et=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,vn,A,ye,Qn,Ze,nt='The <a href="/docs/transformers/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioForConditionalGeneration">Qwen2AudioForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',An,V,Wn,N,ln,Je,rn,Be,dn;return f=new Z({props:{title:"Qwen2Audio",local:"qwen2audio",headingTag:"h1"}}),g=new Z({props:{title:"Overview",local:"overview",headingTag:"h2"}}),S=new Z({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),D=new Z({props:{title:"Voice Chat Inference",local:"voice-chat-inference",headingTag:"h3"}}),O=new ke({props:{code:"ZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjB1cmxsaWIucmVxdWVzdCUyMGltcG9ydCUyMHVybG9wZW4lMEFpbXBvcnQlMjBsaWJyb3NhJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yQXVkaW9Gb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBBdXRvUHJvY2Vzc29yJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLUF1ZGlvLTdCLUluc3RydWN0JTIyKSUwQW1vZGVsJTIwJTNEJTIwUXdlbjJBdWRpb0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLUF1ZGlvLTdCLUluc3RydWN0JTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBJTBBY29udmVyc2F0aW9uJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmF1ZGlvJTIyJTJDJTIwJTIyYXVkaW9fdXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZxaWFud2VuLXJlcy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZRd2VuMi1BdWRpbyUyRmF1ZGlvJTJGZ3Vlc3NfYWdlX2dlbmRlci53YXYlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlNUQlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyYXNzaXN0YW50JTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlllcyUyQyUyMHRoZSUyMHNwZWFrZXIlMjBpcyUyMGZlbWFsZSUyMGFuZCUyMGluJTIwaGVyJTIwdHdlbnRpZXMuJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmF1ZGlvJTIyJTJDJTIwJTIyYXVkaW9fdXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZxaWFud2VuLXJlcy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZRd2VuMi1BdWRpbyUyRmF1ZGlvJTJGdHJhbnNsYXRlX3RvX2NoaW5lc2Uud2F2JTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTdEJTJDJTBBJTVEJTBBdGV4dCUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKGNvbnZlcnNhdGlvbiUyQyUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMjB0b2tlbml6ZSUzREZhbHNlKSUwQWF1ZGlvcyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMG1lc3NhZ2UlMjBpbiUyMGNvbnZlcnNhdGlvbiUzQSUwQSUyMCUyMCUyMCUyMGlmJTIwaXNpbnN0YW5jZShtZXNzYWdlJTVCJTIyY29udGVudCUyMiU1RCUyQyUyMGxpc3QpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwZWxlJTIwaW4lMjBtZXNzYWdlJTVCJTIyY29udGVudCUyMiU1RCUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwZWxlJTVCJTIydHlwZSUyMiU1RCUyMCUzRCUzRCUyMCUyMmF1ZGlvJTIyJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXVkaW9zLmFwcGVuZChsaWJyb3NhLmxvYWQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwQnl0ZXNJTyh1cmxvcGVuKGVsZSU1QidhdWRpb191cmwnJTVEKS5yZWFkKCkpJTJDJTIwJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc3IlM0Rwcm9jZXNzb3IuZmVhdHVyZV9leHRyYWN0b3Iuc2FtcGxpbmdfcmF0ZSklNUIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEdGV4dCUyQyUyMGF1ZGlvcyUzRGF1ZGlvcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcy50byglMjJjdWRhJTIyKSUwQSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDI1NiklMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBnZW5lcmF0ZV9pZHMlNUIlM0ElMkMlMjBpbnB1dHMuaW5wdXRfaWRzLnNpemUoMSklM0ElNUQlMEElMEFyZXNwb25zZSUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-keyword">import</span> librosa
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2AudioForConditionalGeneration, AutoProcessor

processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>)
model = Qwen2AudioForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)

conversation = [
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/guess_age_gender.wav&quot;</span>},
    ]},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Yes, the speaker is female and in her twenties.&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/translate_to_chinese.wav&quot;</span>},
    ]},
]
text = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>, tokenize=<span class="hljs-literal">False</span>)
audios = []
<span class="hljs-keyword">for</span> message <span class="hljs-keyword">in</span> conversation:
    <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(message[<span class="hljs-string">&quot;content&quot;</span>], <span class="hljs-built_in">list</span>):
        <span class="hljs-keyword">for</span> ele <span class="hljs-keyword">in</span> message[<span class="hljs-string">&quot;content&quot;</span>]:
            <span class="hljs-keyword">if</span> ele[<span class="hljs-string">&quot;type&quot;</span>] == <span class="hljs-string">&quot;audio&quot;</span>:
                audios.append(librosa.load(
                    BytesIO(urlopen(ele[<span class="hljs-string">&#x27;audio_url&#x27;</span>]).read()), 
                    sr=processor.feature_extractor.sampling_rate)[<span class="hljs-number">0</span>]
                )

inputs = processor(text=text, audios=audios, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
inputs.input_ids = inputs.input_ids.to(<span class="hljs-string">&quot;cuda&quot;</span>)

generate_ids = model.generate(**inputs, max_length=<span class="hljs-number">256</span>)
generate_ids = generate_ids[:, inputs.input_ids.size(<span class="hljs-number">1</span>):]

response = processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),ee=new Z({props:{title:"Audio Analysis Inference",local:"audio-analysis-inference",headingTag:"h3"}}),te=new ke({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-keyword">import</span> librosa
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2AudioForConditionalGeneration, AutoProcessor

processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>)
model = Qwen2AudioForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)

conversation = [
    {<span class="hljs-string">&#x27;role&#x27;</span>: <span class="hljs-string">&#x27;system&#x27;</span>, <span class="hljs-string">&#x27;content&#x27;</span>: <span class="hljs-string">&#x27;You are a helpful assistant.&#x27;</span>}, 
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/glass-breaking-151256.mp3&quot;</span>},
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What&#x27;s that sound?&quot;</span>},
    ]},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;It is the sound of glass shattering.&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What can you do when you hear that?&quot;</span>},
    ]},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Stay alert and cautious, and check if anyone is hurt or if there is any damage to property.&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/1272-128104-0000.flac&quot;</span>},
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What does the person say?&quot;</span>},
    ]},
]
text = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>, tokenize=<span class="hljs-literal">False</span>)
audios = []
<span class="hljs-keyword">for</span> message <span class="hljs-keyword">in</span> conversation:
    <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(message[<span class="hljs-string">&quot;content&quot;</span>], <span class="hljs-built_in">list</span>):
        <span class="hljs-keyword">for</span> ele <span class="hljs-keyword">in</span> message[<span class="hljs-string">&quot;content&quot;</span>]:
            <span class="hljs-keyword">if</span> ele[<span class="hljs-string">&quot;type&quot;</span>] == <span class="hljs-string">&quot;audio&quot;</span>:
                audios.append(
                    librosa.load(
                        BytesIO(urlopen(ele[<span class="hljs-string">&#x27;audio_url&#x27;</span>]).read()), 
                        sr=processor.feature_extractor.sampling_rate)[<span class="hljs-number">0</span>]
                )

inputs = processor(text=text, audios=audios, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
inputs.input_ids = inputs.input_ids.to(<span class="hljs-string">&quot;cuda&quot;</span>)

generate_ids = model.generate(**inputs, max_length=<span class="hljs-number">256</span>)
generate_ids = generate_ids[:, inputs.input_ids.size(<span class="hljs-number">1</span>):]

response = processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),se=new Z({props:{title:"Batch Inference",local:"batch-inference",headingTag:"h3"}}),ae=new ke({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-keyword">import</span> librosa
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2AudioForConditionalGeneration, AutoProcessor

processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>)
model = Qwen2AudioForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B-Instruct&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)

conversation1 = [
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/glass-breaking-151256.mp3&quot;</span>},
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What&#x27;s that sound?&quot;</span>},
    ]},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;It is the sound of glass shattering.&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/f2641_0_throatclearing.wav&quot;</span>},
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What can you hear?&quot;</span>},
    ]}
]

conversation2 = [
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;audio_url&quot;</span>: <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/1272-128104-0000.flac&quot;</span>},
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What does the person say?&quot;</span>},
    ]},
]

conversations = [conversation1, conversation2]

text = [processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>, tokenize=<span class="hljs-literal">False</span>) <span class="hljs-keyword">for</span> conversation <span class="hljs-keyword">in</span> conversations]

audios = []
<span class="hljs-keyword">for</span> conversation <span class="hljs-keyword">in</span> conversations:
    <span class="hljs-keyword">for</span> message <span class="hljs-keyword">in</span> conversation:
        <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(message[<span class="hljs-string">&quot;content&quot;</span>], <span class="hljs-built_in">list</span>):
            <span class="hljs-keyword">for</span> ele <span class="hljs-keyword">in</span> message[<span class="hljs-string">&quot;content&quot;</span>]:
                <span class="hljs-keyword">if</span> ele[<span class="hljs-string">&quot;type&quot;</span>] == <span class="hljs-string">&quot;audio&quot;</span>:
                    audios.append(
                        librosa.load(
                            BytesIO(urlopen(ele[<span class="hljs-string">&#x27;audio_url&#x27;</span>]).read()), 
                            sr=processor.feature_extractor.sampling_rate)[<span class="hljs-number">0</span>]
                    )

inputs = processor(text=text, audios=audios, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
inputs[<span class="hljs-string">&#x27;input_ids&#x27;</span>] = inputs[<span class="hljs-string">&#x27;input_ids&#x27;</span>].to(<span class="hljs-string">&quot;cuda&quot;</span>)
inputs.input_ids = inputs.input_ids.to(<span class="hljs-string">&quot;cuda&quot;</span>)

generate_ids = model.generate(**inputs, max_length=<span class="hljs-number">256</span>)
generate_ids = generate_ids[:, inputs.input_ids.size(<span class="hljs-number">1</span>):]

response = processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)`,wrap:!1}}),le=new Z({props:{title:"Qwen2AudioConfig",local:"transformers.Qwen2AudioConfig",headingTag:"h2"}}),re=new Te({props:{name:"class transformers.Qwen2AudioConfig",anchor:"transformers.Qwen2AudioConfig",parameters:[{name:"audio_config",val:" = None"},{name:"text_config",val:" = None"},{name:"audio_token_index",val:" = 151646"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2AudioConfig.audio_config",description:`<strong>audio_config</strong> (<code>Union[AutoConfig, dict]</code>,  <em>optional</em>, defaults to <code>CLIPVisionConfig</code>) &#x2014;
The config object or dictionary of the audio backbone.`,name:"audio_config"},{anchor:"transformers.Qwen2AudioConfig.text_config",description:`<strong>text_config</strong> (<code>Union[AutoConfig, dict]</code>, <em>optional</em>, defaults to <code>LlamaConfig</code>) &#x2014;
The config object or dictionary of the text backbone.`,name:"text_config"},{anchor:"transformers.Qwen2AudioConfig.audio_token_index",description:`<strong>audio_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 151646) &#x2014;
The image token index to encode the image prompt.`,name:"audio_token_index"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py#L119"}}),q=new Zn({props:{anchor:"transformers.Qwen2AudioConfig.example",$$slots:{default:[dt]},$$scope:{ctx:W}}}),ie=new Z({props:{title:"Qwen2AudioConfig",local:"transformers.Qwen2AudioEncoderConfig",headingTag:"h2"}}),de=new Te({props:{name:"class transformers.Qwen2AudioEncoderConfig",anchor:"transformers.Qwen2AudioEncoderConfig",parameters:[{name:"num_mel_bins",val:" = 128"},{name:"encoder_layers",val:" = 32"},{name:"encoder_attention_heads",val:" = 20"},{name:"encoder_ffn_dim",val:" = 5120"},{name:"encoder_layerdrop",val:" = 0.0"},{name:"d_model",val:" = 1280"},{name:"dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"activation_function",val:" = 'gelu'"},{name:"activation_dropout",val:" = 0.0"},{name:"scale_embedding",val:" = False"},{name:"init_std",val:" = 0.02"},{name:"max_source_positions",val:" = 1500"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2AudioEncoderConfig.num_mel_bins",description:`<strong>num_mel_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of mel features used per input features. Should correspond to the value used in the
<code>Qwen2AudioProcessor</code> class.`,name:"num_mel_bins"},{anchor:"transformers.Qwen2AudioEncoderConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of encoder layers.`,name:"encoder_layers"},{anchor:"transformers.Qwen2AudioEncoderConfig.encoder_attention_heads",description:`<strong>encoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 20) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"encoder_attention_heads"},{anchor:"transformers.Qwen2AudioEncoderConfig.encoder_ffn_dim",description:`<strong>encoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 5120) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in encoder.`,name:"encoder_ffn_dim"},{anchor:"transformers.Qwen2AudioEncoderConfig.encoder_layerdrop",description:`<strong>encoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the encoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"encoder_layerdrop"},{anchor:"transformers.Qwen2AudioEncoderConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 1280) &#x2014;
Dimensionality of the layers.`,name:"d_model"},{anchor:"transformers.Qwen2AudioEncoderConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.Qwen2AudioEncoderConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Qwen2AudioEncoderConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</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;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.Qwen2AudioEncoderConfig.activation_dropout",description:`<strong>activation_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for activations inside the fully connected layer.`,name:"activation_dropout"},{anchor:"transformers.Qwen2AudioEncoderConfig.scale_embedding",description:`<strong>scale_embedding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Scale embeddings by diving by sqrt(d_model).`,name:"scale_embedding"},{anchor:"transformers.Qwen2AudioEncoderConfig.init_std",description:`<strong>init_std</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:"init_std"},{anchor:"transformers.Qwen2AudioEncoderConfig.max_source_positions",description:`<strong>max_source_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 1500) &#x2014;
The maximum sequence length of log-mel filter-bank features that this model might ever be used with.`,name:"max_source_positions"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py#L24"}}),G=new Zn({props:{anchor:"transformers.Qwen2AudioEncoderConfig.example",$$slots:{default:[ct]},$$scope:{ctx:W}}}),ce=new Z({props:{title:"Qwen2AudioProcessor",local:"transformers.Qwen2AudioProcessor",headingTag:"h2"}}),pe=new Te({props:{name:"class transformers.Qwen2AudioProcessor",anchor:"transformers.Qwen2AudioProcessor",parameters:[{name:"feature_extractor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"chat_template",val:" = None"}],parametersDescription:[{anchor:"transformers.Qwen2AudioProcessor.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/whisper#transformers.WhisperFeatureExtractor">WhisperFeatureExtractor</a>, <em>optional</em>) &#x2014;
The feature extractor is a required input.`,name:"feature_extractor"},{anchor:"transformers.Qwen2AudioProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/qwen2#transformers.Qwen2TokenizerFast">Qwen2TokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.Qwen2AudioProcessor.chat_template",description:`<strong>chat_template</strong> (<code>Optional[str]</code>, <em>optional</em>) &#x2014;
The Jinja template to use for formatting the conversation. If not provided, the default chat template
is used.`,name:"chat_template"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L28"}}),ue=new Te({props:{name:"batch_decode",anchor:"transformers.Qwen2AudioProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L104"}}),me=new Te({props:{name:"decode",anchor:"transformers.Qwen2AudioProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L111"}}),Me=new Z({props:{title:"Qwen2AudioForConditionalGeneration",local:"transformers.Qwen2AudioForConditionalGeneration",headingTag:"h2"}}),he=new Te({props:{name:"class transformers.Qwen2AudioForConditionalGeneration",anchor:"transformers.Qwen2AudioForConditionalGeneration",parameters:[{name:"config",val:": Qwen2AudioConfig"}],parametersDescription:[{anchor:"transformers.Qwen2AudioForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioConfig">Qwen2AudioConfig</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/pr_30950/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/vr_30950/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L855"}}),ye=new Te({props:{name:"forward",anchor:"transformers.Qwen2AudioForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"input_features",val:": FloatTensor = None"},{name:"attention_mask",val:": Optional = None"},{name:"feature_attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.input_features",description:`<strong>input_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, feature_size, feature_sequence_length)</code>) &#x2014;
Float values mel features extracted from the raw speech waveform. Raw speech 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/pr_30950/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/pr_30950/en/model_doc/whisper#transformers.WhisperFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_features"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. 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>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</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:"attention_mask"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.feature_attention_mask",description:`<strong>feature_attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, feature_sequence_length)</code>) &#x2014;
Mask to avoid performing attention on padding feature indices. 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>`,name:"feature_attention_mask"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>. <a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.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.Qwen2AudioForConditionalGeneration.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.Qwen2AudioForConditionalGeneration.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/pr_30950/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L1116",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioCausalLMOutputWithPast</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/pr_30950/en/model_doc/qwen2_audio#transformers.Qwen2AudioConfig"
>Qwen2AudioConfig</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) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>attention_mask</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — Attentions mask, used to update attention mask and position_ids.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new rt({props:{$$slots:{default:[pt]},$$scope:{ctx:W}}}),N=new Zn({props:{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.example",$$slots:{default:[ut]},$$scope:{ctx:W}}}),Je=new it({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/qwen2_audio.md"}}),{c(){r=d("meta"),j=s(),T=d("p"),p=s(),u(f.$$.fragment),l=s(),u(g.$$.fragment),qe=s(),x=d("p"),x.textContent=kn,Ge=s(),E=d("ul"),E.innerHTML=Bn,Xe=s(),$=d("p"),$.innerHTML=qn,Re=s(),Y=d("p"),Y.textContent=Gn,Ve=s(),H=d("p"),H.innerHTML=Xn,Ne=s(),u(S.$$.fragment),Fe=s(),L=d("p"),L.innerHTML=Rn,ze=s(),P=d("p"),P.innerHTML=Vn,xe=s(),u(D.$$.fragment),Ee=s(),K=d("p"),K.textContent=Nn,$e=s(),u(O.$$.fragment),Ye=s(),u(ee.$$.fragment),He=s(),ne=d("p"),ne.textContent=Fn,Se=s(),u(te.$$.fragment),Le=s(),u(se.$$.fragment),Pe=s(),oe=d("p"),oe.textContent=zn,De=s(),u(ae.$$.fragment),Ke=s(),u(le.$$.fragment),Oe=s(),U=d("div"),u(re.$$.fragment),un=s(),fe=d("p"),fe.innerHTML=xn,mn=s(),ge=d("p"),ge.innerHTML=En,Mn=s(),je=d("p"),je.innerHTML=$n,hn=s(),u(q.$$.fragment),en=s(),u(ie.$$.fragment),nn=s(),I=d("div"),u(de.$$.fragment),yn=s(),Ue=d("p"),Ue.innerHTML=Yn,Jn=s(),Ie=d("p"),Ie.innerHTML=Hn,wn=s(),be=d("p"),be.innerHTML=Sn,Tn=s(),u(G.$$.fragment),tn=s(),u(ce.$$.fragment),sn=s(),b=d("div"),u(pe.$$.fragment),fn=s(),_e=d("p"),_e.textContent=Ln,gn=s(),Ce=d("p"),Ce.innerHTML=Pn,jn=s(),X=d("div"),u(ue.$$.fragment),Un=s(),ve=d("p"),ve.innerHTML=Dn,In=s(),R=d("div"),u(me.$$.fragment),bn=s(),Qe=d("p"),Qe.innerHTML=Kn,on=s(),u(Me.$$.fragment),an=s(),_=d("div"),u(he.$$.fragment),_n=s(),Ae=d("p"),Ae.innerHTML=On,Cn=s(),We=d("p"),We.innerHTML=et,vn=s(),A=d("div"),u(ye.$$.fragment),Qn=s(),Ze=d("p"),Ze.innerHTML=nt,An=s(),u(V.$$.fragment),Wn=s(),u(N.$$.fragment),ln=s(),u(Je.$$.fragment),rn=s(),Be=d("p"),this.h()},l(e){const n=lt("svelte-u9bgzb",document.head);r=c(n,"META",{name:!0,content:!0}),n.forEach(t),j=o(e),T=c(e,"P",{}),k(T).forEach(t),p=o(e),m(f.$$.fragment,e),l=o(e),m(g.$$.fragment,e),qe=o(e),x=c(e,"P",{"data-svelte-h":!0}),w(x)!=="svelte-1r54lck"&&(x.textContent=kn),Ge=o(e),E=c(e,"UL",{"data-svelte-h":!0}),w(E)!=="svelte-p799jx"&&(E.innerHTML=Bn),Xe=o(e),$=c(e,"P",{"data-svelte-h":!0}),w($)!=="svelte-1oamru0"&&($.innerHTML=qn),Re=o(e),Y=c(e,"P",{"data-svelte-h":!0}),w(Y)!=="svelte-vfdo9a"&&(Y.textContent=Gn),Ve=o(e),H=c(e,"P",{"data-svelte-h":!0}),w(H)!=="svelte-1453f3k"&&(H.innerHTML=Xn),Ne=o(e),m(S.$$.fragment,e),Fe=o(e),L=c(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-12upnh6"&&(L.innerHTML=Rn),ze=o(e),P=c(e,"P",{"data-svelte-h":!0}),w(P)!=="svelte-ubq47c"&&(P.innerHTML=Vn),xe=o(e),m(D.$$.fragment,e),Ee=o(e),K=c(e,"P",{"data-svelte-h":!0}),w(K)!=="svelte-hygfg8"&&(K.textContent=Nn),$e=o(e),m(O.$$.fragment,e),Ye=o(e),m(ee.$$.fragment,e),He=o(e),ne=c(e,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-i9t6g7"&&(ne.textContent=Fn),Se=o(e),m(te.$$.fragment,e),Le=o(e),m(se.$$.fragment,e),Pe=o(e),oe=c(e,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-1smugch"&&(oe.textContent=zn),De=o(e),m(ae.$$.fragment,e),Ke=o(e),m(le.$$.fragment,e),Oe=o(e),U=c(e,"DIV",{class:!0});var C=k(U);m(re.$$.fragment,C),un=o(C),fe=c(C,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-kz8ljy"&&(fe.innerHTML=xn),mn=o(C),ge=c(C,"P",{"data-svelte-h":!0}),w(ge)!=="svelte-v3fb75"&&(ge.innerHTML=En),Mn=o(C),je=c(C,"P",{"data-svelte-h":!0}),w(je)!=="svelte-o0v7bn"&&(je.innerHTML=$n),hn=o(C),m(q.$$.fragment,C),C.forEach(t),en=o(e),m(ie.$$.fragment,e),nn=o(e),I=c(e,"DIV",{class:!0});var v=k(I);m(de.$$.fragment,v),yn=o(v),Ue=c(v,"P",{"data-svelte-h":!0}),w(Ue)!=="svelte-1nvj6ji"&&(Ue.innerHTML=Yn),Jn=o(v),Ie=c(v,"P",{"data-svelte-h":!0}),w(Ie)!=="svelte-v3fb75"&&(Ie.innerHTML=Hn),wn=o(v),be=c(v,"P",{"data-svelte-h":!0}),w(be)!=="svelte-o0v7bn"&&(be.innerHTML=Sn),Tn=o(v),m(G.$$.fragment,v),v.forEach(t),tn=o(e),m(ce.$$.fragment,e),sn=o(e),b=c(e,"DIV",{class:!0});var Q=k(b);m(pe.$$.fragment,Q),fn=o(Q),_e=c(Q,"P",{"data-svelte-h":!0}),w(_e)!=="svelte-1i2lr9"&&(_e.textContent=Ln),gn=o(Q),Ce=c(Q,"P",{"data-svelte-h":!0}),w(Ce)!=="svelte-xjctv2"&&(Ce.innerHTML=Pn),jn=o(Q),X=c(Q,"DIV",{class:!0});var we=k(X);m(ue.$$.fragment,we),Un=o(we),ve=c(we,"P",{"data-svelte-h":!0}),w(ve)!=="svelte-2wafnv"&&(ve.innerHTML=Dn),we.forEach(t),In=o(Q),R=c(Q,"DIV",{class:!0});var cn=k(R);m(me.$$.fragment,cn),bn=o(cn),Qe=c(cn,"P",{"data-svelte-h":!0}),w(Qe)!=="svelte-bw8269"&&(Qe.innerHTML=Kn),cn.forEach(t),Q.forEach(t),on=o(e),m(Me.$$.fragment,e),an=o(e),_=c(e,"DIV",{class:!0});var F=k(_);m(he.$$.fragment,F),_n=o(F),Ae=c(F,"P",{"data-svelte-h":!0}),w(Ae)!=="svelte-xqytrz"&&(Ae.innerHTML=On),Cn=o(F),We=c(F,"P",{"data-svelte-h":!0}),w(We)!=="svelte-hswkmf"&&(We.innerHTML=et),vn=o(F),A=c(F,"DIV",{class:!0});var z=k(A);m(ye.$$.fragment,z),Qn=o(z),Ze=c(z,"P",{"data-svelte-h":!0}),w(Ze)!=="svelte-1pzh9pc"&&(Ze.innerHTML=nt),An=o(z),m(V.$$.fragment,z),Wn=o(z),m(N.$$.fragment,z),z.forEach(t),F.forEach(t),ln=o(e),m(Je.$$.fragment,e),rn=o(e),Be=c(e,"P",{}),k(Be).forEach(t),this.h()},h(){B(r,"name","hf:doc:metadata"),B(r,"content",Mt),B(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(_,"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,n){i(document.head,r),a(e,j,n),a(e,T,n),a(e,p,n),M(f,e,n),a(e,l,n),M(g,e,n),a(e,qe,n),a(e,x,n),a(e,Ge,n),a(e,E,n),a(e,Xe,n),a(e,$,n),a(e,Re,n),a(e,Y,n),a(e,Ve,n),a(e,H,n),a(e,Ne,n),M(S,e,n),a(e,Fe,n),a(e,L,n),a(e,ze,n),a(e,P,n),a(e,xe,n),M(D,e,n),a(e,Ee,n),a(e,K,n),a(e,$e,n),M(O,e,n),a(e,Ye,n),M(ee,e,n),a(e,He,n),a(e,ne,n),a(e,Se,n),M(te,e,n),a(e,Le,n),M(se,e,n),a(e,Pe,n),a(e,oe,n),a(e,De,n),M(ae,e,n),a(e,Ke,n),M(le,e,n),a(e,Oe,n),a(e,U,n),M(re,U,null),i(U,un),i(U,fe),i(U,mn),i(U,ge),i(U,Mn),i(U,je),i(U,hn),M(q,U,null),a(e,en,n),M(ie,e,n),a(e,nn,n),a(e,I,n),M(de,I,null),i(I,yn),i(I,Ue),i(I,Jn),i(I,Ie),i(I,wn),i(I,be),i(I,Tn),M(G,I,null),a(e,tn,n),M(ce,e,n),a(e,sn,n),a(e,b,n),M(pe,b,null),i(b,fn),i(b,_e),i(b,gn),i(b,Ce),i(b,jn),i(b,X),M(ue,X,null),i(X,Un),i(X,ve),i(b,In),i(b,R),M(me,R,null),i(R,bn),i(R,Qe),a(e,on,n),M(Me,e,n),a(e,an,n),a(e,_,n),M(he,_,null),i(_,_n),i(_,Ae),i(_,Cn),i(_,We),i(_,vn),i(_,A),M(ye,A,null),i(A,Qn),i(A,Ze),i(A,An),M(V,A,null),i(A,Wn),M(N,A,null),a(e,ln,n),M(Je,e,n),a(e,rn,n),a(e,Be,n),dn=!0},p(e,[n]){const C={};n&2&&(C.$$scope={dirty:n,ctx:e}),q.$set(C);const v={};n&2&&(v.$$scope={dirty:n,ctx:e}),G.$set(v);const Q={};n&2&&(Q.$$scope={dirty:n,ctx:e}),V.$set(Q);const we={};n&2&&(we.$$scope={dirty:n,ctx:e}),N.$set(we)},i(e){dn||(h(f.$$.fragment,e),h(g.$$.fragment,e),h(S.$$.fragment,e),h(D.$$.fragment,e),h(O.$$.fragment,e),h(ee.$$.fragment,e),h(te.$$.fragment,e),h(se.$$.fragment,e),h(ae.$$.fragment,e),h(le.$$.fragment,e),h(re.$$.fragment,e),h(q.$$.fragment,e),h(ie.$$.fragment,e),h(de.$$.fragment,e),h(G.$$.fragment,e),h(ce.$$.fragment,e),h(pe.$$.fragment,e),h(ue.$$.fragment,e),h(me.$$.fragment,e),h(Me.$$.fragment,e),h(he.$$.fragment,e),h(ye.$$.fragment,e),h(V.$$.fragment,e),h(N.$$.fragment,e),h(Je.$$.fragment,e),dn=!0)},o(e){y(f.$$.fragment,e),y(g.$$.fragment,e),y(S.$$.fragment,e),y(D.$$.fragment,e),y(O.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),y(se.$$.fragment,e),y(ae.$$.fragment,e),y(le.$$.fragment,e),y(re.$$.fragment,e),y(q.$$.fragment,e),y(ie.$$.fragment,e),y(de.$$.fragment,e),y(G.$$.fragment,e),y(ce.$$.fragment,e),y(pe.$$.fragment,e),y(ue.$$.fragment,e),y(me.$$.fragment,e),y(Me.$$.fragment,e),y(he.$$.fragment,e),y(ye.$$.fragment,e),y(V.$$.fragment,e),y(N.$$.fragment,e),y(Je.$$.fragment,e),dn=!1},d(e){e&&(t(j),t(T),t(p),t(l),t(qe),t(x),t(Ge),t(E),t(Xe),t($),t(Re),t(Y),t(Ve),t(H),t(Ne),t(Fe),t(L),t(ze),t(P),t(xe),t(Ee),t(K),t($e),t(Ye),t(He),t(ne),t(Se),t(Le),t(Pe),t(oe),t(De),t(Ke),t(Oe),t(U),t(en),t(nn),t(I),t(tn),t(sn),t(b),t(on),t(an),t(_),t(ln),t(rn),t(Be)),t(r),J(f,e),J(g,e),J(S,e),J(D,e),J(O,e),J(ee,e),J(te,e),J(se,e),J(ae,e),J(le,e),J(re),J(q),J(ie,e),J(de),J(G),J(ce,e),J(pe),J(ue),J(me),J(Me,e),J(he),J(ye),J(V),J(N),J(Je,e)}}}const Mt='{"title":"Qwen2Audio","local":"qwen2audio","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Voice Chat Inference","local":"voice-chat-inference","sections":[],"depth":3},{"title":"Audio Analysis Inference","local":"audio-analysis-inference","sections":[],"depth":3},{"title":"Batch Inference","local":"batch-inference","sections":[],"depth":3}],"depth":2},{"title":"Qwen2AudioConfig","local":"transformers.Qwen2AudioConfig","sections":[],"depth":2},{"title":"Qwen2AudioConfig","local":"transformers.Qwen2AudioEncoderConfig","sections":[],"depth":2},{"title":"Qwen2AudioProcessor","local":"transformers.Qwen2AudioProcessor","sections":[],"depth":2},{"title":"Qwen2AudioForConditionalGeneration","local":"transformers.Qwen2AudioForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function ht(W){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ut extends ot{constructor(r){super(),at(this,r,ht,mt,tt,{})}}export{Ut as component};
