Building Binaries

I cannot get a binary compile with 0.8.1

  1. Training or just running inference
    Initially, inference (when I can get a compile)
  2. Moziall STT branch/version
    When I go the “git clone” and submodule tensorflow, the VERSION file tells me
    9-alpha something. I went to 0.8.1 release, downloaded the zip and followed
    the tensorflow from there to retrieve a zip.
  3. OS Platform and Distribution (e.g., Linux Ubuntu 18.04)
    Linux - openSuSE Tumbleweed
  4. Python version
    $ python --version
    Python 3.8.5
  5. TensorFlow version
    The version retrieved by the “git submodule tensorflow” or the one referenced
    by the 0.8.1 release github page (I am quite sure that I haven’t crossed over
    since I do a complete purge (rm -rf STT-0.8.1 and similar for git clone)).

I haven’t found older threads that seem to address the binary build topic.

virtualenv -p python3 $HOME/tmp/deepspeech-venv/
source $HOME/tmp/deepspeech-venv/bin/activate
pip3 install deepspeech
curl -LO https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.pbmm
curl -LO https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.scorer
curl -LO https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/audio-0.8.1.tar.gz
tar xvf audio-0.8.1.tar.gz
deepspeech --model deepspeech-0.8.1-models.pbmm --scorer deepspeech-0.8.1-models.scorer --audio audio/2830-3980-0043.wav

… and it produces a good transcript of a 1-minute clip when I change out the audio-file.

I am not familiar with github nor bazel but I have been programming since the 1980’s both professionally and for my own curiosity. My interest in deepspeech is to rough transcribe several hundred, if not a couple of thousand, hours of a radio broadcast and deepspeech has come closest in coherence and accuracy of the systems I have tried.

I have also downloaded the binary native-client package but cannot get a compile of client.cc against this. My goal is to be able to write C code against the library such that I can automate my task. C-code for speed, as I mentioned I have a lot of audio to scan thru.

Thanks for any insight you can give me.

Hi, changed place where I do git checkout and everything seems to have worked with a straight build, not docker.

Here is the script I used to get compile for anyone as baffled as me. Found binaries in the bazel subdirectories.

#!/bin/bash

{
cd $HOME/Projects/DeepSpeech

git clone https://github.com/mozilla/DeepSpeech.git

cd ./DeepSpeech

git submodule sync tensorflow/
git submodule update --init tensorflow/

git checkout v0.8.1

} > git-log.txt 2>&1

echo
echo “Read ““git-log.txt””, then ENTER to continue, CTRL-C abort”
read

cd ./tensorflow

if [ -e ./native_client ] ; then

if [ ! -d ./native_client ] ; then 
    rm ./native_client 
    ln -s ../native_client
fi

else
ln -s …/native_client
fi

./configure
#< … Python … : /usr/bin/python3
#< … Python libs … : default (lib64 option)
#< … OpenCL SYCL … : N
#< … ROCm support … : N
#<… CUDA support … : N
#< … clang … : N
#< … flags … :
#< … Android WORKSPACE … : N

#> Preconfigured Bazel build configs. You can use any of the below by adding “–config=<>” to your build command. See .bazelrc for more details.
#> --config=mkl # Build with MKL support.
#> --config=monolithic # Config for mostly static monolithic build.
#> --config=ngraph # Build with Intel nGraph support.
#> --config=numa # Build with NUMA support.
#> --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects.
#> --config=v2 # Build TensorFlow 2.x instead of 1.x.
#> Preconfigured Bazel build configs to DISABLE default on features:
#> --config=noaws # Disable AWS S3 filesystem support.
#> --config=nogcp # Disable GCP support.
#> --config=nohdfs # Disable HDFS support.
#> --config=nonccl # Disable NVIDIA NCCL support.
#> Configuration finished

echo
echo “ENTER to continue, CTRL-C abort”
read

{
bazel build
–workspace_status_command=“bash native_client/bazel_workspace_status_cmd.sh”
–config=monolithic -c opt --copt=-O3 --copt="-D_GLIBCXX_USE_CXX11_ABI=0"
–copt=-fvisibility=hidden //native_client:libdeepspeech.so

} > bazel-run-log.txt 2>&1

echo
echo "Read ““bazel-run-log.txt”” "
echo

1 Like

It’s all reproducing the documented steps.

Just git checkout v0.8.1, building from the zip is not supported.

If you are just testing, why do you absolutely need to rebuild, we have prebuilt binaries already.

Hi,

Yes except for the “git checkout”. That is where I had all the problems with cross pollution of releases/versions. As, I said, I am famiiar with neither git nor bazel, and I did not find any reference to “checkout” in the build steps for the v0.8.1 docs.

Well, there’s nothing bazel specific, but we can’t cover each and every usecase explicitely, at some point, people need to check their doc’s tool, git is not specifically some obscure unknown piece of software

Hi,

When I tried to build against the “native_client.amd64.cpu.linux.tar.xz”, the link step had many references to “STT_” which where not provided by “libdeepspeech.so”

Again, I suspect that most of my problems arose due to my own ignorance of git/bazel and the subsequent cross-pollution of sources.

Now that I have a binary “libdeepspeech.so” built and copied to a work area along with the release “client.cc”, “args.h” and “deepspeech.h” I am happily compiling against the 0.8.1 release :slight_smile:

Thanks :slight_smile:

Because you are using master instead of the appropriate version.

But at some point we can’t document each and every use. Where do you set the bar? git checkout is a very basic operation. Should we also document how to install NVIDIA drivers? A linux distro? Build you computer?

Now you succeeded, if you have ideas on doc improvements, you are welcome to send PR, though. Maybe this can be of value to others?

I agree absolutely, the burden is on me to learn git, however, that one step, checkout, is vital and perhaps should be included in the docs.

I am not sure what a PR is, “pull request” ?

I would be happy for you to use the libdeepspeech setup script (even though it is a duplicate of yr work :slight_smile:) and the script I use to build the “client.cc” for other newbies, such as myself, who need an exact recipe, a direct route from A-to-B, to get started.

As to why I want to build new binaries, running the new “client” from “client.cc” reminded me why I wanted to build a new binary libdeepspeech,

“Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE3 SSE4.1 SSE4.2 AVX FMA”

The Mozilla/STT/DeepSpeech engine uses a custom tensorflow and, with the amount of audio I have, I need every CPU advantage I can find to reduce processing time. I also intend to get ROCm working on my system and tensorflow, it seems, can be built to use the AMD GPU’s.

Our bianries are build with up to FMA support, so you should not have that message. You need to pass --copt that matches your CPU, please check TensorFlow and GCC docs.

While those flags can help, it’s not going to have a huge impact. When we benchmarked whether we wanted to use FMA2 or not, it was 10%-30% depending on the CPU. Still nice, but it’s not what is going to change your life.

We don’t know how much well ROCm can work.

If you really are working in huge volumes, I would suggest rather leverage something like evaluate.py rather than the library: it is able to batch and make proper use of GPUs. This relies on TensorFlow r1.15, though, so maybe ROCm is not really usable there.