Views
No views yet

pip install -r requirements.txt. For conda, run the following:1cd Mellow && \
2conda create -n mellow python=3.10.14 && \
3conda activate mellow && \
4pip install -r requirements.txtpython example.pyconfig: The option supported is "v0"model: The option supported is "v0" and "v0_s". The "v0_s" is trained on more audios i.e. scaled version of "v0"examples: List of examples. Each example is a list containing three entries: audiopath1, audiopath2, promptgenerate: Produces text response for the given audio inputs and text prompt1import torch
2from pathlib import Path
3import os
4from mellow import MellowWrapper
5
6# setup cuda and device
7cuda = torch.cuda.is_available()
8device = 0 if cuda else "cpu"
9
10# setup mellow
11mellow = MellowWrapper(
12 config="v0",
13 model = "v0",
14 device=device,
15 use_cuda=cuda,
16 )
17
18# pick up audio file paths
19parent_path = Path(os.path.realpath(__file__)).parent
20path1 = os.path.join(parent_path, "resource", "1.wav")
21path2 = os.path.join(parent_path, "resource", "2.wav")
22
23# list of filepaths and prompts
24examples = [
25 [path1, path2, "what can you infer about the surroundings from the audio?"],
26 [path1, path2, "is there a cat in the audio? answer yes or no"],
27 [path1, path2, "caption the audio."]
28 [path1, path2, "Based on the audio, what can be said about the hypothesis - \"A farmer is giving a tour of his ranch while chickens roam nearby\"? a) It is definitely true b) It is definitely false c) It is plausible d) I cannot determine"],
29 [path1, path2, "explain the difference between the two audios in detail."],
30 [path1, path2, "what is the primary sound event present in the clip? a) dog barking b) chirping birds c) car engine d) clapping"],
31]
32
33# generate response
34response = mellow.generate(examples=examples, max_len=300, top_p=0.8, temperature=1.0)
35print(f"\noutput: {response}")
1[
2 {
3 "taskname": "audiocaps",
4 "filepath1": "AudioCapsLarger/test/Y6BJ455B1aAs.wav",
5 "filepath2": "AudioCapsLarger/test/YZsf2YvJfCKw.wav",
6 "caption1": "A rocket flies by followed by a loud explosion and fire crackling as a truck engine runs idle",
7 "caption2": "Water trickling followed by a toilet flushing then liquid draining through a pipe",
8 "input": "explain the difference in few words",
9 "answer": "Audio 1 features a sudden, intense sonic event (rocket explosion) with high-frequency crackling (fire) and a steady, low-frequency hum (truck engine), whereas Audio 2 consists of gentle, mid-frequency water sounds (trickling, flushing, and draining).",
10 "subtype": "ACD-1.json"
11 },
12 ...
13]taskname: indicates the dataset. The two options are "audiocaps" or "clothov21"filepath1: the first audio file pathfilepath2: the second audio file path. This is empty for all tasks except for the audio difference explanation taskcaption1: the ground truth caption for the first audiocaption2: the ground truth caption for the second audio. This is empty for all tasks except for the audio difference explanation taskinput: the input question or prompt to the modelanswer: the answer or response for the given inputsubtype: the type of question or prompt. The type matches the first column in the reasonaqa image above. The options are - "ACD-1.json", "CLE.json", "AudioCaps.json", and more.@misc{mellow,
title={Mellow: a small audio language model for reasoning},
author={Soham Deshmukh and Satvik Dixit and Rita Singh and Bhiksha Raj},
year={2025},
eprint={2503.08540},
archivePrefix={arXiv},
primaryClass={cs.SD},
url={https://arxiv.org/abs/2503.08540},
}