Views
No views yet
1
2import torch
3import librosa
4from transformers import AutoConfig, AutoModelForAudioClassification, AutoFeatureExtractor
5
6config = AutoConfig.from_pretrained('saurabhati/DASS_small_AudioSet_48.9',trust_remote_code=True)
7audio_model = AutoModelForAudioClassification.from_pretrained('saurabhati/DASS_small_AudioSet_48.9',trust_remote_code=True)
8feature_extractor = AutoFeatureExtractor.from_pretrained('saurabhati/DASS_small_AudioSet_48.9',trust_remote_code=True)
9
10waveform, sr = librosa.load("audio/eval/_/_/--4gqARaEJE_0.000.flac", sr=16000)
11inputs = feature_extractor(waveform,sr, return_tensors='pt')
12
13with torch.no_grad():
14 logits = torch.sigmoid(audio_model(**inputs).logits)
15
16predicted_class_ids = torch.where(logits[0] > 0.5)[0]
17predicted_label = [audio_model.config.id2label[i.item()] for i in predicted_class_ids]
18predicted_label
19['Animal', 'Domestic animals, pets', 'Dog']
20| Params | Pretrain | mAP | |
|---|---|---|---|
| Transformer based models | |||
| AST | 87M | IN SL | 45.9 |
| HTS-AT | 31M | IN SL | 47.1 |
| PaSST | IN SL | 47.1 | |
| Audio-MAE | 86M | SSL | 47.3 |
| BEATS_iter3 | 90M | AS SSL | 48.6 |
| EAT | 88M | AS SSL | 48.6 |
| Concurrent SSM models | |||
| AuM | 26M | IN SL | 39.7 |
| Audio Mamba | 40M | IN SL | 44.0 |
| DASS-Small | 30M | IN SL | 47.2 |
| DASS-Medium | 49M | IN SL | 47.6 |
| DASS-Small (teach: AST + HTS-AT) | 30M | IN SL | 48.6 |
| DASS-Medium (teach: AST + HTS-AT) | 49M | IN SL | 48.9 |
1@article{bhati2024dass,
2 title={DASS: Distilled Audio State Space Models Are Stronger and More Duration-Scalable Learners},
3 author={Bhati, Saurabhchand and Gong, Yuan and Karlinsky, Leonid and Kuehne, Hilde and Feris, Rogerio and Glass, James},
4 journal={arXiv preprint arXiv:2407.04082},
5 year={2024}
6}