__init__(): incompatible constructor arguments. The following argument types are supported: 1. ctranslate2._ext.Whisper
This issue occurs in the pyvideotrans software, typically when installing from source code 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 a certain version of the ctranslate2 library.
Most common causes:
- Version mismatch: The code uses the latest
faster-whispercode, which is inconsistent with the version actually installed in your environment. You need to update the relevant dependencies. - Outdated or incomplete model files: You need to delete the corresponding model in the
modelsfolder.
Solutions
Try the following steps one by one; usually, the first or second step will resolve the issue.
Solution 1: Update Core Dependencies
This is the most likely solution. Navigate to the project directory, activate the virtual environment created during installation, and 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, then restart it, and try again.
Solution 2: Delete Old Models and Let the Program Redownload
If the issue persists after updating the library, the problem may lie with the model files themselves.
- In the
modelsfolder under the program's root directory, delete the model or model folder you are using. - Restart the program and select the model again. The program will automatically redownload and convert the model, ensuring compatibility with the latest library you have installed.
Solution 3: Check the CUDA Environment (If Solutions 1 and 2 Fail)
- Try unchecking "Enable CUDA?" and run in CPU mode. If this works, the issue is related to the GPU.
- If it's confirmed to be a GPU issue, ensure your NVIDIA driver and CUDA Toolkit versions are compatible with the versions supported by
ctranslate2. Usually, 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 may be very messy. The most thorough solution is:
pip install --force-reinstall -r requirements.txt
