import{s as vt,o as Qt,n as vn}from"../chunks/scheduler.01eeda35.js";import{S as Wt,i as kt,g as i,s,r as p,A as Zt,h as d,f as t,c as o,j as B,u,x as w,k as Z,y as r,a,v as m,d as h,t as M,w as y}from"../chunks/index.6dd51b66.js";import{T as At}from"../chunks/Tip.de9bae2b.js";import{D as V}from"../chunks/Docstring.cb556860.js";import{C as ve}from"../chunks/CodeBlock.19ec9b8c.js";import{E as On}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as A,E as Bt}from"../chunks/index.58fe8f9d.js";function Gt(G){let c,j="Example:",J,f,g;return f=new ve({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(){c=i("p"),c.textContent=j,J=s(),p(f.$$.fragment)},l(l){c=d(l,"P",{"data-svelte-h":!0}),w(c)!=="svelte-11lpom8"&&(c.textContent=j),J=o(l),u(f.$$.fragment,l)},m(l,T){a(l,c,T),a(l,J,T),m(f,l,T),g=!0},p:vn,i(l){g||(h(f.$$.fragment,l),g=!0)},o(l){M(f.$$.fragment,l),g=!1},d(l){l&&(t(c),t(J)),y(f,l)}}}function qt(G){let c,j="Example:",J,f,g;return f=new ve({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(){c=i("p"),c.textContent=j,J=s(),p(f.$$.fragment)},l(l){c=d(l,"P",{"data-svelte-h":!0}),w(c)!=="svelte-11lpom8"&&(c.textContent=j),J=o(l),u(f.$$.fragment,l)},m(l,T){a(l,c,T),a(l,J,T),m(f,l,T),g=!0},p:vn,i(l){g||(h(f.$$.fragment,l),g=!0)},o(l){M(f.$$.fragment,l),g=!1},d(l){l&&(t(c),t(J)),y(f,l)}}}function Vt(G){let c,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(){c=i("p"),c.innerHTML=j},l(J){c=d(J,"P",{"data-svelte-h":!0}),w(c)!=="svelte-fincs2"&&(c.innerHTML=j)},m(J,f){a(J,c,f)},p:vn,d(J){J&&t(c)}}}function Xt(G){let c,j="Example:",J,f,g;return f=new ve({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(){c=i("p"),c.textContent=j,J=s(),p(f.$$.fragment)},l(l){c=d(l,"P",{"data-svelte-h":!0}),w(c)!=="svelte-11lpom8"&&(c.textContent=j),J=o(l),u(f.$$.fragment,l)},m(l,T){a(l,c,T),a(l,J,T),m(f,l,T),g=!0},p:vn,i(l){g||(h(f.$$.fragment,l),g=!0)},o(l){M(f.$$.fragment,l),g=!1},d(l){l&&(t(c),t(J)),y(f,l)}}}function Rt(G){let c,j,J,f,g,l,T,et='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/> <img alt="FlashAttention" src="https://img.shields.io/badge/%E2%9A%A1%EF%B8%8E%20FlashAttention-eae0c8?style=flat"/> <img alt="SDPA" src="https://img.shields.io/badge/SDPA-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',He,Y,Se,H,nt="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:",Le,S,tt="<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>",Pe,L,st='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.',De,P,ot="The abstract from the paper is the following:",Ke,D,at="<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>",Oe,K,en,O,lt='<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>',nn,ee,tn,ne,sn,te,rt="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.",on,se,an,oe,it="In the voice chat mode, users can freely engage in voice interactions with Qwen2-Audio without text input:",ln,ae,rn,le,dn,re,dt="In the audio analysis, users could provide both audio and text instructions for analysis:",cn,ie,pn,de,un,ce,ct="We also support batch inference:",mn,pe,hn,ue,Mn,U,me,Qn,Qe,pt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/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.`,Wn,We,ut='e.g. <a href="https://huggingface.co/Qwen/Qwen2-Audio-7B" rel="nofollow">Qwen/Qwen2-Audio-7B</a>',kn,ke,mt=`Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Zn,X,yn,he,wn,b,Me,An,Ze,ht=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/qwen2_audio#transformers.Qwen2AudioEncoder">Qwen2AudioEncoder</a>. 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.`,Bn,Ae,Mt='e.g. <a href="https://huggingface.co/Qwen/Qwen2-Audio-7B" rel="nofollow">Qwen/Qwen2-Audio-7B</a>',Gn,Be,yt=`Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,qn,R,fn,ye,Jn,I,we,Vn,Ge,wt="Constructs a Qwen2Audio processor which wraps a Qwen2Audio feature extractor and a Qwen2Audio tokenizer into a single processor.",Xn,qe,ft=`<a href="/docs/transformers/main/en/model_doc/qwen2_audio#transformers.Qwen2AudioProcessor">Qwen2AudioProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/whisper#transformers.WhisperFeatureExtractor">WhisperFeatureExtractor</a> and <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2TokenizerFast">Qwen2TokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/qwen2_audio#transformers.Qwen2AudioProcessor.decode">decode()</a> for more information.`,Rn,N,fe,Nn,Ve,Jt=`This method forwards all its arguments to Qwen2TokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,Fn,F,Je,En,Xe,gt=`This method forwards all its arguments to Qwen2TokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,gn,ge,Tn,_,Te,zn,Re,Tt=`The audio model from Qwen2Audio without any head or projection on top.
This model inherits from <a href="/docs/transformers/main/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.)`,xn,Ne,jt=`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.`,$n,Fe,Ut=`Transformer encoder consisting of <em>config.encoder_layers</em> self attention layers. Each layer is a
<code>Qwen2AudioEncoderLayer</code>.`,Yn,Ee,je,jn,Ue,Un,C,be,Hn,ze,bt=`The QWEN2AUDIO model which consists of a audio backbone and a language model.
This model inherits from <a href="/docs/transformers/main/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.)`,Sn,xe,It=`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.`,Ln,k,Ie,Pn,$e,_t='The <a href="/docs/transformers/main/en/model_doc/qwen2_audio#transformers.Qwen2AudioForConditionalGeneration">Qwen2AudioForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Dn,E,Kn,z,bn,_e,In,Ye,_n;return g=new A({props:{title:"Qwen2Audio",local:"qwen2audio",headingTag:"h1"}}),Y=new A({props:{title:"Overview",local:"overview",headingTag:"h2"}}),K=new A({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ee=new A({props:{title:"Inference",local:"inference",headingTag:"h3"}}),ne=new ve({props:{code:"ZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjB1cmxsaWIucmVxdWVzdCUyMGltcG9ydCUyMHVybG9wZW4lMEFpbXBvcnQlMjBsaWJyb3NhJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBRd2VuMkF1ZGlvRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBRd2VuMkF1ZGlvRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItQXVkaW8tN0IlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItQXVkaW8tN0IlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyJTNDJTdDYXVkaW9fYm9zJTdDJTNFJTNDJTdDQVVESU8lN0MlM0UlM0MlN0NhdWRpb19lb3MlN0MlM0VHZW5lcmF0ZSUyMHRoZSUyMGNhcHRpb24lMjBpbiUyMEVuZ2xpc2glM0ElMjIlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnFpYW53ZW4tcmVzLm9zcy1jbi1iZWlqaW5nLmFsaXl1bmNzLmNvbSUyRlF3ZW4tQXVkaW8lMkZnbGFzcy1icmVha2luZy0xNTEyNTYubXAzJTIyJTBBYXVkaW8lMkMlMjBzciUyMCUzRCUyMGxpYnJvc2EubG9hZChCeXRlc0lPKHVybG9wZW4odXJsKS5yZWFkKCkpJTJDJTIwc3IlM0Rwcm9jZXNzb3IuZmVhdHVyZV9leHRyYWN0b3Iuc2FtcGxpbmdfcmF0ZSklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHByb21wdCUyQyUyMGF1ZGlvcyUzRGF1ZGlvJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8obW9kZWwuZGV2aWNlKSUwQSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDI1NiklMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBnZW5lcmF0ZV9pZHMlNUIlM0ElMkMlMjBpbnB1dHMuaW5wdXRfaWRzLnNpemUoMSklM0ElNUQlMEElMEFyZXNwb25zZSUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RCUwQSUwQSUyMyUyMFdlJTIwY2FuJTIwYWxzbyUyMG9taXQlMjB0aGUlMjBhdWRpb19ib3MlMjBhbmQlMjBhdWRpb19lb3MlMjB0b2tlbnMlMEFwcm9tcHQlMjAlM0QlMjAlMjIlM0MlN0NBVURJTyU3QyUzRUdlbmVyYXRlJTIwdGhlJTIwY2FwdGlvbiUyMGluJTIwRW5nbGlzaCUzQSUyMiUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEcHJvbXB0JTJDJTIwYXVkaW9zJTNEYXVkaW8lMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhtb2RlbC5kZXZpY2UpJTBBJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNEMjU2KSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMGdlbmVyYXRlX2lkcyU1QiUzQSUyQyUyMGlucHV0cy5pbnB1dF9pZHMuc2l6ZSgxKSUzQSU1RCUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",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> AutoProcessor, Qwen2AudioForConditionalGeneration

model = Qwen2AudioForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-Audio-7B&quot;</span>, trust_remote_code=<span class="hljs-literal">True</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>
url = <span class="hljs-string">&quot;https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Audio/glass-breaking-151256.mp3&quot;</span>
audio, sr = librosa.load(BytesIO(urlopen(url).read()), sr=processor.feature_extractor.sampling_rate)
inputs = processor(text=prompt, audios=audio, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)

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>]

<span class="hljs-comment"># We can also omit the audio_bos and audio_eos tokens</span>
prompt = <span class="hljs-string">&quot;&lt;|AUDIO|&gt;Generate the caption in English:&quot;</span>
inputs = processor(text=prompt, audios=audio, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)

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 A({props:{title:"Voice Chat Inference",local:"voice-chat-inference",headingTag:"h3"}}),ae=new ve({props:{code:"ZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjB1cmxsaWIucmVxdWVzdCUyMGltcG9ydCUyMHVybG9wZW4lMEFpbXBvcnQlMjBsaWJyb3NhJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yQXVkaW9Gb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBBdXRvUHJvY2Vzc29yJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLUF1ZGlvLTdCLUluc3RydWN0JTIyKSUwQW1vZGVsJTIwJTNEJTIwUXdlbjJBdWRpb0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLUF1ZGlvLTdCLUluc3RydWN0JTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBJTBBY29udmVyc2F0aW9uJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmF1ZGlvJTIyJTJDJTIwJTIyYXVkaW9fdXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZxaWFud2VuLXJlcy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZRd2VuMi1BdWRpbyUyRmF1ZGlvJTJGZ3Vlc3NfYWdlX2dlbmRlci53YXYlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlNUQlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyYXNzaXN0YW50JTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlllcyUyQyUyMHRoZSUyMHNwZWFrZXIlMjBpcyUyMGZlbWFsZSUyMGFuZCUyMGluJTIwaGVyJTIwdHdlbnRpZXMuJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmF1ZGlvJTIyJTJDJTIwJTIyYXVkaW9fdXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZxaWFud2VuLXJlcy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZRd2VuMi1BdWRpbyUyRmF1ZGlvJTJGdHJhbnNsYXRlX3RvX2NoaW5lc2Uud2F2JTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTdEJTJDJTBBJTVEJTBBdGV4dCUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKGNvbnZlcnNhdGlvbiUyQyUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMjB0b2tlbml6ZSUzREZhbHNlKSUwQWF1ZGlvcyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMG1lc3NhZ2UlMjBpbiUyMGNvbnZlcnNhdGlvbiUzQSUwQSUyMCUyMCUyMCUyMGlmJTIwaXNpbnN0YW5jZShtZXNzYWdlJTVCJTIyY29udGVudCUyMiU1RCUyQyUyMGxpc3QpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwZWxlJTIwaW4lMjBtZXNzYWdlJTVCJTIyY29udGVudCUyMiU1RCUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwZWxlJTVCJTIydHlwZSUyMiU1RCUyMCUzRCUzRCUyMCUyMmF1ZGlvJTIyJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXVkaW9zLmFwcGVuZChsaWJyb3NhLmxvYWQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwQnl0ZXNJTyh1cmxvcGVuKGVsZSU1QidhdWRpb191cmwnJTVEKS5yZWFkKCkpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc3IlM0Rwcm9jZXNzb3IuZmVhdHVyZV9leHRyYWN0b3Iuc2FtcGxpbmdfcmF0ZSklNUIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEdGV4dCUyQyUyMGF1ZGlvcyUzRGF1ZGlvcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcy50byglMjJjdWRhJTIyKSUwQSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDI1NiklMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBnZW5lcmF0ZV9pZHMlNUIlM0ElMkMlMjBpbnB1dHMuaW5wdXRfaWRzLnNpemUoMSklM0ElNUQlMEElMEFyZXNwb25zZSUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",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}}),le=new A({props:{title:"Audio Analysis Inference",local:"audio-analysis-inference",headingTag:"h3"}}),ie=new ve({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}}),de=new A({props:{title:"Batch Inference",local:"batch-inference",headingTag:"h3"}}),pe=new ve({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}}),ue=new A({props:{title:"Qwen2AudioConfig",local:"transformers.Qwen2AudioConfig",headingTag:"h2"}}),me=new V({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/main/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py#L119"}}),X=new On({props:{anchor:"transformers.Qwen2AudioConfig.example",$$slots:{default:[Gt]},$$scope:{ctx:G}}}),he=new A({props:{title:"Qwen2AudioEncoderConfig",local:"transformers.Qwen2AudioEncoderConfig",headingTag:"h2"}}),Me=new V({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/main/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py#L24"}}),R=new On({props:{anchor:"transformers.Qwen2AudioEncoderConfig.example",$$slots:{default:[qt]},$$scope:{ctx:G}}}),ye=new A({props:{title:"Qwen2AudioProcessor",local:"transformers.Qwen2AudioProcessor",headingTag:"h2"}}),we=new V({props:{name:"class transformers.Qwen2AudioProcessor",anchor:"transformers.Qwen2AudioProcessor",parameters:[{name:"feature_extractor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"chat_template",val:" = None"},{name:"audio_token",val:" = '<|AUDIO|>'"},{name:"audio_bos_token",val:" = '<|audio_bos|>'"},{name:"audio_eos_token",val:" = '<|audio_eos|>'"}],parametersDescription:[{anchor:"transformers.Qwen2AudioProcessor.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="/docs/transformers/main/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/main/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"},{anchor:"transformers.Qwen2AudioProcessor.audio_token",description:`<strong>audio_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|AUDIO|&gt;&quot;</code>) &#x2014;
The token to use for audio tokens.`,name:"audio_token"},{anchor:"transformers.Qwen2AudioProcessor.audio_bos_token",description:`<strong>audio_bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|audio_bos|&gt;&quot;</code>) &#x2014;
The token to use for audio bos tokens.`,name:"audio_bos_token"},{anchor:"transformers.Qwen2AudioProcessor.audio_eos_token",description:`<strong>audio_eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|audio_eos|&gt;&quot;</code>) &#x2014;
The token to use for audio eos tokens.`,name:"audio_eos_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L39"}}),fe=new V({props:{name:"batch_decode",anchor:"transformers.Qwen2AudioProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L189"}}),Je=new V({props:{name:"decode",anchor:"transformers.Qwen2AudioProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/processing_qwen2_audio.py#L196"}}),ge=new A({props:{title:"Qwen2AudioEncoder",local:"transformers.Qwen2AudioEncoder",headingTag:"h2"}}),Te=new V({props:{name:"class transformers.Qwen2AudioEncoder",anchor:"transformers.Qwen2AudioEncoder",parameters:[{name:"config",val:": Qwen2AudioEncoderConfig"}],parametersDescription:[{anchor:"transformers.Qwen2AudioEncoder.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2_audio#transformers.Qwen2AudioEncoderConfig">Qwen2AudioEncoderConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.Qwen2AudioEncoder.config",description:"<strong>config</strong> &#x2014; Qwen2AudioEncoderConfig",name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L503"}}),je=new V({props:{name:"forward",anchor:"transformers.Qwen2AudioEncoder.forward",parameters:[{name:"input_features",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.Qwen2AudioEncoder.forward.input_features",description:`<strong>input_features</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, feature_size, sequence_length)</code>) &#x2014;
Float values of 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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding
and conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/whisper#transformers.WhisperFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_features"},{anchor:"transformers.Qwen2AudioEncoder.forward.attention_mask",description:"<strong>attention_mask</strong> (<code>torch.Tensor</code>)<code>, *optional*) -- Qwen2Audio does not support masking of the </code>input_features`, this argument is preserved for compatibility,\nbut it is not used. By default the silence in the input log mel spectrogram are ignored.",name:"attention_mask"},{anchor:"transformers.Qwen2AudioEncoder.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Qwen2AudioEncoder.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.Qwen2AudioEncoder.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.Qwen2AudioEncoder.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L559"}}),Ue=new A({props:{title:"Qwen2AudioForConditionalGeneration",local:"transformers.Qwen2AudioForConditionalGeneration",headingTag:"h2"}}),be=new V({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L769"}}),Ie=new V({props:{name:"forward",anchor:"transformers.Qwen2AudioForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"input_features",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"feature_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.cache_utils.Cache] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a> should be used for extracting the mel features, padding and conversion into a
tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Pre-computed hidden-states that can be used to speed up auto-regressive (sequential) decoding. There are
two sets of pre-computed hidden-states: key and values states in the self-attention blocks.
The <code>past_key_values</code> are returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>.
It is a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>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>input_ids</code> of shape <code>(batch_size, sequence_length)</code>.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py#L1019",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/main/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>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Pre-computed hidden-states that can be used to speed up auto-regressive (sequential) decoding. There are
two sets of pre-computed hidden-states: key and values states in the self-attention blocks.
The <code>past_key_values</code> are returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>.
It is a <a
  href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache"
