Run this model with HF Jobs

Run patrickvonplaten/wav2vec2_tiny_random_robust on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/patrickvonplaten/wav2vec2_tiny_random_robust. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/patrickvonplaten/wav2vec2_tiny_random_robust on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Test model

To test this model run the following code:

from datasets import load_dataset
from transformers import Wav2Vec2ForCTC
import torchaudio
import torch

ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")

model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2_tiny_random_robust")

def load_audio(batch):
    batch["samples"], _ = torchaudio.load(batch["file"])
    return batch
    
ds = ds.map(load_audio)

input_values = torch.nn.utils.rnn.pad_sequence([torch.tensor(x[0]) for x in ds["samples"][:10]], batch_first=True)

# forward
logits = model(input_values).logits
pred_ids = torch.argmax(logits, dim=-1)

# dummy loss
dummy_labels = pred_ids.clone()
dummy_labels[dummy_labels == model.config.pad_token_id] = 1  # can't have CTC blank token in label
dummy_labels = dummy_labels[:, -(dummy_labels.shape[1] // 4):] # make sure labels are shorter to avoid "inf" loss (can still happen though...)
loss = model(input_values, labels=dummy_labels).loss
Downloads last month
1,835
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train patrickvonplaten/wav2vec2_tiny_random_robust