Running multiple inferences in parallel on a GPU

So we altered the code then followed the instructions here:

to rebuild and install the package to a virtual environment then using torch multiprocessing we initialised two processes with the target being the function described in my previous comment about inference

That’s the part that we need to verify for sure.

That’s the part that we need to verify for sure.

We’ve definitely verified that because we put a stdout in the file and it was printed on execution

According to the comment, I modified tfmodelstate.cc as follows and it works fine.
libdeepspeech.so can be used from multiple processes.
Thanks

SessionOptions options;
options.config.mutable_gpu_options()->set_allow_growth(true);

Could you provide a bit of clarity on where the tfmodelstate.cc file is?

tfmodelstate.cc is for master, it did not exist in v0.5.1. Also, make sure you’re reading the documentation for v0.5.1 as well. In the post above you linked to the master documentation. That could be why the change isn’t working for you, you followed the wrong steps maybe.

In the post above you linked to the master documentation.

That was just my fault with linking quickly we did follow the README.md found in the v0.5.1 repo. If it doesn’t exist in the release version and only exists in the alpha and the changes made to the deepspeech.cc file have not taken effect is there any action you could suggest to either diagnose or solve the problem?

The changes made to deepspeech.cc should apply if you rebuild libdeepspeech.so as well as the Python package you’re using. If it is applied, but not doing what you expected, then that’s a TensorFlow bug, as there’s nothing we can do beyond setting the flag in the Session options.

@ tbatkin can you give me a step that you have been followed for multiple inferences.

Thanks

ERROR: /home/administrator/deepspeech/tensorflow/tensorflow/core/kernels/BUILD:4192:1: error while parsing .d file: /home/administrator/.cache/bazel/_bazel_administrator/f0ef65007c45462e3bb61b45513f09ae/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/core/kernels/_objs/softmax_op_gpu/softmax_op_gpu.cu.pic.d (No such file or directory)
nvcc fatal : Could not open output file ‘/tmp/tmpxft_000065a2_00000000’
INFO: Elapsed time: 34.680s, Critical Path: 25.55s
INFO: 130 processes: 130 local.
FAILED: Build did NOT complete successfully

i’m getting above error while compiling.
i followed this page https://github.com/mozilla/DeepSpeech/blob/master/native_client/README.rst

when i checked there is no /tmp directory in my system @lissyx @reuben @tbatkin @ryoji.ysd

We can’t help you with just a half-backed error and no context, sorry.

~/deepspeech/tensorflow$ 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 //native_client:generate_trie
INFO: Analysed 2 targets (0 packages loaded, 0 targets configured).
INFO: Found 2 targets...
INFO: From Compiling tensorflow/core/lib/core/error_codes.pb.cc:
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.cc:70:13: warning: 'dynamic_init_dummy_tensorflow_2fcore_2flib_2fcore_2ferror_5fcodes_2eproto' defined but not used [-Wunused-variable]
 static bool dynamic_init_dummy_tensorflow_2fcore_2flib_2fcore_2ferror_5fcodes_2eproto = []() { AddDescriptors_tensorflow_2fcore_2flib_2fcore_2ferror_5fcodes_2eproto(); return true; }();
             ^
cc1plus: warning: unrecognized command line option '-Wno-unknown-warning-option'
INFO: From Compiling native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/properties.cc:
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/properties.cc: In function 'uint64 fst::ReplaceProperties(const std::vector<long unsigned int>&, ssize_t, bool, bool, bool, bool, bool, bool, bool, bool, bool)':
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/properties.cc:272:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (i != root && !(inprops[i] & kNoIEpsilons)) ideterministic = false;
           ^
