Audio Flamingo Next Think提示工程7种高效提示模板提升音频理解准确率【免费下载链接】audio-flamingo-next-think-hf项目地址: https://ai.gitcode.com/hf_mirrors/nvidia/audio-flamingo-next-think-hfAudio Flamingo Next Think是一款专为音频理解设计的先进模型尤其擅长处理长达30分钟的音频输入通过时间戳定位和多步骤推理来提升音频理解准确率。本文将分享7种高效提示模板帮助新手和普通用户充分发挥该模型的潜力。一、模型简介什么是Audio Flamingo Next ThinkAudio Flamingo Next Think是Audio Flamingo系列的下一代开源音频语言模型专注于语音、环境声音和音乐理解。它是推理专用变体在AF-Next-Instruct的基础上通过AF-Think-Time数据集进一步训练能够处理复杂的长音频问题如预告片、电影回顾、悬疑故事和多方对话等场景。该模型的核心优势在于支持长达30分钟的音频输入具备时间戳定位的推理能力能够进行多步骤问答提供基于时间戳的解释二、7种高效提示模板1. 时间戳推理模板模板Reason step by step with timestamps before answering. [你的问题]适用场景需要模型基于音频中特定时间段的信息进行推理的问题。示例Reason step by step with timestamps before answering. How does the female speakers tone change over the course of the audio, and what evidence supports that?这个模板明确要求模型在回答前提供带时间戳的逐步推理有助于提高复杂音频理解任务的准确率。根据项目文档README.md中的说明这种明确要求推理的提示能更好地发挥AF-Next-Think的优势。2. 音频转写模板模板Transcribe the input speech.适用场景需要将音频中的语音转换为文本的场景。示例Transcribe the input speech. Please include speaker labels if multiple speakers are present.该模板适用于基本的语音识别任务。根据README.md中的提示指南此模板也适用于Instruct版本但Think版本能提供更详细的转写结果。3. 音频翻译模板模板Translate any speech you hear from [源语言] into [目标语言].适用场景需要将音频中的语音从一种语言翻译成另一种语言的场景。示例Translate any speech you hear from English into Spanish. Provide timestamps for each translation segment.这个模板支持多语言翻译功能结合时间戳可以获得更精确的翻译结果。4. 音频描述模板模板Generate a detailed caption for the input audio. In the caption, transcribe all spoken content by all speakers in the audio precisely.适用场景需要对长音频内容进行全面描述的场景。示例Generate a detailed caption for the input audio. In the caption, transcribe all spoken content by all speakers in the audio precisely. Include timestamps for each speakers turn.此模板特别适合处理包含多个说话者的长音频能够生成详细的带时间戳的描述。5. 音乐分析模板模板Summarize the track with precision: mention its musical style, BPM, key, arrangement, production choices, and the emotions or story it conveys.适用场景需要对音乐作品进行专业分析的场景。示例Summarize the track with precision: mention its musical style, BPM, key, arrangement, production choices, and the emotions or story it conveys. Note any tempo changes or key shifts with timestamps.这个模板能引导模型对音乐进行多维度分析提供专业的音乐理解结果。6. 歌词提取模板模板Generate a lyrics transcription from the input song.适用场景需要从歌曲中提取歌词的场景。示例Generate a lyrics transcription from the input song. Include timestamps for each verse and chorus.使用此模板可以从歌曲中提取歌词并结合时间戳信息使结果更具参考价值。7. 多说话者识别模板模板Transcribe the input audio. If multiple speakers are present, provide diarized transcripts with speaker labels. [Speaker 1] ... [Speaker 2] ...适用场景需要区分多个说话者并分别转写其内容的场景。示例Transcribe the input audio. If multiple speakers are present, provide diarized transcripts with speaker labels. [Speaker 1] ... [Speaker 2] ... Include timestamps for each speakers utterances.这个模板特别适合处理会议录音、访谈等包含多个说话者的音频内容。三、使用技巧如何优化提示效果明确推理需求在提示中明确要求模型进行逐步推理如使用Reason step by step with timestamps, then give the final answer.这样的表述。提供上下文尽可能提供音频的背景信息帮助模型更好地理解内容。指定输出格式明确指定希望的输出格式如是否需要时间戳、是否需要分点说明等。合理设置参数根据README.md中的建议使用较大的max_new_tokens值因为推理过程可能会产生较长的输出。利用聊天模板参考项目中的chat_template.jinja文件了解模型期望的输入格式。四、安装与基本使用要开始使用Audio Flamingo Next Think首先需要安装必要的依赖pip install --upgrade pip pip install --upgrade transformers accelerate然后可以通过以下方式克隆仓库并使用模型git clone https://gitcode.com/hf_mirrors/nvidia/audio-flamingo-next-think-hf基本使用示例import torch from transformers import AutoModel, AutoProcessor model_id nvidia/audio-flamingo-next-think-hf processor AutoProcessor.from_pretrained(model_id) model AutoModel.from_pretrained( model_id, torch_dtypetorch.bfloat16, device_mapauto, ).eval() # 使用上述提示模板构建对话 conversation [ [ { role: user, content: [ { type: text, text: Reason step by step with timestamps before answering. How does the speakers tone change throughout the audio? }, { type: audio, path: your_audio_file.wav, }, ], } ] ] # 处理对话并生成响应 batch processor.apply_chat_template( conversation, tokenizeTrue, add_generation_promptTrue, return_dictTrue, ).to(model.device) generated model.generate( **batch, max_new_tokens4096, repetition_penalty1.2, ) # 解码并输出结果 prompt_len batch[input_ids].shape[1] completion generated[:, prompt_len:] text processor.batch_decode( completion, skip_special_tokensTrue, clean_up_tokenization_spacesFalse, )[0] print(text)五、总结Audio Flamingo Next Think是一款功能强大的音频理解模型通过本文介绍的7种提示模板您可以有效地提升模型在各种音频理解任务中的表现。记住清晰明确的提示是获得准确结果的关键。根据您的具体需求选择合适的模板并适当调整就能充分发挥这个先进音频语言模型的潜力。无论是语音识别、音频翻译还是音乐分析Audio Flamingo Next Think都能通过精准的时间戳定位和多步骤推理为您提供高质量的音频理解结果。开始尝试这些提示模板体验下一代音频语言模型的强大能力吧【免费下载链接】audio-flamingo-next-think-hf项目地址: https://ai.gitcode.com/hf_mirrors/nvidia/audio-flamingo-next-think-hf创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考