Audio-Text-to-Text
Transformers
Safetensors
English
Korean
fastslm
feature-extraction
audio
text-generation
custom_code
Eval Results
Instructions to use okestro-ai-lab/FastSLM-ASR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use okestro-ai-lab/FastSLM-ASR with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("okestro-ai-lab/FastSLM-ASR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 5,419 Bytes
2ffe972 b84007c 2ffe972 b84007c 2ffe972 d860c1a 2ffe972 7e618bb b14c50b 2ea9e18 678f3d1 2ffe972 d860c1a e7c84f3 9f701ec 0b3affb c59fb3a 0b3affb c59fb3a 2ffe972 013dc57 7ec7ede 2ffe972 a20d3ae 2ffe972 e8daaa3 f0d0998 2ffe972 d860c1a 2ffe972 d860c1a 2ffe972 b84007c 2ffe972 cf86f4c 2ffe972 d860c1a 2ffe972 9f701ec 8353d2a 9f701ec 405e902 9f701ec | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | ---
base_model:
- Qwen/Qwen3-4B
language:
- en
- ko
library_name: transformers
license: apache-2.0
pipeline_tag: audio-text-to-text
tags:
- audio
- text-generation
---
* FastSLM-ASR is an **Automatic Speech Recognition (ASR)-specialized model** designed for efficient and accurate speech-to-text transcription.
<!-- * π **HFQ-Former**: Hierarchically compresses high-frame-rate audio features while preserving the audio's local and global contextual information. -->
<!-- * π **Adaptor**: -->
<!-- * π§ **LLM Adaptation**: Effectively adapts pre-trained Large Language Models (LLMs) to the audio modality. -->
<!-- * **ASR-specialized architecture** tailored for speech recognition tasks
* **Bilingual support (Korean & English)** in a single model -->
## π Model Architecture
π **FastSLM-ASR** is an **Automatic Speech Recognition (ASR)-specialized model** designed for efficient speech-to-text transcription.
> π **Accepted at EMNLP 2026 Findings**
## π Key Features (Safe Version)
* β‘ Efficient long-form speech processing (Processes up to 8 hours of audio on a 40GB GPU)
* π§ Adaptation of pre-trained LLMs to audio
* β
Evaluation results on standard ASR benchmarks (WERs listed above)
* π Text Representation Preservation: Maintains the original LLM's capabilities for text-only tasks via the disable LoRA feature.
<p align="center">
<img src="HTA.png" width="1024" alt="HTA architecture">
</p>
## π Getting Started
### 1. Installation
First, install the required libraries.
```bash
sudo apt install ffmpeg
# pip
torch==2.3.1
peft==0.14.0
librosa==0.11.0
transformers>=4.53.1
accelerate==0.34.2
einops==0.8.1
torchaudio==2.3.1
openai-whisper
soundfile
```
### 2. Load Model and Tokenizer
You can easily load the model using `AutoModelForCausalLM.from_pretrained`. This model includes custom code, so the `trust_remote_code=True` option is required.
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
# β¬
οΈ Enter your Hugging Face repository ID here.
repo_id = "okestro-ai-lab/FastSLM-ASR"
model = AutoModelForCausalLM.from_pretrained(
repo_id,
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(repo_id)
generation_config = GenerationConfig.from_pretrained(repo_id)
model.eval()
```
### 3. Sample Inference (Automatic Speech Recognition)
This example shows how to load an audio file and transcribe it to text.
```python
import torch
import librosa
# 1. Load and resample the audio file
# β¬
οΈ Path to the audio file to be transcribed
wav_path = "sample_audio/English_audio.wav"
wav,sample_rate = librosa.load(wav_path)
# FastSLM-ASR requires 16kHz audio.
if sample_rate != 16000:
audio = librosa.resample(wav,orig_sr=sample_rate,target_sr=16000)
else:
audio = wav
# 2. Prepare the prompt and tokenize the prompt
# Automatic Speech Recognition (ASR) task
# Addiational Tasks: please refer to Supported Tasks
# A task token is not required, but it is recommended for achieving a more appropriate task.
TASK_TOKEN = "<|ASR|>"
AUDIO_TOKEN = "<|audio_bos|><|AUDIO|><|audio_eos|>"
user_prompt = f"{TASK_TOKEN}{AUDIO_TOKEN}
Transcribe the audio clip into text."
prompt = [{"role": "user", "content": user_prompt}]
input_ids = tokenizer.apply_chat_template(
prompt,
add_generation_prompt=True,
tokenize=True,
return_tensors='pt'
).to(model.device)
# 3. Perform inference
# The model's generate function expects the audio input as a list.
audio_tensor = torch.tensor((audio,),dtype=torch.float32).cuda()
with torch.no_grad():
with torch.cuda.amp.autocast(dtype=torch.bfloat16):
output_ids = model.generate(
input_ids=input_ids,
audio=audio_tensor,
generation_config=generation_config,
max_new_tokens=256
)
# 5. Decode the result
transcription = tokenizer.batch_decode(output_ids, skip_special_tokens=True)[0]
print("--- Transcription Result ---")
print(transcription)
```
---
## π Supported Tasks
You can perform different tasks by using the following special tokens in your prompt:
* `<|ASR|>`: **Automatic Speech Recognition** - Transcribes audio into text.
* `<|AST|>`: **Automatic Speech Translation** - Translates audio into text of another language.
* `<|SSUM|>`: **Speech Summarization** - Summarizes the content of an audio clip.
* `<|SQQA|>`: **Spoken Query-based Question Answering** - Answers questions based on the content of an audio clip.
---
## β‘ GPU Requirements
FastSLM-ASR inference requires a GPU with sufficient memory.
| Task | Recommended GPU | Minimum VRAM |
| --------- | ---------------- | --------- |
| **Inference** | NVIDIA A100 / H100 | β₯ 11.8 GB |
> π‘ Using mixed precision (`bfloat16`) is recommended to reduce memory usage.
**Paper:** [FastSLM: Hierarchical Temporal Abstraction for Efficient Long-Form Speech Adaptation](https://huggingface.co/papers/2601.06199)
**Code:** [https://github.com/Lee-junseok1025/FastSLM](https://github.com/Lee-junseok1025/FastSLM)
## π Citation
```bibtex
@inproceedings{lee2026fastslm,
title={FastSLM: Hierarchical Temporal Abstraction for Efficient Long-Form Speech Adaptation},
author={Lee, Junseok and Chun, Chang-Jae},
booktitle={Findings of the Association for Computational Linguistics: EMNLP 2026},
pages={5374--5389},
year={2026}
}
``` |