Files changed (1) hide show
  1. README.md +71 -156
README.md CHANGED
@@ -3,46 +3,46 @@ library_name: transformers
3
  tags: []
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
 
9
 
 
10
 
 
 
 
 
 
 
11
 
12
- ## Model Details
13
 
14
- ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
 
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
- ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
  ```python
45
-
46
  from datasets import load_dataset
47
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
48
 
@@ -58,13 +58,12 @@ model = AutoModelForSpeechSeq2Seq.from_pretrained(
58
  trust_remote_code=True,
59
  )
60
 
61
- prompt = "Can you please turn this audio into text format?"
 
62
  conversation = [
63
- {
64
- "role": "user",
65
- "content": f"Given the following audio context: <SpeechHere>\n\nText instruction: {prompt}"
66
- }
67
  ]
 
68
  chat_prompt = processor.tokenizer.apply_chat_template(
69
  conversation=conversation,
70
  tokenize=False,
@@ -73,141 +72,75 @@ chat_prompt = processor.tokenizer.apply_chat_template(
73
 
74
  libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
75
  audio_array = libri_data[0]["audio"]["array"]
76
-
77
- inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=20)
78
 
79
  outputs = model.generate(**inputs, max_new_tokens=128)
80
-
81
- print(processor.decode(outputs[0, inputs['input_ids'].size(1):], skip_special_tokens=True))
82
-
83
  ```
84
 
85
- ### Downstream Use [optional]
86
-
87
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
88
 
89
- [More Information Needed]
90
 
91
- ### Out-of-Scope Use
92
-
93
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
94
 
95
- [More Information Needed]
96
 
97
- ## Bias, Risks, and Limitations
 
 
 
 
 
 
 
 
98
 
99
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
100
 
101
- [More Information Needed]
 
 
 
102
 
103
- ### Recommendations
 
 
 
 
104
 
105
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
 
106
 
107
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
 
108
 
109
- ## How to Get Started with the Model
110
 
111
- Use the code below to get started with the model.
112
 
113
- [More Information Needed]
114
 
115
- ## Training Details
116
 
117
  ### Training Data
118
 
119
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
120
-
121
- [More Information Needed]
122
-
123
- ### Training Procedure
124
-
125
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
126
-
127
- #### Preprocessing [optional]
128
-
129
- [More Information Needed]
130
-
131
-
132
- #### Training Hyperparameters
133
-
134
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
135
-
136
- #### Speeds, Sizes, Times [optional]
137
-
138
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
139
-
140
- [More Information Needed]
141
-
142
- ## Evaluation
143
 
144
- <!-- This section describes the evaluation protocols and provides the results. -->
145
 
146
- ### Testing Data, Factors & Metrics
147
 
148
- #### Testing Data
149
 
150
- <!-- This should link to a Dataset Card if possible. -->
151
-
152
- [More Information Needed]
153
-
154
- #### Factors
155
-
156
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
157
-
158
- [More Information Needed]
159
-
160
- #### Metrics
161
-
162
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
163
-
164
- [More Information Needed]
165
-
166
- ### Results
167
-
168
- [More Information Needed]
169
-
170
- #### Summary
171
-
172
-
173
-
174
- ## Model Examination [optional]
175
-
176
- <!-- Relevant interpretability work for the model goes here -->
177
-
178
- [More Information Needed]
179
-
180
- ## Environmental Impact
181
-
182
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
183
-
184
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
185
-
186
- - **Hardware Type:** [More Information Needed]
187
- - **Hours used:** [More Information Needed]
188
- - **Cloud Provider:** [More Information Needed]
189
- - **Compute Region:** [More Information Needed]
190
- - **Carbon Emitted:** [More Information Needed]
191
-
192
- ## Technical Specifications [optional]
193
-
194
- ### Model Architecture and Objective
195
-
196
- [More Information Needed]
197
-
198
- ### Compute Infrastructure
199
-
200
- [More Information Needed]
201
-
202
- #### Hardware
203
-
204
- [More Information Needed]
205
-
206
- #### Software
207
-
208
- [More Information Needed]
209
-
210
- ## Citation [optional]
211
 
212
  <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
213
 
@@ -217,22 +150,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
217
 
218
  **APA:**
219
 
220
- [More Information Needed]
221
-
222
- ## Glossary [optional]
223
-
224
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
225
-
226
- [More Information Needed]
227
-
228
- ## More Information [optional]
229
-
230
- [More Information Needed]
231
-
232
- ## Model Card Authors [optional]
233
-
234
- [More Information Needed]
235
-
236
- ## Model Card Contact
237
-
238
  [More Information Needed]
 
