Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fool-proof guide to succesfully installing ctcdecode on Docker, Google Colab or your own PC #234

Open
RafaelAmauri opened this issue Jan 6, 2025 · 0 comments

Comments

@RafaelAmauri
Copy link

RafaelAmauri commented Jan 6, 2025

This is a fool-proof guide to installing ctcdecode.

I have repeated these steps five times across four different servers running different versions of Linux. I have tested these steps on Ubuntu 20.04, Ubuntu 22.04 and Arch Linux.

The first thing you must have installed on your environment is gcc and g++. ctcdecode is NOT fully written in Python, it is instead a mix of Python and C, and uses gcc/g++ to compile the C code in a way that Python can understand. Because of this, make sure you have gcc, g++ and the libs for compiling code installed on your system.

For Ubuntu, run:

apt update -y
apt install gcc g++ build-essential

Selection_001

Now, install conda (pip unfortunately did not work for me no matter how much I tried using it. Conda worked every time I repeated the installation process) and then run:

conda create -n [your environment's name]
conda install -n [your environment's name] -y pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
conda install -n [your environment's name] python=3.9

Now, run enter your new conda environment with

conda activate [your environment's name]

and run

python3 -c "import torch;print(torch.__version__)"

You should get 1.13.1 as a result.

Selection_002

If you got this far, you should be ready to install ctcdecode. To do that, simply run

cd ctcdecode; pip install .

And it should install without problems.

Selection_003

You can verify that it was successfully installed with

python3 -c "import ctcdecode;ctc = ctcdecode.CTCBeamDecoder(\"test\", beam_width=10, blank_id=\"test\");print(ctc)"

If you got <ctcdecode.CTCBeamDecoder object at 0x7fdadc664f10> it means that ctc is successfully installed!

Selection_004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant