Instructions to use facebook/hubert-large-ls960-ft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/hubert-large-ls960-ft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="facebook/hubert-large-ls960-ft")# Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("facebook/hubert-large-ls960-ft") model = AutoModelForCTC.from_pretrained("facebook/hubert-large-ls960-ft") - Notebooks
- Google Colab
- Kaggle
How to get embeddings using hubert model
Example code:
import torch from transformers
import Wav2Vec2Processor, HubertForCTC
from datasets import load_dataset
processor = Wav2Vec2Processor.from_pretrained("facebook/hubert-large-ls960-ft")
model = HubertForCTC.from_pretrained("facebook/hubert-large-ls960-ft")
input_values = processor('array from audio file., return_tensors="pt").input_values
How to get embeddings after this ? There is no last hidden state in the model .
Hi, the above code snippet only passes the raw inputs to the processor (processor) to get the model input input_values .
You will have to load the model, and pass the inputs input_values (along others maybe) to the loaded model.
yes , i mean after that , we can only get logits as that is the only key but how to get embeddings .
Hi @pulkitmehtawork Could you try adding output_hidden_states=True either in the loaded model config , or during the call to the model?
Let me know if you need more info about how to do this.