Add API to get version information (#2309)

This commit is contained in:
Fangjun Kuang
2025-06-25 00:22:21 +08:00
committed by GitHub
parent 7f2145539d
commit bda427f4b2
169 changed files with 1480 additions and 12 deletions

View File

@@ -53,6 +53,7 @@ set(srcs
tensorrt-config.cc
vad-model-config.cc
vad-model.cc
version.cc
voice-activity-detector.cc
wave-writer.cc
)

View File

@@ -4,6 +4,7 @@
#include "sherpa-onnx/csrc/offline-source-separation.h"
#include <algorithm>
#include <string>
#include "sherpa-onnx/python/csrc/offline-source-separation-model-config.h"

View File

@@ -1,9 +1,9 @@
// sherpa-onnx/python/csrc/offline-source-separation-config.h
// sherpa-onnx/python/csrc/offline-source-separation.h
//
// Copyright (c) 2025 Xiaomi Corporation
#ifndef SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
#define SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
#ifndef SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_
#define SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_
#include "sherpa-onnx/python/csrc/sherpa-onnx.h"
@@ -13,4 +13,4 @@ void PybindOfflineSourceSeparation(py::module *m);
}
#endif // SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
#endif // SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_

View File

@@ -31,6 +31,7 @@
#include "sherpa-onnx/python/csrc/spoken-language-identification.h"
#include "sherpa-onnx/python/csrc/vad-model-config.h"
#include "sherpa-onnx/python/csrc/vad-model.h"
#include "sherpa-onnx/python/csrc/version.h"
#include "sherpa-onnx/python/csrc/voice-activity-detector.h"
#include "sherpa-onnx/python/csrc/wave-writer.h"
@@ -112,6 +113,7 @@ PYBIND11_MODULE(_sherpa_onnx, m) {
PybindAlsa(&m);
PybindOfflineSpeechDenoiser(&m);
PybindOfflineSourceSeparation(&m);
PybindVersion(&m);
}
} // namespace sherpa_onnx

View File

@@ -0,0 +1,21 @@
// sherpa-onnx/python/csrc/version.cc
//
// Copyright (c) 2025 Xiaomi Corporation
#include "sherpa-onnx/python/csrc/version.h"
#include <string>
#include "sherpa-onnx/csrc/version.h"
namespace sherpa_onnx {
void PybindVersion(py::module *m) {
m->attr("version") = std::string(GetVersionStr());
m->attr("git_sha1") = std::string(GetGitSha1());
m->attr("git_date") = std::string(GetGitDate());
}
} // namespace sherpa_onnx

View File

@@ -0,0 +1,16 @@
// sherpa-onnx/python/csrc/version.h
//
// Copyright (c) 2025 Xiaomi Corporation
#ifndef SHERPA_ONNX_PYTHON_CSRC_VERSION_H_
#define SHERPA_ONNX_PYTHON_CSRC_VERSION_H_
#include "sherpa-onnx/python/csrc/sherpa-onnx.h"
namespace sherpa_onnx {
void PybindVersion(py::module *m);
}
#endif // SHERPA_ONNX_PYTHON_CSRC_VERSION_H_