3
  tags: []
4
  ---
5
 
6
+ # MERaLiON
7
 
8
+ 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-LIONv3 text decoder, MERaLiON-AudioLLM is finetuned on **260,000 hours of speech and audio data**, **8 various tasks**, to address the diverse linguistic nuances
9
+ of Singapore's local accents and dialects.
10
 
11
+ MERaLiON stands for <i>Multimodal Empathetic Reasoning and Learning in One Network</i>.
12
 
13
+ - **Developed by:** I<sup>2</sup>R, A\*STAR
14
+ - **Funded by:** Singapore NRF
15
+ - **Model type:** MultiModal LLM
16
+ - **Language(s) (Speech):** English (Global & Singapore)
17
+ - **Language(s) (NLP):** English, Chinese, Vietnamese, Indonesian, Thai, Filipino, Tamil, Malay, Khmer, Lao, Burmese, Javanese, Sundanese
18
+ - **License:** [TBC]
19
 
20
+ For more details, please refer to our [report]().
21
 
22
+ ## Model Description
23
 
24
+ MERaLiON-AudioLLM is designed to take in an audio-text pair as
25
+ input and generates a text output.
26
 
27
+ 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.
28
 
29
+ 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.
 
 
 
 
 
 
30
 
31
+ ## Capabilities
32
 
33
+ 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).
34
 
35
+ [More information about the 8 tasks and evaluation results]
 
 
36
 
37
  ## Uses
38
 
39
+ 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.
40
 
41
+ **NOTE** This model has not been trained to use a system prompt or to use tool calling.
42
 
43
+ ### Inference
44
 
45
  ```python
 
46
  from datasets import load_dataset
47
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
48
 
 
58
  trust_remote_code=True,
59
  )
60
 
61
+ prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
62
+ query = "Can you please turn this audio into text format?"
63
  conversation = [
64
+ {"role": "user", "content": prompt.format(query=query)}
 
 
 
65
  ]
66
+
67
  chat_prompt = processor.tokenizer.apply_chat_template(
68
  conversation=conversation,
69
  tokenize=False,
 
72
 
73
  libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
74
  audio_array = libri_data[0]["audio"]["array"]
75
+ inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=30)
 
76
 
77
  outputs = model.generate(**inputs, max_new_tokens=128)
78
+ generated_ids = outputs[:, inputs['input_ids'].size(1):]
79
+ response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
 
80
  ```
81
 
82
+ ### Batch Inference
 
 
83
 
84
+ MERaLiON-AudioLLM also supports batch inference.
85
 
86
+ ```python
87
+ from datasets import load_dataset
88
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
89
 
90
+ repo_id = "MERaLiON/AudioLLM"
91
 
92
+ processor = AutoProcessor.from_pretrained(
93
+ repo_id,
94
+ trust_remote_code=True,
95
+ )
96
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
97
+ repo_id,
98
+ use_safetensors=True,
99
+ trust_remote_code=True,
100
+ )
101
 
102
+ prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
103
+ transcribe_query = "Can you please turn this speech into text format?"
104
+ translate_query = "Can you please translate this speech into written Chinese?"
105
 
106
+ conversation = [
107
+ [{"role": "user", "content": prompt.format(query=transcribe_query)}],
108
+ [{"role": "user", "content": prompt.format(query=translate_query)}],
109
+ ]
110
 
111
+ chat_prompt = processor.tokenizer.apply_chat_template(
112
+ conversation=conversation,
113
+ tokenize=False,
114
+ add_generation_prompt=True
115
+ )
116
 
117
+ libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
118
+ audio_array = [libri_data[0]["audio"]["array"]]*2
119
+ inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=30)
120
 
121
+ outputs = model.generate(**inputs, max_new_tokens=128)
122
+ generated_ids = outputs[:, inputs['input_ids'].size(1):]
123
+ response = processor.batch_decode(generated_ids, skip_special_tokens=True)
124
+ ```
125
 
126
+ ## Bias, Risks, and Limitations
127
 
128
+ 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.
129
 
 
130
 
131
+ ## Technical Specifications
132
 
133
  ### Training Data
134
 
135
+ 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
+ ### Compute and Infrastructure
138
 
139
+ 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.
140
 
141
+ 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.
142
 
143
+ ## Citation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
146
 
 
150
 
151
  **APA:**
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  [More Information Needed]