Shortcuts

torchaudio.models.wav2vec2.utils.import_huggingface_model

torchaudio.models.wav2vec2.utils.import_huggingface_model(original: Module) Wav2Vec2Model[source]

Builds Wav2Vec2Model from the corresponding model object of Transformers.

Parameters:

original (torch.nn.Module) – An instance of Wav2Vec2ForCTC from transformers.

Returns:

Imported model.

Return type:

Wav2Vec2Model

Example
>>> from torchaudio.models.wav2vec2.utils import import_huggingface_model
>>>
>>> original = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
>>> model = import_huggingface_model(original)
>>>
>>> waveforms, _ = torchaudio.load("audio.wav")
>>> logits, _ = model(waveforms)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources