hyx_194 commited on
Commit
4a3ea29
·
1 Parent(s): 1c5b098

complete readme draft

Browse files
Files changed (1) hide show
  1. README.md +67 -146
README.md CHANGED
@@ -5,38 +5,44 @@ tags: []
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-V3 and SEA-LIONv3, 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 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 [optional]:** Singapore NRF
15
  - **Model type:** MultiModal LLM
16
- - **Language(s) (Speech):** English (general & Singapore)
17
  - **Language(s) (NLP):** English, Chinese, Vietnamese, Indonesian, Thai, Filipino, Tamil, Malay, Khmer, Lao, Burmese, Javanese, Sundanese
18
- - **License:** MIT
19
 
20
  For more details, please refer to our [report]().
21
 
22
- ## Model Details
23
 
24
- ### Model Description
 
25
 
26
- <!-- Provide a longer summary of what this model is. -->
27
 
 
28
 
 
 
 
 
 
29
 
30
  ## Uses
31
 
32
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
33
 
34
- ### Direct Use
35
 
36
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
37
 
38
  ```python
39
-
40
  from datasets import load_dataset
41
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
42
 
@@ -52,13 +58,12 @@ model = AutoModelForSpeechSeq2Seq.from_pretrained(
52
  trust_remote_code=True,
53
  )
54
 
55
- prompt = "Can you please turn this audio into text format?"
 
56
  conversation = [
57
- {
58
- "role": "user",
59
- "content": f"Given the following audio context: <SpeechHere>\n\nText instruction: {prompt}"
60
- }
61
  ]
 
62
  chat_prompt = processor.tokenizer.apply_chat_template(
63
  conversation=conversation,
64
  tokenize=False,
@@ -67,141 +72,75 @@ chat_prompt = processor.tokenizer.apply_chat_template(
67
 
68
  libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
69
  audio_array = libri_data[0]["audio"]["array"]
70
-
71
- inputs = processor(text=chat_prompt, audios=audio_array, time_duration_limit=20)
72
 
73
  outputs = model.generate(**inputs, max_new_tokens=128)
74
-
75
- print(processor.decode(outputs[0, inputs['input_ids'].size(1):], skip_special_tokens=True))
76
-
77
  ```
78
 
79
- ### Downstream Use [optional]
80
 
81
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
82
 
83
- [More Information Needed]
84
-
85
- ### Out-of-Scope Use
86
-
87
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
88
 
89
- [More Information Needed]
90
 
91
- ## Bias, Risks, and Limitations
 
 
 
 
 
 
 
 
92
 
93
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
94
 
95
- [More Information Needed]
 
 
 
96
 
97
- ### Recommendations
 
 
 
 
98
 
99
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
 
100
 
101
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
 
102
 
103
- ## How to Get Started with the Model
104
 
105
- Use the code below to get started with the model.
106
 
107
- [More Information Needed]
108
 
109
- ## Training Details
110
 
111
  ### Training Data
112
 
113
- <!-- 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. -->
114
-
115
- [More Information Needed]
116
-
117
- ### Training Procedure
118
-
119
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
120
-
121
- #### Preprocessing [optional]
122
-
123
- [More Information Needed]
124
-
125
-
126
- #### Training Hyperparameters
127
-
128
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
129
-
130
- #### Speeds, Sizes, Times [optional]
131
-
132
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
133
-
134
- [More Information Needed]
135
-
136
- ## Evaluation
137
-
138
- <!-- This section describes the evaluation protocols and provides the results. -->
139
-
140
- ### Testing Data, Factors & Metrics
141
-
142
- #### Testing Data
143
-
144
- <!-- This should link to a Dataset Card if possible. -->
145
-
146
- [More Information Needed]
147
-
148
- #### Factors
149
-
150
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
151
-
152
- [More Information Needed]
153
-
154
- #### Metrics
155
-
156
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
157
-
158
- [More Information Needed]
159
-
160
- ### Results
161
-
162
- [More Information Needed]
163
-
164
- #### Summary
165
-
166
-
167
-
168
- ## Model Examination [optional]
169
-
170
- <!-- Relevant interpretability work for the model goes here -->
171
-
172
- [More Information Needed]
173
-
174
- ## Environmental Impact
175
 
176
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
177
 
178
- 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).
179
 
180
- - **Hardware Type:** [More Information Needed]
181
- - **Hours used:** [More Information Needed]
182
- - **Cloud Provider:** [More Information Needed]
183
- - **Compute Region:** [More Information Needed]
184
- - **Carbon Emitted:** [More Information Needed]
185
 
186
- ## Technical Specifications [optional]
187
-
188
- ### Model Architecture and Objective
189
-
190
- [More Information Needed]
191
-
192
- ### Compute Infrastructure
193
-
194
- [More Information Needed]
195
-
196
- #### Hardware
197
-
198
- [More Information Needed]
199
-
200
- #### Software
201
-
202
- [More Information Needed]
203
-
204
- ## Citation [optional]
205
 
206
  <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
207
 
@@ -211,22 +150,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
211
 
212
  **APA:**
213
 
214
- [More Information Needed]
215
-
216
- ## Glossary [optional]
217
-
218
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
219
-
220
- [More Information Needed]
221
-
222
- ## More Information [optional]
223
-
224
- [More Information Needed]
225
-
226
- ## Model Card Authors [optional]
227
-
228
- [More Information Needed]
229
-
230
- ## Model Card Contact
231
-
232
  [More Information Needed]
 
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]