INFO: From Compiling native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc:
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc: In member function 'int64 fst::internal::SymbolTableImpl::AddSymbol(const string&, int64)':
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc:117:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (key == (symbols_.size() - 1) && key == dense_key_limit_) {
           ^
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc: In member function 'void fst::internal::SymbolTableImpl::RemoveSymbol(int64)':
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc:138:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (idx < 0 || idx >= symbols_.size()) return;
                      ^
native_client/ctcdecode/third_party/openfst-1.6.7/src/lib/symbol-table.cc:162:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int64 i = idx - dense_key_limit_; i < idx_key_.size() - 1; ++i) {
                                              ^
INFO: From Compiling native_client/ctcdecode/ctc_beam_search_decoder.cpp:
native_client/ctcdecode/ctc_beam_search_decoder.cpp: In member function 'void DecoderState::next(const double*, int, int)':
native_client/ctcdecode/ctc_beam_search_decoder.cpp:56:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t rel_time_step = 0; rel_time_step < time_dim; ++rel_time_step, ++abs_time_step_) {
                                                ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp:87:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (c == blank_id_) {
               ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp:94:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (c == prefix->character) {
               ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp:105:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           if (c == prefix->character &&
                 ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp:108:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           } else if (c != prefix->character) {
                        ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp: In function 'std::vector<std::vector<Output> > ctc_beam_search_decoder_batch(const double*, int, int, int, const int*, int, const Alphabet&, size_t, size_t, double, size_t, Scorer*)':
native_client/ctcdecode/ctc_beam_search_decoder.cpp:257:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t i = 0; i < batch_size; ++i) {
                        ^
native_client/ctcdecode/ctc_beam_search_decoder.cpp:271:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t i = 0; i < batch_size; ++i) {
                        ^
INFO: From Compiling native_client/deepspeech.cc:
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:95:0: warning: "LOG" redefined
 #define LOG(severity) _TF_LOG_##severity
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:48:0: note: this is the location of the previous definition
 #define LOG(type) LogMessage(#type).stream()
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:116:0: warning: "VLOG" redefined
 #define VLOG(level)                                              \
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:49:0: note: this is the location of the previous definition
 #define VLOG(level) if ((level) <= FLAGS_v) LOG(INFO)
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:127:0: warning: "CHECK" redefined
 #define CHECK(condition)              \
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:61:0: note: this is the location of the previous definition
 #define CHECK(x) FstCheck(static_cast<bool>(x), #x, __FILE__, __LINE__)
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:280:0: warning: "CHECK_EQ" redefined
 #define CHECK_EQ(val1, val2) CHECK_OP(Check_EQ, ==, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:62:0: note: this is the location of the previous definition
 #define CHECK_EQ(x, y) CHECK((x) == (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:281:0: warning: "CHECK_NE" redefined
 #define CHECK_NE(val1, val2) CHECK_OP(Check_NE, !=, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:67:0: note: this is the location of the previous definition
 #define CHECK_NE(x, y) CHECK((x) != (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:282:0: warning: "CHECK_LE" redefined
 #define CHECK_LE(val1, val2) CHECK_OP(Check_LE, <=, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:65:0: note: this is the location of the previous definition
 #define CHECK_LE(x, y) CHECK((x) <= (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:283:0: warning: "CHECK_LT" redefined
 #define CHECK_LT(val1, val2) CHECK_OP(Check_LT, <, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:63:0: note: this is the location of the previous definition
 #define CHECK_LT(x, y) CHECK((x) < (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:284:0: warning: "CHECK_GE" redefined
 #define CHECK_GE(val1, val2) CHECK_OP(Check_GE, >=, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:66:0: note: this is the location of the previous definition
 #define CHECK_GE(x, y) CHECK((x) >= (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:285:0: warning: "CHECK_GT" redefined
 #define CHECK_GT(val1, val2) CHECK_OP(Check_GT, >, val1, val2)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:64:0: note: this is the location of the previous definition
 #define CHECK_GT(x, y) CHECK((x) > (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:302:0: warning: "DCHECK" redefined
 #define DCHECK(condition) \
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:70:0: note: this is the location of the previous definition
 #define DCHECK(x) assert(x)
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:312:0: warning: "DCHECK_EQ" redefined
 #define DCHECK_EQ(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:71:0: note: this is the location of the previous definition
 #define DCHECK_EQ(x, y) DCHECK((x) == (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:313:0: warning: "DCHECK_NE" redefined
 #define DCHECK_NE(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:76:0: note: this is the location of the previous definition
 #define DCHECK_NE(x, y) DCHECK((x) != (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:314:0: warning: "DCHECK_LE" redefined
 #define DCHECK_LE(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:74:0: note: this is the location of the previous definition
 #define DCHECK_LE(x, y) DCHECK((x) <= (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:315:0: warning: "DCHECK_LT" redefined
 #define DCHECK_LT(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:72:0: note: this is the location of the previous definition
 #define DCHECK_LT(x, y) DCHECK((x) < (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:316:0: warning: "DCHECK_GE" redefined
 #define DCHECK_GE(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:75:0: note: this is the location of the previous definition
 #define DCHECK_GE(x, y) DCHECK((x) >= (y))
 ^
In file included from ./tensorflow/core/platform/logging.h:25:0,
                 from ./tensorflow/core/framework/allocator.h:28,
                 from ./tensorflow/core/framework/tensor.h:22,
                 from ./tensorflow/core/public/session.h:24,
                 from native_client/tfmodelstate.h:6,
                 from native_client/deepspeech.cc:19:
./tensorflow/core/platform/default/logging.h:317:0: warning: "DCHECK_GT" redefined
 #define DCHECK_GT(x, y) _TF_DCHECK_NOP(x, y)
 ^
In file included from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/expanded-fst.h:13:0,
                 from native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/fstlib.h:28,
                 from native_client/ctcdecode/path_trie.h:10,
                 from native_client/ctcdecode/scorer.h:14,
                 from native_client/modelstate.h:9,
                 from native_client/deepspeech.cc:14:
native_client/ctcdecode/third_party/openfst-1.6.7/src/include/fst/log.h:73:0: note: this is the location of the previous definition
 #define DCHECK_GT(x, y) DCHECK((x) > (y))
 ^
INFO: From Compiling native_client/kenlm/util/double-conversion/bignum.cc:
native_client/kenlm/util/double-conversion/bignum.cc: In member function 'void kenlm_double_conversion::Bignum::AssignDecimalString(kenlm_double_conversion::Vector<const char>)':
native_client/kenlm/util/double-conversion/bignum.cc:101:6: warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Wstrict-overflow]
 void Bignum::AssignDecimalString(Vector<const char> value) {
      ^
INFO: From Compiling tensorflow/core/platform/platform_strings.cc:
In file included from tensorflow/core/platform/platform_strings.cc:16:0:
./tensorflow/core/platform/platform_strings.h:96:1: warning: multi-line comment [-Wcomment]
 // #define TF_PLAT_STR_(x) \
 ^
INFO: From Compiling tensorflow/core/lib/wav/wav_io.cc:
In file included from tensorflow/core/lib/wav/wav_io.cc:25:0:
./tensorflow/core/lib/wav/wav_io.h: In function 'tensorflow::Status tensorflow::wav::ReadValue(const string&, T*, int*) [with T = unsigned int; std::string = std::basic_string<char>]':
./tensorflow/core/lib/wav/wav_io.h:86:3: warning: 'new_offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
   *offset = new_offset;
   ^
./tensorflow/core/lib/wav/wav_io.h: In function 'tensorflow::Status tensorflow::wav::ReadValue(const string&, T*, int*) [with T = short int; std::string = std::basic_string<char>]':
./tensorflow/core/lib/wav/wav_io.h:86:3: warning: 'new_offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
INFO: From Compiling tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:
In file included from ./tensorflow/core/grappler/graph_view.h:29:0,
                 from ./tensorflow/core/grappler/utils/frame.h:22,
                 from tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:26:
./tensorflow/core/grappler/utils.h: In function 'int tensorflow::grappler::NodePositionIfSameNode(const string&, const string&)':
./tensorflow/core/grappler/utils.h:134:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       std::distance(input_it, input_name.end()) < node_name.size()) {
                                                 ^
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc: In member function 'tensorflow::Status tensorflow::grappler::UnaryElementwiseRewriter::ConstructScopedAllocatorNode(tensorflow::grappler::ScopedAllocatorOptimizer*, tensorflow::GraphDef*, tensorflow::grappler::NodeMap*, const std::vector<tensorflow::NodeDef*>&, const string&, tensorflow::DataType, int, const string&, const std::vector<tensorflow::TensorShape>&, const std::vector<tensorflow::grappler::{anonymous}::InputDesc>&, const tensorflow::TensorShape&)':
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:392:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < inputs.size(); ++i) {
                       ^
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc: In member function 'tensorflow::Status tensorflow::grappler::UnaryElementwiseRewriter::BuildSAConcatNode(tensorflow::GraphDef*, tensorflow::grappler::NodeMap*, const std::vector<tensorflow::NodeDef*>&, const std::set<std::basic_string<char> >&, const string&, tensorflow::DataType, int, const string&, const string&, const tensorflow::TensorShape&, std::vector<tensorflow::NodeDefBuilder::NodeOut>*)':
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:417:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ops.size(); ++i) {
                       ^
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc: In member function 'tensorflow::Status tensorflow::grappler::UnaryElementwiseRewriter::RewireSubgraph(tensorflow::GraphDef*, tensorflow::grappler::NodeMap*, const std::vector<tensorflow::NodeDef*>&, const std::set<std::basic_string<char> >&, const string&, const string&)':
tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:532:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int op_idx = 0; op_idx < ops.size(); ++op_idx) {
                                 ^
In file included from ./tensorflow/core/platform/default/logging.h:24:0,
                 from ./tensorflow/core/platform/logging.h:25,
                 from ./tensorflow/core/lib/core/status.h:25,
                 from ./tensorflow/core/grappler/optimizers/graph_optimizer.h:21,
                 from ./tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.h:23,
                 from tensorflow/core/grappler/optimizers/scoped_allocator_optimizer.cc:15:
./tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetFilterDim(tensorflow::gtl::ArraySlice<T>, tensorflow::FilterTensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
./tensorflow/core/util/tensor_format.h:470:54:   required from here
./tensorflow/core/util/tensor_format.h:444:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attribute.size())
                             ^
./tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
./tensorflow/core/util/tensor_format.h:444:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attribute.size())
   ^
INFO: From Compiling tensorflow/core/platform/stacktrace_handler.cc:
tensorflow/core/platform/stacktrace_handler.cc: In function 'void tensorflow::testing::InstallStacktraceHandler()':
tensorflow/core/platform/stacktrace_handler.cc:118:51: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
       (void)write(STDERR_FILENO, buf, strlen(buf));
                                                   ^
tensorflow/core/platform/stacktrace_handler.cc:125:51: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
       (void)write(STDERR_FILENO, buf, strlen(buf));
                                                   ^
tensorflow/core/platform/stacktrace_handler.cc: In function 'void tensorflow::testing::StacktraceHandler(int, siginfo_t*, void*)':
tensorflow/core/platform/stacktrace_handler.cc:80:47: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void)write(STDERR_FILENO, buf, strlen(buf));
                                               ^
tensorflow/core/platform/stacktrace_handler.cc:90:70: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void)write(STDERR_FILENO, stacktrace.c_str(), stacktrace.length());
                                                                      ^
tensorflow/core/platform/stacktrace_handler.cc: In function 'void tensorflow::testing::SafePrintStackTrace()':
tensorflow/core/platform/stacktrace_handler.cc:47:59: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void)write(STDERR_FILENO, begin_msg, strlen(begin_msg));
                                                           ^
