I’m trying to use this model to transcribe Youtube videos but my Google Colab instance keeps crashing at that line.  It says I’ve used up all of my memory (even though I’m using the High-RAM setting in Colab).
Here’s my code:
!pip install git+https://github.com/huggingface/transformers
!pip install youtube-dl path.py soundfile librosa sentencepiece torchaudio
import youtube_dl

from path import Path as Path

import tempfile

import textwrap

import librosa

import soundfile as sf

import torch

from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer

tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-base-960h")

model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")

wrapper = textwrap.TextWrapper(width=70)

mydir = tempfile.TemporaryDirectory()

dirname = mydir.name + "/tmp.wav"

print(dirname)

!youtube-dl -o $dirname -ci -f 'bestvideo[ext=mp4]+bestaudio' -x --audio-format wav https://www.youtube.com/watch?v=d5yfUuHYWho

filename = dirname + ".wav"

speech, rate = sf.read(filename)

speech = librosa.resample(speech.T, rate, 16000)

input_values = tokenizer(speech, return_tensors = 'pt').input_values

logits = model(input_values[0]).logits