>Cache</a> instance.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those
that don’t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of
all <code>input_ids</code> of shape <code>(batch_size, sequence_length)</code>.</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>
`}}),E=new At({props:{$$slots:{default:[Vt]},$$scope:{ctx:G}}}),z=new On({props:{anchor:"transformers.Qwen2AudioForConditionalGeneration.forward.example",$$slots:{default:[Xt]},$$scope:{ctx:G}}}),_e=new Bt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/qwen2_audio.md"}}),{c(){c=i("meta"),j=s(),J=i("p"),f=s(),p(g.$$.fragment),l=s(),T=i("div"),T.innerHTML=et,He=s(),p(Y.$$.fragment),Se=s(),H=i("p"),H.textContent=nt,Le=s(),S=i("ul"),S.innerHTML=tt,Pe=s(),L=i("p"),L.innerHTML=st,De=s(),P=i("p"),P.textContent=ot,Ke=s(),D=i("p"),D.innerHTML=at,Oe=s(),p(K.$$.fragment),en=s(),O=i("p"),O.innerHTML=lt,nn=s(),p(ee.$$.fragment),tn=s(),p(ne.$$.fragment),sn=s(),te=i("p"),te.innerHTML=rt,on=s(),p(se.$$.fragment),an=s(),oe=i("p"),oe.textContent=it,ln=s(),p(ae.$$.fragment),rn=s(),p(le.$$.fragment),dn=s(),re=i("p"),re.textContent=dt,cn=s(),p(ie.$$.fragment),pn=s(),p(de.$$.fragment),un=s(),ce=i("p"),ce.textContent=ct,mn=s(),p(pe.$$.fragment),hn=s(),p(ue.$$.fragment),Mn=s(),U=i("div"),p(me.$$.fragment),Qn=s(),Qe=i("p"),Qe.innerHTML=pt,Wn=s(),We=i("p"),We.innerHTML=ut,kn=s(),ke=i("p"),ke.innerHTML=mt,Zn=s(),p(X.$$.fragment),yn=s(),p(he.$$.fragment),wn=s(),b=i("div"),p(Me.$$.fragment),An=s(),Ze=i("p"),Ze.innerHTML=ht,Bn=s(),Ae=i("p"),Ae.innerHTML=Mt,Gn=s(),Be=i("p"),Be.innerHTML=yt,qn=s(),p(R.$$.fragment),fn=s(),p(ye.$$.fragment),Jn=s(),I=i("div"),p(we.$$.fragment),Vn=s(),Ge=i("p"),Ge.textContent=wt,Xn=s(),qe=i("p"),qe.innerHTML=ft,Rn=s(),N=i("div"),p(fe.$$.fragment),Nn=s(),Ve=i("p"),Ve.innerHTML=Jt,Fn=s(),F=i("div"),p(Je.$$.fragment),En=s(),Xe=i("p"),Xe.innerHTML=gt,gn=s(),p(ge.$$.fragment),Tn=s(),_=i("div"),p(Te.$$.fragment),zn=s(),Re=i("p"),Re.innerHTML=Tt,xn=s(),Ne=i("p"),Ne.innerHTML=jt,$n=s(),Fe=i("p"),Fe.innerHTML=Ut,Yn=s(),Ee=i("div"),p(je.$$.fragment),jn=s(),p(Ue.$$.fragment),Un=s(),C=i("div"),p(be.$$.fragment),Hn=s(),ze=i("p"),ze.innerHTML=bt,Sn=s(),xe=i("p"),xe.innerHTML=It,Ln=s(),k=i("div"),p(Ie.$$.fragment),Pn=s(),$e=i("p"),$e.innerHTML=_t,Dn=s(),p(E.$$.fragment),Kn=s(),p(z.$$.fragment),bn=s(),p(_e.$$.fragment),In=s(),Ye=i("p"),this.h()},l(e){const n=Zt("svelte-u9bgzb",document.head);c=d(n,"META",{name:!0,content:!0}),n.forEach(t),j=o(e),J=d(e,"P",{}),B(J).forEach(t),f=o(e),u(g.$$.fragment,e),l=o(e),T=d(e,"DIV",{class:!0,"data-svelte-h":!0}),w(T)!=="svelte-b95w5j"&&(T.innerHTML=et),He=o(e),u(Y.$$.fragment,e),Se=o(e),H=d(e,"P",{"data-svelte-h":!0}),w(H)!=="svelte-1r54lck"&&(H.textContent=nt),Le=o(e),S=d(e,"UL",{"data-svelte-h":!0}),w(S)!=="svelte-p799jx"&&(S.innerHTML=tt),Pe=o(e),L=d(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-tkmkr8"&&(L.innerHTML=st),De=o(e),P=d(e,"P",{"data-svelte-h":!0}),w(P)!=="svelte-vfdo9a"&&(P.textContent=ot),Ke=o(e),D=d(e,"P",{"data-svelte-h":!0}),w(D)!=="svelte-1453f3k"&&(D.innerHTML=at),Oe=o(e),u(K.$$.fragment,e),en=o(e),O=d(e,"P",{"data-svelte-h":!0}),w(O)!=="svelte-12upnh6"&&(O.innerHTML=lt),nn=o(e),u(ee.$$.fragment,e),tn=o(e),u(ne.$$.fragment,e),sn=o(e),te=d(e,"P",{"data-svelte-h":!0}),w(te)!=="svelte-ubq47c"&&(te.innerHTML=rt),on=o(e),u(se.$$.fragment,e),an=o(e),oe=d(e,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-hygfg8"&&(oe.textContent=it),ln=o(e),u(ae.$$.fragment,e),rn=o(e),u(le.$$.fragment,e),dn=o(e),re=d(e,"P",{"data-svelte-h":!0}),w(re)!=="svelte-i9t6g7"&&(re.textContent=dt),cn=o(e),u(ie.$$.fragment,e),pn=o(e),u(de.$$.fragment,e),un=o(e),ce=d(e,"P",{"data-svelte-h":!0}),w(ce)!=="svelte-1smugch"&&(ce.textContent=ct),mn=o(e),u(pe.$$.fragment,e),hn=o(e),u(ue.$$.fragment,e),Mn=o(e),U=d(e,"DIV",{class:!0});var v=B(U);u(me.$$.fragment,v),Qn=o(v),Qe=d(v,"P",{"data-svelte-h":!0}),w(Qe)!=="svelte-1w5w7f7"&&(Qe.innerHTML=pt),Wn=o(v),We=d(v,"P",{"data-svelte-h":!0}),w(We)!=="svelte-v3fb75"&&(We.innerHTML=ut),kn=o(v),ke=d(v,"P",{"data-svelte-h":!0}),w(ke)!=="svelte-o55m63"&&(ke.innerHTML=mt),Zn=o(v),u(X.$$.fragment,v),v.forEach(t),yn=o(e),u(he.$$.fragment,e),wn=o(e),b=d(e,"DIV",{class:!0});var Q=B(b);u(Me.$$.fragment,Q),An=o(Q),Ze=d(Q,"P",{"data-svelte-h":!0}),w(Ze)!=="svelte-nqw67l"&&(Ze.innerHTML=ht),Bn=o(Q),Ae=d(Q,"P",{"data-svelte-h":!0}),w(Ae)!=="svelte-v3fb75"&&(Ae.innerHTML=Mt),Gn=o(Q),Be=d(Q,"P",{"data-svelte-h":!0}),w(Be)!=="svelte-o55m63"&&(Be.innerHTML=yt),qn=o(Q),u(R.$$.fragment,Q),Q.forEach(t),fn=o(e),u(ye.$$.fragment,e),Jn=o(e),I=d(e,"DIV",{class:!0});var W=B(I);u(we.$$.fragment,W),Vn=o(W),Ge=d(W,"P",{"data-svelte-h":!0}),w(Ge)!=="svelte-1i2lr9"&&(Ge.textContent=wt),Xn=o(W),qe=d(W,"P",{"data-svelte-h":!0}),w(qe)!=="svelte-12cei1w"&&(qe.innerHTML=ft),Rn=o(W),N=d(W,"DIV",{class:!0});var Ce=B(N);u(fe.$$.fragment,Ce),Nn=o(Ce),Ve=d(Ce,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-1h49hic"&&(Ve.innerHTML=Jt),Ce.forEach(t),Fn=o(W),F=d(W,"DIV",{class:!0});var Cn=B(F);u(Je.$$.fragment,Cn),En=o(Cn),Xe=d(Cn,"P",{"data-svelte-h":!0}),w(Xe)!=="svelte-46ufki"&&(Xe.innerHTML=gt),Cn.forEach(t),W.forEach(t),gn=o(e),u(ge.$$.fragment,e),Tn=o(e),_=d(e,"DIV",{class:!0});var q=B(_);u(Te.$$.fragment,q),zn=o(q),Re=d(q,"P",{"data-svelte-h":!0}),w(Re)!=="svelte-1c157af"&&(Re.innerHTML=Tt),xn=o(q),Ne=d(q,"P",{"data-svelte-h":!0}),w(Ne)!=="svelte-hswkmf"&&(Ne.innerHTML=jt),$n=o(q),Fe=d(q,"P",{"data-svelte-h":!0}),w(Fe)!=="svelte-1wybcdn"&&(Fe.innerHTML=Ut),Yn=o(q),Ee=d(q,"DIV",{class:!0});var Ct=B(Ee);u(je.$$.fragment,Ct),Ct.forEach(t),q.forEach(t),jn=o(e),u(Ue.$$.fragment,e),Un=o(e),C=d(e,"DIV",{class:!0});var x=B(C);u(be.$$.fragment,x),Hn=o(x),ze=d(x,"P",{"data-svelte-h":!0}),w(ze)!=="svelte-n4dopo"&&(ze.innerHTML=bt),Sn=o(x),xe=d(x,"P",{"data-svelte-h":!0}),w(xe)!=="svelte-hswkmf"&&(xe.innerHTML=It),Ln=o(x),k=d(x,"DIV",{class:!0});var $=B(k);u(Ie.$$.fragment,$),Pn=o($),$e=d($,"P",{"data-svelte-h":!0}),w($e)!=="svelte-6viiit"&&($e.innerHTML=_t),Dn=o($),u(E.$$.fragment,$),Kn=o($),u(z.$$.fragment,$),$.forEach(t),x.forEach(t),bn=o(e),u(_e.$$.fragment,e),In=o(e),Ye=d(e,"P",{}),B(Ye).forEach(t),this.h()},h(){Z(c,"name","hf:doc:metadata"),Z(c,"content",Nt),Z(T,"class","flex flex-wrap space-x-1"),Z(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){r(document.head,c),a(e,j,n),a(e,J,n),a(e,f,n),m(g,e,n),a(e,l,n),a(e,T,n),a(e,He,n),m(Y,e,n),a(e,Se,n),a(e,H,n),a(e,Le,n),a(e,S,n),a(e,Pe,n),a(e,L,n),a(e,De,n),a(e,P,n),a(e,Ke,n),a(e,D,n),a(e,Oe,n),m(K,e,n),a(e,en,n),a(e,O,n),a(e,nn,n),m(ee,e,n),a(e,tn,n),m(ne,e,n),a(e,sn,n),a(e,te,n),a(e,on,n),m(se,e,n),a(e,an,n),a(e,oe,n),a(e,ln,n),m(ae,e,n),a(e,rn,n),m(le,e,n),a(e,dn,n),a(e,re,n),a(e,cn,n),m(ie,e,n),a(e,pn,n),m(de,e,n),a(e,un,n),a(e,ce,n),a(e,mn,n),m(pe,e,n),a(e,hn,n),m(ue,e,n),a(e,Mn,n),a(e,U,n),m(me,U,null),r(U,Qn),r(U,Qe),r(U,Wn),r(U,We),r(U,kn),r(U,ke),r(U,Zn),m(X,U,null),a(e,yn,n),m(he,e,n),a(e,wn,n),a(e,b,n),m(Me,b,null),r(b,An),r(b,Ze),r(b,Bn),r(b,Ae),r(b,Gn),r(b,Be),r(b,qn),m(R,b,null),a(e,fn,n),m(ye,e,n),a(e,Jn,n),a(e,I,n),m(we,I,null),r(I,Vn),r(I,Ge),r(I,Xn),r(I,qe),r(I,Rn),r(I,N),m(fe,N,null),r(N,Nn),r(N,Ve),r(I,Fn),r(I,F),m(Je,F,null),r(F,En),r(F,Xe),a(e,gn,n),m(ge,e,n),a(e,Tn,n),a(e,_,n),m(Te,_,null),r(_,zn),r(_,Re),r(_,xn),r(_,Ne),r(_,$n),r(_,Fe),r(_,Yn),r(_,Ee),m(je,Ee,null),a(e,jn,n),m(Ue,e,n),a(e,Un,n),a(e,C,n),m(be,C,null),r(C,Hn),r(C,ze),r(C,Sn),r(C,xe),r(C,Ln),r(C,k),m(Ie,k,null),r(k,Pn),r(k,$e),r(k,Dn),m(E,k,null),r(k,Kn),m(z,k,null),a(e,bn,n),m(_e,e,n),a(e,In,n),a(e,Ye,n),_n=!0},p(e,[n]){const v={};n&2&&(v.$$scope={dirty:n,ctx:e}),X.$set(v);const Q={};n&2&&(Q.$$scope={dirty:n,ctx:e}),R.$set(Q);const W={};n&2&&(W.$$scope={dirty:n,ctx:e}),E.$set(W);const Ce={};n&2&&(Ce.$$scope={dirty:n,ctx:e}),z.$set(Ce)},i(e){_n||(h(g.$$.fragment,e),h(Y.$$.fragment,e),h(K.$$.fragment,e),h(ee.$$.fragment,e),h(ne.$$.fragment,e),h(se.$$.fragment,e),h(ae.$$.fragment,e),h(le.$$.fragment,e),h(ie.$$.fragment,e),h(de.$$.fragment,e),h(pe.$$.fragment,e),h(ue.$$.fragment,e),h(me.$$.fragment,e),h(X.$$.fragment,e),h(he.$$.fragment,e),h(Me.$$.fragment,e),h(R.$$.fragment,e),h(ye.$$.fragment,e),h(we.$$.fragment,e),h(fe.$$.fragment,e),h(Je.$$.fragment,e),h(ge.$$.fragment,e),h(Te.$$.fragment,e),h(je.$$.fragment,e),h(Ue.$$.fragment,e),h(be.$$.fragment,e),h(Ie.$$.fragment,e),h(E.$$.fragment,e),h(z.$$.fragment,e),h(_e.$$.fragment,e),_n=!0)},o(e){M(g.$$.fragment,e),M(Y.$$.fragment,e),M(K.$$.fragment,e),M(ee.$$.fragment,e),M(ne.$$.fragment,e),M(se.$$.fragment,e),M(ae.$$.fragment,e),M(le.$$.fragment,e),M(ie.$$.fragment,e),M(de.$$.fragment,e),M(pe.$$.fragment,e),M(ue.$$.fragment,e),M(me.$$.fragment,e),M(X.$$.fragment,e),M(he.$$.fragment,e),M(Me.$$.fragment,e),M(R.$$.fragment,e),M(ye.$$.fragment,e),M(we.$$.fragment,e),M(fe.$$.fragment,e),M(Je.$$.fragment,e),M(ge.$$.fragment,e),M(Te.$$.fragment,e),M(je.$$.fragment,e),M(Ue.$$.fragment,e),M(be.$$.fragment,e),M(Ie.$$.fragment,e),M(E.$$.fragment,e),M(z.$$.fragment,e),M(_e.$$.fragment,e),_n=!1},d(e){e&&(t(j),t(J),t(f),t(l),t(T),t(He),t(Se),t(H),t(Le),t(S),t(Pe),t(L),t(De),t(P),t(Ke),t(D),t(Oe),t(en),t(O),t(nn),t(tn),t(sn),t(te),t(on),t(an),t(oe),t(ln),t(rn),t(dn),t(re),t(cn),t(pn),t(un),t(ce),t(mn),t(hn),t(Mn),t(U),t(yn),t(wn),t(b),t(fn),t(Jn),t(I),t(gn),t(Tn),t(_),t(jn),t(Un),t(C),t(bn),t(In),t(Ye)),t(c),y(g,e),y(Y,e),y(K,e),y(ee,e),y(ne,e),y(se,e),y(ae,e),y(le,e),y(ie,e),y(de,e),y(pe,e),y(ue,e),y(me),y(X),y(he,e),y(Me),y(R),y(ye,e),y(we),y(fe),y(Je),y(ge,e),y(Te),y(je),y(Ue,e),y(be),y(Ie),y(E),y(z),y(_e,e)}}}const Nt='{"title":"Qwen2Audio","local":"qwen2audio","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Inference","local":"inference","sections":[],"depth":3},{"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":"Qwen2AudioEncoderConfig","local":"transformers.Qwen2AudioEncoderConfig","sections":[],"depth":2},{"title":"Qwen2AudioProcessor","local":"transformers.Qwen2AudioProcessor","sections":[],"depth":2},{"title":"Qwen2AudioEncoder","local":"transformers.Qwen2AudioEncoder","sections":[],"depth":2},{"title":"Qwen2AudioForConditionalGeneration","local":"transformers.Qwen2AudioForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function Ft(G){return Qt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Lt extends Wt{constructor(c){super(),kt(this,c,Ft,Rt,vt,{})}}export{Lt as component};