tensorflow/core/platform/stacktrace_handler.cc:58:55: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void)write(STDERR_FILENO, end_msg, strlen(end_msg));
                                                       ^
ERROR: /home/administrator/deepspeech/tensorflow/tensorflow/core/kernels/BUILD:4192:1: error while parsing .d file: /home/administrator/.cache/bazel/_bazel_administrator/f0ef65007c45462e3bb61b45513f09ae/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/core/kernels/_objs/softmax_op_gpu/softmax_op_gpu.cu.pic.d (No such file or directory)
nvcc fatal   : Could not open output file '/tmp/tmpxft_000065a2_00000000'
INFO: Elapsed time: 34.680s, Critical Path: 25.55s
INFO: 130 processes: 130 local.
FAILED: Build did NOT complete successfully

Deepspeech - 0.6.1a tensorflow checkout r1.14 bazel 0.24.1 cuda 10.0

tensorflow configure ./configure

./configure

WARNING: Running Bazel server needs to be killed, because the startup options are different.
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.24.1 installed.
Please specify the location of python. [Default is /usr/bin/python]: /usr/local/bin/python3.7


Found possible Python library paths:
  /usr/local/lib/python3.7/site-packages
Please input the desired Python library path to use.  Default is [/usr/local/lib/python3.7/site-packages]

