Yingxu He
Upload config
30951e5 verified
|
raw
history blame
6.84 kB
metadata
library_name: transformers
license: mit
metrics:
  - bleu
  - wer
pipeline_tag: audio-text-to-text
tags:
  - LLM-as-a-Judge
  - chat
  - audio

MERaLiON

MERaLiON-AudioLLM is a Speech-Text Large Language Model tailored for Singapore’s multilingual and multicultural landscape. Integrating a localised Whisper-large-v2 speech encoder and SEA-LION V3 text decoder, MERaLiON-AudioLLM is finetuned on 260,000 hours of speech and audio data, 8 various tasks, to address the diverse linguistic nuances of Singapore's local accents and dialects.

MERaLiON stands for Multimodal Empathetic Reasoning and Learning in One Network.

  • Developed by: I2R, A*STAR
  • Funded by: Singapore NRF
  • Model type: MultiModal LLM
  • Language(s) (Speech): English (Global & Singapore)
  • Language(s) (NLP): English, Chinese, Vietnamese, Indonesian, Thai, Filipino, Tamil, Malay, Khmer, Lao, Burmese, Javanese, Sundanese
  • License: MIT

For more details, please refer to our report.

Model Description

MERaLiON-AudioLLM is designed to take in an audio-text pair as input and generates a text output.

The architecture comprises three key components: an audio encoder that transforms speech or audio inputs into sequences of vector representations, a text decoder that interprets and responds to natural language instructions, and an adaptor module that compresses the encoder representations while aligning the encoder’s hidden dimension with the text decoder’s embedding size.

Specifically, we fine-tuned the MERaLiON-Whisper encoder from Whisper-large-v2 for the audio encoder and used SEA-LION V3, a localised LLM developed by our partner AI Singapore as the text decoder.

model_architecture

Capabilities

MERaLiON-AudioLLM is trained to address 8 tasks, including Automatic Speech Recognition (ASR), Speech Translation (ST), Spoken Question Answering (SQA), Spoken Dialogue Summarization (SDS), Speech Instruction (SI), Paralinguistics (PARA), Audio Captioning (AC), and Audio Scene Question Answering (ASQA).

[More information about the 8 tasks and evaluation results]

Uses

Here we provide a code snippet illustrating the process of loading both the processor and model, alongside detailed instructions on executing the MERaLiON-AudioLLM model for content generation.

NOTE This model has not been trained to use a system prompt or to use tool calling.

Inference

from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor

repo_id = "MERaLiON/AudioLLM"

processor = AutoProcessor.from_pretrained(
    repo_id, 
    trust_remote_code=True,
    )
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    repo_id,
    use_safetensors=True,
    trust_remote_code=True,
)

prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
query = "Can you please turn this audio into text format?"
conversation = [
    {"role": "user", "content": prompt.format(query=query)}
]

chat_prompt = processor.tokenizer.apply_chat_template(
    conversation=conversation,
    tokenize=False,
    add_generation_prompt=True
)

libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
audio_array = libri_data[0]["audio"]["array"]
inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=30)

outputs = model.generate(**inputs, max_new_tokens=128)
generated_ids = outputs[:, inputs['input_ids'].size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]

Batch Inference

MERaLiON-AudioLLM also supports batch inference.

from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor

repo_id = "MERaLiON/AudioLLM"

processor = AutoProcessor.from_pretrained(
    repo_id, 
    trust_remote_code=True,
    )
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    repo_id,
    use_safetensors=True,
    trust_remote_code=True,
)

prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
transcribe_query = "Can you please turn this speech into text format?"
translate_query = "Can you please translate this speech into written Chinese?"

conversation = [
    [{"role": "user", "content": prompt.format(query=transcribe_query)}],
    [{"role": "user", "content": prompt.format(query=translate_query)}],
]

chat_prompt = processor.tokenizer.apply_chat_template(
    conversation=conversation,
    tokenize=False,
    add_generation_prompt=True
)

libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
audio_array = [libri_data[0]["audio"]["array"]]*2
inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=30)

outputs = model.generate(**inputs, max_new_tokens=128)
generated_ids = outputs[:, inputs['input_ids'].size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True)

Bias, Risks, and Limitations

The current MERaLiON-AudioLLM has not been aligned for safety. Developers and users should perform their own safety fine-tuning and related security measures. In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights and codes.

Technical Specifications

Training Data

MERaLiON-AudioLLM is trained on a diverse collection of publicly available datasets, alongside synthesised and augmented samples carefully curated by the team and native speakers, totaling 260,000 hours of audio.

Compute and Infrastructure

MERaLiON-AudioLLM is trained on the ASPIRE 2A+ Supercomputer Cluster, provided by the National Supercomputing Centre (NSCC). ASPIRE 2A+ cluster provides multiple H100 nodes, with each compute node equipped with 8 Nvidia H100 GPUs, 2 TB of RAM, and 30 TB of locally attached NVMe storage. These nodes are interconnected via a rail-optimised, full fat-tree topology, utilising 400 Gb/s NDR InfiniBand cables. Additionally, the cluster incorporates a 2.5 PB SSD-based Lustre file system, linked to the H100 nodes through high-speed InfiniBand connections.

With a global batch size of 640, we train the current release of MERaLiON-AudioLLM for around 200k steps, which took 2 days to complete using 16 nodes, 128 H100 GPUs.

Citation

BibTeX:

[More Information Needed]

APA:

[More Information Needed]