diff --git a/doc/C-API.rst b/doc/C-API.rst
index 6556d4bb..2506d9b2 100644
--- a/doc/C-API.rst
+++ b/doc/C-API.rst
@@ -49,5 +49,5 @@ C
.. doxygenfunction:: DS_FreeString
:project: deepspeech-c
-.. doxygenfunction:: DS_PrintVersions
+.. doxygenfunction:: DS_Version
:project: deepspeech-c
diff --git a/doc/NodeJS-API.rst b/doc/NodeJS-API.rst
index acdc3ab7..aaba718c 100644
--- a/doc/NodeJS-API.rst
+++ b/doc/NodeJS-API.rst
@@ -22,7 +22,7 @@ Module exported methods
.. js:autofunction:: FreeMetadata
-.. js:autofunction:: printVersions
+.. js:autofunction:: Version
Metadata
--------
diff --git a/native_client/args.h b/native_client/args.h
index 2e7306c7..33b9b8fe 100644
--- a/native_client/args.h
+++ b/native_client/args.h
@@ -55,7 +55,9 @@ void PrintHelp(const char* bin)
"\t--stream size\t\tRun in stream mode, output intermediate results\n"
"\t--help\t\t\tShow help\n"
"\t--version\t\tPrint version and exits\n";
- DS_PrintVersions();
+ char* version = DS_Version();
+ std::cerr << "DeepSpeech " << version << "\n";
+ DS_FreeString(version);
exit(1);
}
@@ -143,7 +145,9 @@ bool ProcessArgs(int argc, char** argv)
}
if (has_versions) {
- DS_PrintVersions();
+ char* version = DS_Version();
+ std::cout << "DeepSpeech " << version << "\n";
+ DS_FreeString(version);
return false;
}
diff --git a/native_client/deepspeech.cc b/native_client/deepspeech.cc
index 9f0ebe42..c500fc83 100644
--- a/native_client/deepspeech.cc
+++ b/native_client/deepspeech.cc
@@ -261,7 +261,14 @@ DS_CreateModel(const char* aModelPath,
{
*retval = nullptr;
- DS_PrintVersions();
+ std::cerr << "TensorFlow: " << tf_local_git_version() << std::endl;
+ std::cerr << "DeepSpeech: " << ds_git_version() << std::endl;
+#ifdef __ANDROID__
+ LOGE("TensorFlow: %s", tf_local_git_version());
+ LOGD("TensorFlow: %s", tf_local_git_version());
+ LOGE("DeepSpeech: %s", ds_git_version());
+ LOGD("DeepSpeech: %s", ds_git_version());
+#endif
if (!aModelPath || strlen(aModelPath) < 1) {
std::cerr << "No model specified, cannot continue." << std::endl;
@@ -467,14 +474,7 @@ DS_FreeString(char* str)
free(str);
}
-void
-DS_PrintVersions() {
- std::cerr << "TensorFlow: " << tf_local_git_version() << std::endl;
- std::cerr << "DeepSpeech: " << ds_git_version() << std::endl;
-#ifdef __ANDROID__
- LOGE("TensorFlow: %s", tf_local_git_version());
- LOGD("TensorFlow: %s", tf_local_git_version());
- LOGE("DeepSpeech: %s", ds_git_version());
- LOGD("DeepSpeech: %s", ds_git_version());
-#endif
+char*
+DS_Version() {
+ return strdup(ds_version());
}
diff --git a/native_client/deepspeech.h b/native_client/deepspeech.h
index c5e330cb..53e93ec3 100644
--- a/native_client/deepspeech.h
+++ b/native_client/deepspeech.h
@@ -288,10 +288,13 @@ DEEPSPEECH_EXPORT
void DS_FreeString(char* str);
/**
- * @brief Print version of this library and of the linked TensorFlow library.
+ * @brief Return version of this library. The returned version is a semantic version
+ * (SemVer 2.0.0). The string returned must be freed with {@link DS_FreeString()}.
+ *
+ * @return The version string.
*/
DEEPSPEECH_EXPORT
-void DS_PrintVersions();
+char* DS_Version();
#undef DEEPSPEECH_EXPORT
diff --git a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
index 15c2212c..576ed308 100644
--- a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
+++ b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
@@ -219,11 +219,12 @@ namespace DeepSpeechClient
}
///
- /// Prints the versions of Tensorflow and DeepSpeech.
+ /// Return version of this library. The returned version is a semantic version
+ /// (SemVer 2.0.0).
///
- public unsafe void PrintVersions()
+ public unsafe string Version()
{
- NativeImp.DS_PrintVersions();
+ return NativeImp.DS_Version().PtrToString();
}
///
diff --git a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
index f00c188d..18677abc 100644
--- a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
+++ b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
@@ -10,9 +10,10 @@ namespace DeepSpeechClient.Interfaces
public interface IDeepSpeech : IDisposable
{
///
- /// Prints the versions of Tensorflow and DeepSpeech.
+ /// Return version of this library. The returned version is a semantic version
+ /// (SemVer 2.0.0).
///
- void PrintVersions();
+ unsafe string Version();
///
/// Return the sample rate expected by the model.
diff --git a/native_client/dotnet/DeepSpeechClient/NativeImp.cs b/native_client/dotnet/DeepSpeechClient/NativeImp.cs
index af28618c..6c3494b6 100644
--- a/native_client/dotnet/DeepSpeechClient/NativeImp.cs
+++ b/native_client/dotnet/DeepSpeechClient/NativeImp.cs
@@ -11,8 +11,9 @@ namespace DeepSpeechClient
internal static class NativeImp
{
#region Native Implementation
- [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)]
- internal static extern void DS_PrintVersions();
+ [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl,
+ CharSet = CharSet.Ansi, SetLastError = true)]
+ internal static extern IntPtr DS_Version();
[DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)]
internal unsafe static extern ErrorCodes DS_CreateModel(string aModelPath,
diff --git a/native_client/javascript/client.js b/native_client/javascript/client.js
index 09406ccc..abbfe59e 100644
--- a/native_client/javascript/client.js
+++ b/native_client/javascript/client.js
@@ -18,7 +18,7 @@ var VersionAction = function VersionAction(options) {
util.inherits(VersionAction, argparse.Action);
VersionAction.prototype.call = function(parser) {
- Ds.printVersions();
+ console.log('DeepSpeech ' + Ds.Version());
let runtime = 'Node';
if (process.versions.electron) {
runtime = 'Electron';
diff --git a/native_client/javascript/deepspeech.i b/native_client/javascript/deepspeech.i
index 006f78cf..efbaa360 100644
--- a/native_client/javascript/deepspeech.i
+++ b/native_client/javascript/deepspeech.i
@@ -36,6 +36,7 @@ using namespace node;
%newobject DS_SpeechToText;
%newobject DS_IntermediateDecode;
%newobject DS_FinishStream;
+%newobject DS_Version;
// convert double pointer retval in CreateModel to an output
%typemap(in, numinputs=0) ModelState **retval (ModelState *ret) {
diff --git a/native_client/javascript/index.js b/native_client/javascript/index.js
index 58697033..df827f04 100644
--- a/native_client/javascript/index.js
+++ b/native_client/javascript/index.js
@@ -231,8 +231,8 @@ function FreeStream(stream) {
/**
* Print version of this library and of the linked TensorFlow library on standard output.
*/
-function printVersions() {
- return binding.PrintVersions();
+function Version() {
+ return binding.Version();
}
@@ -300,7 +300,7 @@ module.exports = {
Model: Model,
Metadata: Metadata,
MetadataItem: MetadataItem,
- printVersions: printVersions,
+ Version: Version,
FreeModel: FreeModel,
FreeStream: FreeStream,
FreeMetadata: FreeMetadata
diff --git a/native_client/python/__init__.py b/native_client/python/__init__.py
index 960305be..dffc960d 100644
--- a/native_client/python/__init__.py
+++ b/native_client/python/__init__.py
@@ -20,7 +20,7 @@ if platform.system().lower() == "windows":
import deepspeech
# rename for backwards compatibility
-from deepspeech.impl import PrintVersions as printVersions
+from deepspeech.impl import Version as version
class Model(object):
"""
diff --git a/native_client/python/client.py b/native_client/python/client.py
index 26db1e00..671968b9 100644
--- a/native_client/python/client.py
+++ b/native_client/python/client.py
@@ -10,7 +10,7 @@ import sys
import wave
import json
-from deepspeech import Model, printVersions
+from deepspeech import Model, version
from timeit import default_timer as timer
try:
@@ -80,7 +80,7 @@ class VersionAction(argparse.Action):
super(VersionAction, self).__init__(nargs=0, *args, **kwargs)
def __call__(self, *args, **kwargs):
- printVersions()
+ print('DeepSpeech ', version())
exit(0)
diff --git a/native_client/python/impl.i b/native_client/python/impl.i
index c94ac819..e1644a35 100644
--- a/native_client/python/impl.i
+++ b/native_client/python/impl.i
@@ -62,6 +62,7 @@ import_array();
%newobject DS_SpeechToText;
%newobject DS_IntermediateDecode;
%newobject DS_FinishStream;
+%newobject DS_Version;
%rename ("%(strip:[DS_])s") "";
diff --git a/taskcluster/tc-android-ds-tests.sh b/taskcluster/tc-android-ds-tests.sh
index ec96dbf1..b9c70d03 100755
--- a/taskcluster/tc-android-ds-tests.sh
+++ b/taskcluster/tc-android-ds-tests.sh
@@ -28,8 +28,6 @@ android_setup_emulator "${arm_flavor}" "${api_level}"
android_setup_ndk_data
-check_tensorflow_version
-
run_tflite_basic_inference_tests
android_stop_emulator
diff --git a/taskcluster/tc-asserts.sh b/taskcluster/tc-asserts.sh
index 6c680560..fd720557 100755
--- a/taskcluster/tc-asserts.sh
+++ b/taskcluster/tc-asserts.sh
@@ -252,10 +252,10 @@ assert_deepspeech_version()
assert_not_present "$1" "DeepSpeech: unknown"
}
-check_tensorflow_version()
+check_versions()
{
set +e
- ds_help=$(${DS_BINARY_PREFIX}deepspeech 2>&1 1>/dev/null)
+ ds_help=$(${DS_BINARY_PREFIX}deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name} --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} 2>&1 1>/dev/null)
set -e
assert_tensorflow_version "${ds_help}"
diff --git a/taskcluster/tc-cpp-ds-tests-prod.sh b/taskcluster/tc-cpp-ds-tests-prod.sh
index d3e1db2e..9edd5673 100644
--- a/taskcluster/tc-cpp-ds-tests-prod.sh
+++ b/taskcluster/tc-cpp-ds-tests-prod.sh
@@ -17,6 +17,6 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_prod_inference_tests "${bitrate}"
diff --git a/taskcluster/tc-cpp-ds-tests.sh b/taskcluster/tc-cpp-ds-tests.sh
index cea0674c..67d5d92f 100644
--- a/taskcluster/tc-cpp-ds-tests.sh
+++ b/taskcluster/tc-cpp-ds-tests.sh
@@ -11,7 +11,7 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_all_inference_tests
diff --git a/taskcluster/tc-cpp_tflite-ds-tests.sh b/taskcluster/tc-cpp_tflite-ds-tests.sh
index f442dda7..313475ef 100644
--- a/taskcluster/tc-cpp_tflite-ds-tests.sh
+++ b/taskcluster/tc-cpp_tflite-ds-tests.sh
@@ -16,7 +16,7 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_all_inference_tests
diff --git a/taskcluster/tc-cpp_tflite-tests-prod.sh b/taskcluster/tc-cpp_tflite-tests-prod.sh
index 8f2b47b2..5acd4016 100644
--- a/taskcluster/tc-cpp_tflite-tests-prod.sh
+++ b/taskcluster/tc-cpp_tflite-tests-prod.sh
@@ -18,6 +18,6 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_prodtflite_inference_tests "${bitrate}"
diff --git a/taskcluster/tc-cpp_tflite_basic-ds-tests.sh b/taskcluster/tc-cpp_tflite_basic-ds-tests.sh
index be539933..7370e8a3 100644
--- a/taskcluster/tc-cpp_tflite_basic-ds-tests.sh
+++ b/taskcluster/tc-cpp_tflite_basic-ds-tests.sh
@@ -16,6 +16,6 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_tflite_basic_inference_tests
diff --git a/taskcluster/tc-cppwin-ds-tests.sh b/taskcluster/tc-cppwin-ds-tests.sh
index 671ae3ef..6f177a39 100644
--- a/taskcluster/tc-cppwin-ds-tests.sh
+++ b/taskcluster/tc-cppwin-ds-tests.sh
@@ -11,6 +11,6 @@ download_material "${TASKCLUSTER_TMP_DIR}/ds"
export PATH=${TASKCLUSTER_TMP_DIR}/ds/:$PATH
-check_tensorflow_version
+check_versions
run_basic_inference_tests