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)# pip install -U transformers accelerate # 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
Download audio-embeddings/scripts/inspect_data.py from ltuncay/BEST-RQ-2: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/ltuncay/BEST-RQ-2/resolve/main/audio-embeddings/scripts/inspect_data.py
- Command line
-
hf download hf://ltuncay/BEST-RQ-2/audio-embeddings/scripts/inspect_data.py
-
curl -L -o inspect_data.py https://huggingface.co/ltuncay/BEST-RQ-2/resolve/main/audio-embeddings/scripts/inspect_data.py
1.28 kB
| import h5py | |
| import pandas as pd | |
| import os | |
| data_dir = "data/AudioSet" | |
| h5_path = os.path.join(data_dir, "balanced_train_soxrhq.h5") | |
| csv_path = os.path.join(data_dir, "silent_files_balanced_train_soxrhq.csv") | |
| print(f"Inspecting {h5_path}...") | |
| try: | |
| with h5py.File(h5_path, "r") as f: | |
| print("Keys:", list(f.keys())) | |
| # Inspect the first few items if it's a group or dataset | |
| for key in list(f.keys())[:5]: | |
| item = f[key] | |
| if isinstance(item, h5py.Dataset): | |
| print(f"Dataset {key}: shape={item.shape}, dtype={item.dtype}") | |
| elif isinstance(item, h5py.Group): | |
| print(f"Group {key}: keys={list(item.keys())}") | |
| # Go one level deeper | |
| for subkey in list(item.keys())[:3]: | |
| subitem = item[subkey] | |
| if isinstance(subitem, h5py.Dataset): | |
| print( | |
| f" Dataset {subkey}: shape={subitem.shape}, dtype={subitem.dtype}" | |
| ) | |
| except Exception as e: | |
| print(f"Error reading HDF5: {e}") | |
| print(f"\nInspecting {csv_path}...") | |
| try: | |
| df = pd.read_csv(csv_path) | |
| print(df.head()) | |
| print(df.columns) | |
| except Exception as e: | |
| print(f"Error reading CSV: {e}") | |