Do you wish to build TensorFlow with XLA JIT support? [Y/n]: n
No XLA JIT support will be enabled for TensorFlow.

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: 
No OpenCL SYCL support will be enabled for TensorFlow.

Do you wish to build TensorFlow with ROCm support? [y/N]: 
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.

Do you wish to build TensorFlow with TensorRT support? [y/N]: n
No TensorRT support will be enabled for TensorFlow.

Found CUDA 10.0 in:
    /usr/local/cuda/lib64
    /usr/local/cuda/include
Found cuDNN 7 in:
    /usr/local/cuda/lib64
    /usr/local/cuda/include


Please specify a list of comma-separated CUDA compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size, and that TensorFlow only supports compute capabilities >= 3.5 [Default is: 7.5,6.1]: 


Do you want to use clang as CUDA compiler? [y/N]: 
nvcc will be used as CUDA compiler.

Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 


Do you wish to build TensorFlow with MPI support? [y/N]: 
No MPI support will be enabled for TensorFlow.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: --config=cuda


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: 
Not configuring the WORKSPACE for Android builds.

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=gdr         	# Build with GDR support.
	--config=verbs       	# Build with libverbs support.
	--config=ngraph      	# Build with Intel nGraph support.
	--config=numa        	# Build with NUMA support.
	--config=dynamic_kernels	# (Experimental) Build kernels into separate shared objects.
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=noignite    	# Disable Apache Ignite support.
	--config=nokafka     	# Disable Apache Kafka support.
	--config=nonccl      	# Disable NVIDIA NCCL support.
