Instructions to use bosonai/hubert_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bosonai/hubert_base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="bosonai/hubert_base", device_map="auto")# Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("bosonai/hubert_base") model = AutoModel.from_pretrained("bosonai/hubert_base", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Add README describing role as semantic teacher in Higgs Audio Tokenizer
Browse files
README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- hubert
|
| 5 |
+
- speech
|
| 6 |
+
- audio
|
| 7 |
+
- feature-extraction
|
| 8 |
+
- higgs-audio
|
| 9 |
+
library_name: transformers
|
| 10 |
+
pipeline_tag: feature-extraction
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Boson AI HuBERT Base
|
| 14 |
+
|
| 15 |
+
A general-purpose HuBERT-Base checkpoint released by Boson AI, used inside the [Higgs Audio Tokenizer](https://github.com/boson-ai/higgs-audio) as the semantic teacher.
|
| 16 |
+
|
| 17 |
+
## What it is
|
| 18 |
+
|
| 19 |
+
- Standard HuBERT-Base architecture (12 transformer layers, hidden size 768, ~95M params)
|
| 20 |
+
- 16 kHz audio input
|
| 21 |
+
- Loadable via `AutoModel` with `trust_remote_code=True`
|
| 22 |
+
- Outputs 768-dim per-layer hidden states (`output_hidden_states=True`)
|
| 23 |
+
|
| 24 |
+
## How it is used in Higgs Audio
|
| 25 |
+
|
| 26 |
+
The Higgs Audio Tokenizer distills semantic features from this HuBERT into its semantic branch. From [`boson_multimodal/audio_processing/higgs_audio_tokenizer.py`](https://github.com/boson-ai/higgs-audio/blob/main/boson_multimodal/audio_processing/higgs_audio_tokenizer.py) (`semantic_techer="hubert_base_general"`):
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from transformers import AutoModel
|
| 30 |
+
|
| 31 |
+
semantic_model = AutoModel.from_pretrained("bosonai/hubert_base", trust_remote_code=True)
|
| 32 |
+
# 16 kHz, 768-dim semantic features, all hidden layers consumed by the tokenizer
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Direct usage
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
import torch
|
| 39 |
+
import torchaudio
|
| 40 |
+
from transformers import AutoModel
|
| 41 |
+
|
| 42 |
+
model = AutoModel.from_pretrained("bosonai/hubert_base", trust_remote_code=True).eval()
|
| 43 |
+
|
| 44 |
+
waveform, sr = torchaudio.load("audio.wav")
|
| 45 |
+
if sr != 16000:
|
| 46 |
+
waveform = torchaudio.functional.resample(waveform, sr, 16000)
|
| 47 |
+
|
| 48 |
+
with torch.no_grad():
|
| 49 |
+
out = model(waveform, output_hidden_states=True)
|
| 50 |
+
|
| 51 |
+
# out.last_hidden_state: (B, T, 768)
|
| 52 |
+
# out.hidden_states: tuple of (B, T, 768) for each of the 13 layers (embedding + 12 transformer blocks)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## License
|
| 56 |
+
|
| 57 |
+
Apache 2.0.
|