Create configuration_hubert_kmeans.py
Browse files
configuration_hubert_kmeans.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""HuBERT K-means configuration"""
|
| 2 |
+
|
| 3 |
+
from transformers import PretrainedConfig
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class HubertKmeansConfig(PretrainedConfig):
|
| 7 |
+
"""Configuration class for HuBERT K-means Quantizer."""
|
| 8 |
+
|
| 9 |
+
model_type = "hubert_kmeans"
|
| 10 |
+
|
| 11 |
+
def __init__(
|
| 12 |
+
self,
|
| 13 |
+
hubert_model_name: str = "facebook/hubert-base-ls960",
|
| 14 |
+
n_clusters: int = 200,
|
| 15 |
+
layer: int = 5, # Which HuBERT layer to use (0-indexed, so 5 = 6th layer)
|
| 16 |
+
sample_rate: int = 16000,
|
| 17 |
+
freeze_hubert: bool = True,
|
| 18 |
+
**kwargs
|
| 19 |
+
):
|
| 20 |
+
super().__init__(**kwargs)
|
| 21 |
+
self.hubert_model_name = hubert_model_name
|
| 22 |
+
self.n_clusters = n_clusters
|
| 23 |
+
self.layer = layer
|
| 24 |
+
self.sample_rate = sample_rate
|
| 25 |
+
self.freeze_hubert = freeze_hubert
|