Configuration finished

@lissyx

@vigneshgig Please, why do you re-post on a old topic ? Your console output should be done using code formatting, it’s unreadable the way it is currently done.

You configure for CUDA but then there is no --config=cuda in your bazel build call.

Please make sure you start from a clean bazel state, no stale cache, and that you use https://github.com/mozilla/tensorflow repo.

Thanks , I figured it out, the problem in nvidia-driver installation.can anyone give an idea how to use torch.multiprocessing to run deepspeech is there any tutorial.
@lissyx @reuben @tbatkin

Have a script that contains something similar to the following:

import torch
import torch.multiprocessing as tmp
import multiprocessing as mp
from transcriber import run_inference

PROCESS_NUM = 2

audio_files = [
    "audio/test.wav",
    "audio/test1.wav",
    "audio/test2.wav"
]

if \__name__ == '\__main__':

# Setup a number of processes
processes = [tmp.Process(target=run_transcription, args=(audio_files[x])) for x in range(1, > PROCESS_NUM+1)]

# Run processes
for p in processes:
    p.start()

# Exit the completed processes
for p in processes:
    p.join()

Where the run_inference function does as follows:

def run_inference(audio_file):

    BEAM_WIDTH = 500
    LM_WEIGHT = 1.50
    VALID_WORD_COUNT_WEIGHT = 2.10
    N_FEATURES = 26
    N_CONTEXT = 9
    MODEL_ROOT_DIR = 'deepspeech-0.5.1-models/'

    ds = Model(
        MODEL_ROOT_DIR + 'output_graph.pb',
        N_FEATURES,
        N_CONTEXT,
        MODEL_ROOT_DIR + 'alphabet.txt',
        BEAM_WIDTH)

    ds.enableDecoderWithLM(MODEL_ROOT_DIR + 'alphabet.txt',
                            MODEL_ROOT_DIR + 'lm.binary',
                            MODEL_ROOT_DIR + 'trie',
                            LM_WEIGHT,
                            VALID_WORD_COUNT_WEIGHT)
    fs, audio = wav.read(audio_file)
    transcript = ds.stt(audio, fs)
    print(transcript)

This way you should be able to run X number of multiple inferences in parallel on your GPU by changing the PROCESS_NUM variable

1 Like

thanks for reply,
can give me a idea how can i use it in flask .the above code will close the model once audio is predicted and clear the model, if i am wrong please correct me.but i want model to load once and continuously process the audio for every request.
I also planning to use tensorflow server to run the deepspeech model parallel. can any one give me a idea to kick start it. @lissyx @reuben @tbatkin bakin

Probably use some sort of torch queue and consumers then from your flask application append the file name to the queue and have one of the consumers pick up from it and process the file. I don’t have experience with this but that’s how I’d do it