|
--- |
|
license: apache-2.0 |
|
language: |
|
- th |
|
- en |
|
pipeline_tag: text-generation |
|
library_name: transformers |
|
tags: |
|
- chat |
|
- audio |
|
--- |
|
|
|
# Pathumma-Audio |
|
|
|
## Model Description |
|
**Pathumma-llm-audio-1.0.0** is a 8 billion parameter Thai large language model designed for audio understanding tasks. The model can process multiple types of audio inputs including **speech, general audio, and music**, convering them into text output. |
|
|
|
## Model Architecture |
|
The model combines two key components: |
|
- 1. Base Language Model: [OpenThaiLLM-DoodNiLT-V1.0.0-Beta-7B](https://huggingface.co/nectec/OpenThaiLLM-DoodNiLT-V1.0.0-Beta-7B) (Qwen2) |
|
- 2. Base Speech Encoder: [Pathumma-whisper-th-large-v3](https://huggingface.co/nectec/Pathumma-whisper-th-large-v3) (Whisper) |
|
|
|
## Quickstart |
|
To load the model and generate responses using the Hugging Face Transformers library, follow the steps below. |
|
|
|
#### 1. Install the required dependencies: |
|
Make sure you have the necessary libraries installed by running: |
|
```shell |
|
pip install librosa torch transformers peft |
|
``` |
|
#### 2. Load the model and generate a response: |
|
You can load the model and use it to generate a response with the following code snippet: |
|
```python |
|
import torch |
|
import librosa |
|
from transformers import AutoModel |
|
|
|
device = "cuda" |
|
|
|
model = AutoModel.from_pretrained( |
|
"nectec/Pathumma-llm-audio-1.0.0", |
|
torch_dtype=torch.bfloat16, |
|
lora_infer_mode=True, |
|
init_from_scratch=True, |
|
trust_remote_code=True |
|
) |
|
model = model.to(device) |
|
|
|
prompt = "ช่วยถอดความเสียงนี้ให้หน่อย" |
|
audio_path = "audio_path.wav" |
|
audio, sr = librosa.load(audio_path, sr=16000) |
|
|
|
model.eval() |
|
with torch.no_grad(): |
|
response = model.generate( |
|
raw_wave=audio, |
|
prompts=prompt, |
|
device=device, |
|
max_new_tokens=200, |
|
repetition_penalty=1.0, |
|
) |
|
print(response[0]) |
|
``` |
|
## Limitations |
|
More information needed |
|
|
|
## Citation |
|
More information needed |
|
|
|
## Acknowledgements |
|
We are grateful to ThaiSC, also known as NSTDA Supercomputer Centre, for providing the LANTA that was utilised for model training and finetuning. Additionally, we would like to express our gratitude to the SALMONN team for making their code publicly available, and to Typhoon Audio at SCB 10X for making available the huggingface project, source code, and technical paper, which served as a valuable guide for us. Many other open-source projects have contributed valuable information, code, data, and model weights; we are grateful to them all. |
|
|
|
## Pathumma Audio Team |
|
*Pattara Tipkasorn*, Wayupuk Sommuang, Oatsada Chatthong, *Kwanchiva Thangthai* |