Views
No views yet
vllm just runs the original Qwen3 checkpoint, and the ALARM checkpoint is used for extracting LLM input embeddings.
After you cloned the repo and installed the depnedencies, you can run the pretrained model as follows:1# Import libraries
2import os
3os.environ["CUDA_VISIBLE_DEVICES"] = "0" #optional
4
5# run before importing torch because generate_vllm sets the multiprocessing method
6from generate_vllm import get_response
7from src.model.wrapped_llms.qwen3 import Qwen3AudioWrappedFeatureExtractor
8
9from omegaconf import OmegaConf
10from torchaudio.utils import _download_asset
11from torchcodec.decoders import AudioDecoder
12from transformers import AutoTokenizer
13from vllm import LLM
14
15
16# The model configuration config.
17# Handles vllm-related configuration and defines feature extractors,
18# i.e., audio -> encoder input embedding conversion.
19# All other configuration, including model architecture, will be
20# loaded from the checkpoint.
21default_model_config_name = "src/configs/model/default_inference.yaml"
22model_config = OmegaConf.load(default_model_config_name)
23
24# checkpoint_name = which model to run
25# Single model version (no inference-time ensemble):
26# checkpoint_name='Blinorot/AL-Whisper-Instruct-R'
27# ALARM-E embedding fusion-type version (inference-time ensemble):
28# checkpoint_name=["Blinorot/ALARM-CA","Blinorot/AL-Whisper-Instruct-R"]
29checkpoint_name = "Blinorot/AL-W2VBERT2-R"
30
31device = "cuda"
32
33# Load Tokenizer for Text Processing
34tokenizer = AutoTokenizer.from_pretrained(model_config.llm)
35
36# Load ALARM/AL-*-R checkpoints for extraction of LLM input embeddings
37if isinstance(checkpoint_name, list): # ALARM-E-style embedding fusion (inference-time ensemble)
38 feature_extractor_list = []
39 for name in checkpoint_name:
40 # Load weights into the (audio,text)->LLM embeddings converter
41 feature_extractor = Qwen3AudioWrappedFeatureExtractor(
42 model_config=model_config,
43 checkpoint_name=name,
44 tokenizer=tokenizer,
45 )
46 feature_extractor.to(device)
47 feature_extractor_list.append(feature_extractor)
48 feature_extractor = feature_extractor_list
49else: # Single Model version (no inference-time ensemble)
50 # Load weights into the (audio,text)->LLM embeddings converter
51 feature_extractor = Qwen3AudioWrappedFeatureExtractor(
52 model_config=model_config,
53 checkpoint_name=checkpoint_name,
54 tokenizer=tokenizer,
55 )
56 feature_extractor.to(device)
57
58# Start the offline vLLM instance of original Qwen3 RLM
59# Model will be loaded to CUDA_VISIBLE_DEVICES id
60llm = LLM(
61 model_config.llm,
62 enable_prefix_caching=True,
63 max_model_len=model_config.max_model_len,
64 max_num_seqs=model_config.max_num_seq,
65 max_num_batched_tokens=model_config.max_num_batched_tokens,
66 gpu_memory_utilization=model_config.gpu_memory_utilization,
67 enable_prompt_embeds=True,
68)
69
70# Set sampling arguments for the RLM
71sample = llm.get_default_sampling_params()
72sample.seed = model_config.seed
73sample.max_tokens = model_config.max_tokens
74
75# Define audio and prompt
76# Audio must come from torchcodec.AudioDecoder
77audio_example_path = _download_asset("tutorial-assets/ctc-decoding/1688-142285-0007.wav")
78audio = AudioDecoder(audio_example_path)
79prompt = "Describe the audio content."
80
81# Define a system prompt
82system_prompt = "You are an audio-understanding model."
83
84# Obtain response from Audio RLM
85response = get_response(
86 prompts=[prompt], # list of all the prompts
87 audio_list=[audio], # list of corresponding audio
88 llm=llm,
89 feature_extractor=feature_extractor,
90 sample=sample,
91 tokenizer=tokenizer,
92 system_prompt=system_prompt,
93 max_thinking_tokens=model_config.max_thinking_tokens, # controls thinking budget for the RLM
94 debug=False,
95)
96
97# Response is a list of responses, one per each (prompt, audio) input pair
98# We have only one input pair, so the final response is at index 0
99response = response[0]
100
101print(f"Model response:\n\n{response}")1@article{grinberg2026alarm,
2 title={ALARM: Audio-Language Alignment for Reasoning Models},
3 author={Grinberg, Petr and Shahmohammadi, Hassan},
4 journal={arXiv preprint arXiv:2603.09556},
5 year={2026}
6}