conda create -n fasterwhisper python
conda activate fasterwhisper
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
conda install "cudnn>8" -c conda-forgeThen install CTranslate2 into ~/opt:
I needed libiomp5 and couldn't get it to find the Intel MKL include directory (by setting MKLROOT)
sudo apt install libomp5 libomp-devThe official docs say to make a directory called "build" but the setup.py for CTranslate2 looks
for a directory called "lib" or "lib64"... so I changed the name of the directory to "lib".
cd opt
git clone --recursive https://github.com/OpenNMT/CTranslate2.git
cd CTranslate2/
mkdir lib && cd lib
cmake .. -DWITH_CUDA=ON -DWITH_CUDNN=ON -DWITH_MKL=OFF
make -j4
sudo make installThis can now be used to build the Python package
cd python
pip install -r install_requirements.txt
export CTRANSLATE2_ROOT=$HOME/opt/CTranslate2
python setup.py bdist_wheel
pip install dist/*.whlThen add the CTranslate2 library path to the linker path in your bashrc:
echo 'export LD_LIBRARY_PATH=$HOME/opt/CTranslate2/lib:$LD_LIBRARY_PATH' >> ~/.bashrcThen install faster-whisper
cd ~/dev # or wherever
git clone https://github.com/guillaumekln/faster-whisper
cd faster-whisper
pip install transformers
pip install -e .[conversion]Then convert a model (float16 or int8 on GPU respectively) with:
ct2-transformers-converter --model openai/whisper-large-v2 --output_dir whisper-large-v2-ct2 \
--copy_files tokenizer.json --quantization float16
ct2-transformers-converter --model openai/whisper-large-v2 --output_dir whisper-large-v2-ct2-int8 \
--copy_files tokenizer.json --quantization int8_float16