Skip to content

Wav2Vec2ForCTC, Wav2Vec2Processor import problems: tip #1162

Open
@Manamama

Description

@Manamama

Should you run into a version of:

File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/whisperx/alignment.py", line 14, in <module>                       from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor    ImportError: cannot import name 'Wav2Vec2ForCTC' from 'transformers' 

then use this tip: https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/4 and change it in alignment.py, e.g. after compilation, in: nano /data/data/com.termux/files/usr/lib/python3.12/site-packages/whisperx/alignment.py:

..ux/files/usr/lib/python3.12/site-packages/whisperx/alignment.py
  1 """
  2 Forced Alignment with Whisper
  3 C. Max Bain
  4 """
  5 import math
  6
  7 from dataclasses import dataclass
  8 from typing import Iterable, Optional, Union, List
  9
 10 import numpy as np
 11 import pandas as pd
 12 import torch
 13 import torchaudio
 14 from transformers import *

In that line 14 there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions