Feature Extraction
Transformers
Safetensors
audio_embeddings
audio
custom_code
self-supervised-learning
audio-embeddings
best-rq-2
audioset
Instructions to use ltuncay/BEST-RQ-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ltuncay/BEST-RQ-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ltuncay/BEST-RQ-2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ltuncay/BEST-RQ-2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| import sys | |
| import os | |
| # Add src to path | |
| sys.path.append(os.path.abspath("src")) | |
| from data.audioset_datamodule import AudioSetDataModule | |
| def verify_data(): | |
| print("Initializing DataModule...") | |
| dm = AudioSetDataModule( | |
| data_dir="data/AudioSet", | |
| batch_size=4, | |
| num_workers=0, # Use 0 for debugging | |
| target_sample_rate=32000, | |
| ) | |
| dm.setup() | |
| print(f"Train dataset size: {len(dm.train_dataset)}") | |
| print(f"Val dataset size: {len(dm.val_dataset)}") | |
| print("Fetching a batch...") | |
| loader = dm.train_dataloader() | |
| batch = next(iter(loader)) | |
| waveform = batch["waveform"] | |
| target = batch["target"] | |
| audio_name = batch["audio_name"] | |
| index = batch["index"] | |
| print(f"Waveform shape: {waveform.shape}") | |
| print(f"Target shape: {target.shape}") | |
| print(f"Audio names: {audio_name}") | |
| print(f"Indices: {index}") | |
| assert waveform.ndim == 3, "Waveform should be [B, C, T]" | |
| assert waveform.shape[1] == 1, "Channel dim should be 1" | |
| assert waveform.shape[2] == 320000, "Time dim should be 320000" | |
| print("Verification successful!") | |
| if __name__ == "__main__": | |
| verify_data() | |