Views
No views yet
AudSemThinker-QA is a specialized variant of AudSemThinker, meticulously fine-tuned for audio-based question answering tasks. It integrates a structured reasoning process based on auditory semantics, explicitly analyzing sound-generating agents, physical sound sources, generation mechanisms, and contextual cues.Qwen2.5-Omni-7B multimodal foundation model and is fine-tuned exclusively on the question answering subset of the novel AudSem dataset using Supervised Fine-Tuning (SFT). AudSemThinker-QA generates responses in a three-phase structure: a detailed <thinking> process, a listing of <semantic_elements>, and a concise <answer>.AudSemThinker-QA for audio question answering, you can load it using the transformers library. Ensure you have torch, torchaudio, and soundfile installed.1import soundfile as sf
2from transformers import Qwen2_5OmniThinkerForConditionalGeneration, Qwen2_5OmniProcessor
3from qwen_omni_utils import process_mm_info
4import torchaudio
5
6# default: Load the model on the available device(s)
7model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained(
8 "gijs/audsemthinker",
9 torch_dtype="auto",
10 device_map="auto",
11 trust_remote_code=True
12)
13
14# We recommend enabling flash_attention_2 for better acceleration and memory saving.
15# model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained(
16# "gijs/audsemthinker",
17# torch_dtype="auto",
18# device_map="auto",
19# attn_implementation="flash_attention_2",
20# trust_remote_code=True
21# )
22
23processor = Qwen2_5OmniProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B", trust_remote_code=True)
24
25# Load and preprocess audio
26audio_file = "path/to/your/audio.wav"
27audio_input, sampling_rate = torchaudio.load(audio_file)
28if sampling_rate != processor.feature_extractor.sampling_rate:
29 audio_input = torchaudio.transforms.Resample(
30 orig_freq=sampling_rate,
31 new_freq=processor.feature_extractor.sampling_rate
32 )(audio_input)
33audio_input = audio_input.squeeze().numpy()
34
35# Example question
36question = "What type of sound is present in the audio?"
37user_prompt_text = f"You are given a question and an audio clip. Your task is to answer the question based on the audio clip. First, think about the question and the audio clip and put your thoughts in <think> and </think> tags. Then reason about the semantic elements involved in the audio clip and put your reasoning in <semantic_elements> and </semantic_elements> tags. Then answer the question based on the audio clip, put your answer in <answer> and </answer> tags.\nQuestion: {question}"
38
39# Conversation format
40conversation = [
41 {
42 "role": "system",
43 "content": [
44 {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
45 ],
46 },
47 {
48 "role": "user",
49 "content": [
50 {"type": "audio", "audio": audio_input},
51 {"type": "text", "text": user_prompt_text}
52 ],
53 },
54]
55
56# Preparation for inference
57text = processor.apply_chat_template(conversation, add_generation_prompt=True, tokenize=False)
58audios, images, videos = process_mm_info(conversation, use_audio_in_video=False)
59inputs = processor(
60 text=text,
61 audio=audios,
62 images=images,
63 videos=videos,
64 return_tensors="pt",
65 padding=True
66)
67inputs = inputs.to(model.device).to(model.dtype)
68
69# Inference: Generation of the output
70output_ids = model.generate(**inputs, max_new_tokens=512)
71response = processor.batch_decode(output_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
72print(response[0])
73
74# Expected output format for QA:
75# <think>...detailed reasoning about the audio scene and question...</think>
76# <semantic_elements>...list of identified semantic descriptors...</semantic_elements>
77# <answer>...answer to the question...</answer>AudSemThinker-QA is fine-tuned on the Question Answering (QA) subset of the AudSem dataset. This subset primarily consists of audio-based multiple-choice and open-ended question answering examples, which were synthetically generated from YouTube closed captions through a robust multi-stage pipeline. The AudSem dataset is designed to minimize overlap with existing benchmarks.<think>, <semantic_elements>, and <answer> tags. The loss is computed only on the model completion part (assistant's response).AudSemThinker-QA demonstrates strong performance in question-answering tasks across various audio domains, often outperforming general audio-language models on specific QA benchmarks.AudSemThinker-QA may exhibit trade-offs in performance on other task types (e.g., general audio captioning) compared to models trained on broader datasets.AudSemThinker, its speech understanding capabilities are not a primary focus and may be less developed.AudSem is designed to minimize overlap, the underlying Qwen2.5-Omni pretrained model might have encountered data present in test sets during its initial pretraining.AudSem dataset is primarily sourced from YouTube closed captions. While systematic checks for harmful content (e.g., child abuse, hate speech, sexual content, harassment) were performed and YouTube's community guidelines provide a safeguard, inherent biases or problematic content from the original video sources could potentially be present.AudSemThinker-QA can contribute to positive societal impacts by enhancing audio-language understanding, particularly in question-answering scenarios. This could aid in various applications requiring precise information extraction from audio.1@misc{wijngaard2025audsemthinkerenhancingaudiolanguagemodels,
2 title={AudSemThinker: Enhancing Audio-Language Models through Reasoning over Semantics of Sound},
3 author={Gijs Wijngaard and Elia Formisano and Michele Esposito and Michel Dumontier},
4 year={2025},
5 eprint={2505.14142},
6 archivePrefix={arXiv},
7 primaryClass={cs.SD},
8 url={https://arxiv.org/abs/2505.14142},
9}