Views
No views yet
GGUF quantized models of MERaLiON-2-10B for use with llama.cpp.
File Size Description meralion-10b-decoder-q8_0.gguf9.2 GB Decoder, Q8_0 meralion-10b-decoder-q4_k_m.gguf5.4 GB Decoder, Q4_K_M meralion-10b-mmproj-f16.gguf1.7 GB Whisper encoder + MLP adaptor, fp16
1# llama.cpp b8762 or later (recommended)
2git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
3cmake -B build -DGGML_CUDA=ON
4cmake --build build --target llama-server llama-mtmd-cli -j$(nproc)1git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
2curl -L "https://huggingface.co/MERaLiON/MERaLiON-2-10B-GGUF/resolve/main/llama_cpp_meralion.patch" | git apply
3cmake -B build -DGGML_CUDA=ON
4cmake --build build --target llama-server llama-mtmd-cli -j$(nproc)1llama-mtmd-cli \
2 -m meralion-10b-decoder-q8_0.gguf \
3 --mmproj meralion-10b-mmproj-f16.gguf \
4 --audio input.wav \
5 -p "Instruction: Please transcribe this speech.\nFollow the text instruction based on the following audio: <__media__>" \
6 -ngl 991llama-server \
2 -m meralion-10b-decoder-q8_0.gguf \
3 --mmproj meralion-10b-mmproj-f16.gguf \
4 --port 8090 -ngl 99 --host 0.0.0.01curl http://localhost:8090/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{"messages":[{"role":"user","content":[
4 {"type":"text","text":"Instruction: Please transcribe this speech.\nFollow the text instruction based on the following audio: "},
5 {"type":"input_audio","input_audio":{"data":"<base64_wav>","format":"wav"}}
6 ]}], "temperature":0.0}'1# CLI
2llama-mtmd-cli ... --dry-multiplier 1.0 --dry-allowed-length 1
3
4# Server (add to request body)
5"dry_multiplier": 1.0, "dry_allowed_length": 1whisper-large-v3 on speech recognition tasks. This enhancement spans Singapore's 4 official languages—English, Mandarin, Malay, and Tamil—as well as 3 South-East Asian languages: Indonesian, Thai, and Vietnamese. The model also demonstrates robust handling of code-switching scenarios and local colloquialisms, reflecting its adaptability to Singapore's diverse linguistic landscape.Whisper-large-v3. The following table shows the average transcription Word Error Rate by language. The Private Dataset includes a collection of Singapore's locally accented speeches with code-switch. Please visit AudioBench benchmark for dataset-level evaluation results.| Language | MERaLiON-2-10B-ASR | MERaLiON-2-10B | MERaLiON-2-3B | whisper_large_v3 |
|---|---|---|---|---|
| Thai | 0.096526 | 0.109365 | 0.107279 | 0.121073 |
| Tamil | 0.271279 | 0.327081 | 0.344081 | 0.441483 |
| Singlish | 0.129830 | 0.168813 | 0.180395 | 0.248945 |
| Malay | 0.194638 | 0.209074 | 0.279891 | 0.219692 |
| English | 0.078544 | 0.088259 | 0.122295 | 0.080841 |
| Indonesian | 0.121020 | 0.142813 | 0.131950 | 0.137102 |
| Mandarin | 0.103694 | 0.132025 | 0.145878 | 0.170980 |
| Vietnamese | 0.118693 | 0.134808 | 0.155110 | 0.148474 |
| Private Dataset | 0.106150 | 0.112360 | 0.147258 | 0.116630 |
Out of Scope use: This model is not intended for use in tool calling, math, and coding tasks.
transformers version 4.50.11pip install transformers==4.50.1
2pip install librosaInstruction: <TextHere> \nFollow the text instruction based on the following audio: <SpeechHere><TextHere> with your text instruction while leaving the <SpeechHere> untouched.1prompt_template = "Instruction: {query} \nFollow the text instruction based on the following audio: <SpeechHere>"
2
3transcription_prompt = prompt_template.format(query="Please transcribe this speech.")
4translation_prompt = prompt_template.format(query="Please translate the speech into Malay")
5summarization_prompt = prompt_template.format(query="Please summarize this speech")
6audio_captioning_prompt_1 = prompt_template.format(query="Please describe the audio")
7audio_captioning_prompt_2 = prompt_template.format(query="Please create a caption for the audio")
8audio_scene_understanding_prompt = prompt_template.format(query="Is there people crying in the audio?")
9speech_as_instruction_prompt = prompt_template.format(query="Please respond to the audio")
10emotion_recognition_prompt_1 = prompt_template.format(query="What is the emotion of the speaker")
11emotion_recognition_prompt_2 = prompt_template.format(query="Describe the paralinguistics feature of the audio")
12gender_recognition_prompt = prompt_template.format(query="What is the gender of the speaker")1prompt_template = "Instruction: {query} \nFollow the text instruction based on the following audio: <SpeechHere>"
2
3prompt_1 = prompt_template.format(query="describe the paralinguistics feature and return in json format.")
4prompt_2 = prompt_template.format(query="Please summarise the content of the speech and analyse the paralinguistics features of this audio. Return in json format.")
5prompt_3 = prompt_template.format(query="Please translate this speech to Singapore's 4 official languages.")1prompt_1 = """
2Your are MERaLiON-AudioLLM, an empathic AI assistant developed by A*STAR. MERaLiON stands for Multimodal Empathetic Reasoning and Learning in One Network.
3You are a friendly and empathetic conversational partner, and is proficient in understanding human's emotion, accent, and gender from paralinguistic features.
4Maintain a tone that is warm, non-judgmental, and supportive while replying to user.
5
6User's voice: <SpeechHere>
7"""1import librosa
2from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
3
4repo_id = "MERaLiON/MERaLiON-2-10B"
5
6processor = AutoProcessor.from_pretrained(
7 repo_id,
8 trust_remote_code=True,
9 )
10model = AutoModelForSpeechSeq2Seq.from_pretrained(
11 repo_id,
12 use_safetensors=True,
13 trust_remote_code=True,
14)
15
16prompt_template = "Instruction: {query} \nFollow the text instruction based on the following audio: <SpeechHere>"
17transcribe_prompt = "Please transcribe this speech."
18translate_prompt = "Can you please translate this speech into written Chinese?"
19
20# batch inference of 2 samples
21conversation = [
22 [{"role": "user", "content": prompt_template.format(query=transcribe_prompt)}],
23 [{"role": "user", "content": prompt_template.format(query=translate_prompt)}],
24]
25
26chat_prompt = processor.tokenizer.apply_chat_template(
27 conversation=conversation,
28 tokenize=False,
29 add_generation_prompt=True
30)
31
32# Use audio at 16000hz.
33audio_array, sample_rate = librosa.load("/path/to/your/audio/file", sr=16000)
34audio_array = [audio_array]*2
35inputs = processor(text=chat_prompt, audios=audio_array)
36
37# adjust the `max_new_tokens` based on your use case.
38outputs = model.generate(**inputs, max_new_tokens=256)
39generated_ids = outputs[:, inputs['input_ids'].size(1):]
40response = processor.batch_decode(generated_ids, skip_special_tokens=True)1import torch
2import librosa
3from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
4
5repo_id = "MERaLiON/MERaLiON-2-10B"
6device = "cuda"
7
8processor = AutoProcessor.from_pretrained(
9 repo_id,
10 trust_remote_code=True,
11 )
12model = AutoModelForSpeechSeq2Seq.from_pretrained(
13 repo_id,
14 use_safetensors=True,
15 trust_remote_code=True,
16 torch_dtype=torch.bfloat16
17).to(device)
18
19prompt_template = "Instruction: {query} \nFollow the text instruction based on the following audio: <SpeechHere>"
20transcribe_prompt = "Please transcribe this speech."
21translate_prompt = "Can you please translate this speech into written Chinese?"
22
23# batch inference of 2 samples
24conversation = [
25 [{"role": "user", "content": prompt_template.format(query=transcribe_prompt)}],
26 [{"role": "user", "content": prompt_template.format(query=translate_prompt)}],
27]
28
29chat_prompt = processor.tokenizer.apply_chat_template(
30 conversation=conversation,
31 tokenize=False,
32 add_generation_prompt=True
33)
34
35# Use audio at 16000hz.
36audio_array, sample_rate = librosa.load("/path/to/your/audio/file", sr=16000)
37audio_array = [audio_array]*2
38inputs = processor(text=chat_prompt, audios=audio_array)
39
40for key, value in inputs.items():
41 if isinstance(value, torch.Tensor):
42 inputs[key] = inputs[key].to(device)
43
44 if value.dtype == torch.float32:
45 inputs[key] = inputs[key].to(torch.bfloat16)
46
47# adjust the `max_new_tokens` based on your use case.
48outputs = model.generate(**inputs, max_new_tokens=256)
49generated_ids = outputs[:, inputs['input_ids'].size(1):]
50response = processor.batch_decode(generated_ids, skip_special_tokens=True)1@misc{he2024meralionaudiollmtechnicalreport,
2 title={MERaLiON-AudioLLM: Bridging Audio and Language with Large Language Models},
3 author={{MERaLiON Team}},
4 year={2024},
5 eprint={2412.09818},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2412.09818},
9}
10
11@article{wang2024audiobench,
12 title={AudioBench: A Universal Benchmark for Audio Large Language Models},
13 author={Wang, Bin and Zou, Xunlong and Lin, Geyu and Sun, Shuo and Liu, Zhuohan and Zhang, Wenyu and Liu, Zhengyuan and Aw, AiTi and Chen, Nancy F},
14 journal={NAACL},
15 year={2025}
16 }
17
18@article{wang2025advancing,
19 title={Advancing Singlish Understanding: Bridging the Gap with Datasets and Multimodal Models},
20 author={Wang, Bin and Zou, Xunlong and Sun, Shuo and Zhang, Wenyu and He, Yingxu and Liu, Zhuohan and Wei, Chengwei and Chen, Nancy F and Aw, AiTi},
21 journal={arXiv preprint arXiv:2501.01034},
22 year={2025}
23 }
24
25@article{zhang2024mowe,
26 title={MoWE-Audio: Multitask AudioLLMs with Mixture of Weak Encoders},
27 author={Zhang, Wenyu and Sun, Shuo and Wang, Bin and Zou, Xunlong and Liu, Zhuohan and He, Yingxu and Lin, Geyu and Chen, Nancy F and Aw, Ai Ti},
28 journal={ICASSP},
29 year={2025}
30 }
31
32@misc{huang2025meraliontextllmcrosslingualunderstandinglarge,
33 title={MERaLiON-TextLLM: Cross-Lingual Understanding of Large Language Models in Chinese, Indonesian, Malay, and Singlish},
34 author={Xin Huang and Tarun Kumar Vangani and Minh Duc Pham and Xunlong Zou and Bin Wang and Zhengyuan Liu and Ai Ti Aw},
35 year={2025},
36 eprint={2501.08335},
37 archivePrefix={arXiv},
38 primaryClass={cs.CL},
39 url={https://arxiv.org/abs/2501.08335},
40}