__init__(): incompatible constructor arguments. The following argument types are supported: 1. ctranslate2._ext.Whisper
This is an issue encountered when using the pyvideotrans software, typically occurring after installing from source and pulling the latest code from GitHub.
Problem Analysis
The error message is: __init__(): incompatible constructor arguments. The following argument types are supported: 1. ctranslate2._ext.Whisper
Interpretation: Simply put, the code is incompatible with the version of the ctranslate2
library you have installed.
The most common reasons are:
- Version Mismatch: The code uses a newer version of
faster-whisper
that mismatches the version actually installed in your environment. You need to update the relevant dependencies. - Outdated or Incomplete Model File: The corresponding model file in the
models
folder needs to be deleted.
Solutions
Please try the following steps one by one. Usually, the first or second step will solve the problem.
Solution 1: Update Core Dependency Libraries
This is the most likely solution. Navigate to the project directory, activate the virtual environment you created during installation, and then execute the following command:
Update faster-whisper
pip install --upgrade faster-whisper
or pip3 install --upgrade faster-whisper
Recommendation: After updating, completely close the program and then restart it before trying again.
Solution 2: Delete Old Models and Let the Program Re-download Them
If the problem persists after updating the library, it might be an issue with the model file itself.
- In the
models
folder within the program's root directory, delete the specific model or model folder you are using. - Restart the program and select that model. The program will automatically re-download and convert it, using your currently installed libraries to ensure format compatibility.
Solution 3: Check CUDA Environment (If Solutions 1 and 2 Fail)
- Try unchecking "Enable CUDA?" and run in CPU mode. If this works, the problem is related to the GPU.
- If you confirm it's a GPU issue, ensure your NVIDIA driver and CUDA Toolkit versions are compatible with the versions supported by
ctranslate2
. Typically, updatingctranslate2
(as in Solution 1) will install a version that supports your current CUDA environment.
Solution 4: Reinstall
If none of the above methods work, your environment configuration might be messy. The most thorough solution is:
pip install --force-reinstall -r requirements.txt