hubert-base-los-2k
88
960.0B
5 languages
license:apache-2.0
by
BSC-LT
Audio Model
OTHER
960B params
New
88 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
2146GB+ RAM
Mobile
Laptop
Server
Quick Summary
- Model Description - Intended Uses and Limitations - Pre-training Details - Indirect evaluation results - How to use the model - Citation - Additional Informat...
Device Compatibility
Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
895GB+ RAM
Code Examples
Hugginface pre-trained model pathpythontransformers
from datasets import load_dataset, Audio
import torch
from transformers import AutoFeatureExtractor, AutoModel
#Load the dataset
dataset = load_dataset("projecte-aina/ib3_ca_asr", split='train[:1%]', trust_remote_code=True)
#Downsample to 16kHz
dataset = dataset.cast_column("audio", Audio(sampling_rate=16_000))
# Hugginface pre-trained model path
MODEL_NAME = "BSC-LT/hubert-base-los-2k"
# Set device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(f"Using {device} device.")
# Load feature extractor
feature_extractor = AutoFeatureExtractor.from_pretrained(MODEL_NAME)
# Load model
model = AutoModel.from_pretrained(MODEL_NAME)
model = model.to(device)
def map_to_speech_representations(batch):
#Process the dataset
audio = batch["audio"]
input_features = feature_extractor(audio["array"], sampling_rate=audio["sampling_rate"], return_tensors="pt").input_values
input_features = input_features.to(device)
# Extract HuBERT's Speech Representations
with torch.no_grad():
outputs = model(
input_features,
output_hidden_states = True,
)
speech_representations = outputs.last_hidden_state
hidden_states = outputs.hidden_states
batch["speech_representations"] = speech_representations
batch["hidden_states"] = hidden_states
return batch
dataset = dataset.map(map_to_speech_representations)
print(dataset)Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.