Browse Source

2024.5.16 测试整体构建

master
Administrator 1 year ago
parent
commit
d288a408d5
8 changed files with 27 additions and 28 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +1
    -2
      cmake-linux/openfst.cmake
  3. +4
    -4
      kaldi/base/kaldi-error.h
  4. +14
    -14
      kaldi/base/kaldi-types.h
  5. +1
    -1
      kaldi/fstext/determinize-lattice.h
  6. +2
    -2
      kaldi/fstext/lattice-weight.h
  7. +2
    -2
      post_processor/processor/wetext_processor.cc
  8. +2
    -2
      utils/log.h

+ 1
- 1
CMakeLists.txt

@ -7,7 +7,7 @@ set(ColourReset "${Esc}[m")
set(BoldGreen "${Esc}[1;32m") set(BoldGreen "${Esc}[1;32m")
set(BoldRed "${Esc}[31m") set(BoldRed "${Esc}[31m")
# #
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread -fPIC -w")
set(LIB_BASE_DIR /root/CXX_ENVS/wenet_runtime) set(LIB_BASE_DIR /root/CXX_ENVS/wenet_runtime)
set(third_party_libraries) set(third_party_libraries)
option(GRPC "whether to build with gRPC" ON) option(GRPC "whether to build with gRPC" ON)

+ 1
- 2
cmake-linux/openfst.cmake

@ -67,8 +67,7 @@ endif ()
find_path(OPENFST_INCLUDE_DIR fst/fst.h PATHS ${OPENFST_ROOT}/include) find_path(OPENFST_INCLUDE_DIR fst/fst.h PATHS ${OPENFST_ROOT}/include)
find_path(OPENFST_BINARY_DIR fstsymbols PATHS ${OPENFST_ROOT}/bin) find_path(OPENFST_BINARY_DIR fstsymbols PATHS ${OPENFST_ROOT}/bin)
find_path(OPENFST_LIBRARY_DIR libfst.so PATHS ${OPENFST_ROOT}/lib)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${OPENFST_LIBRARY_DIR})
find_library(fst fst PATHS ${OPENFST_ROOT}/lib)
set(OPENFST_LIBRARYS fst gflags_nothreads_static glog dl) set(OPENFST_LIBRARYS fst gflags_nothreads_static glog dl)
# #
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)

+ 4
- 4
kaldi/base/kaldi-error.h

@ -17,8 +17,7 @@
#ifndef KALDI_BASE_KALDI_ERROR_H_ #ifndef KALDI_BASE_KALDI_ERROR_H_
#define KALDI_BASE_KALDI_ERROR_H_ 1 #define KALDI_BASE_KALDI_ERROR_H_ 1
#include "kaldi-types.h"
#include <glog/logging.h>
#include "utils/log.h"
namespace kaldi { namespace kaldi {
@ -33,6 +32,7 @@ namespace kaldi {
#define KALDI_ASSERT(condition) CHECK(condition) #define KALDI_ASSERT(condition) CHECK(condition)
/***** PROGRAM NAME AND VERBOSITY LEVEL *****/ /***** PROGRAM NAME AND VERBOSITY LEVEL *****/
/// Called by ParseOptions to set base name (no directory) of the executing /// Called by ParseOptions to set base name (no directory) of the executing
/// program. The name is printed in logging code along with every message, /// program. The name is printed in logging code along with every message,
/// because in our scripts, we often mix together the stderr of many programs. /// because in our scripts, we often mix together the stderr of many programs.
@ -41,10 +41,10 @@ void SetProgramName(const char* basename);
/// This is set by util/parse-options.{h,cc} if you set --verbose=? option. /// This is set by util/parse-options.{h,cc} if you set --verbose=? option.
/// Do not use directly, prefer {Get,Set}VerboseLevel(). /// Do not use directly, prefer {Get,Set}VerboseLevel().
extern kaldi::int32 g_kaldi_verbose_level;
extern int32 g_kaldi_verbose_level;
/// Get verbosity level, usually set via command line '--verbose=' switch. /// Get verbosity level, usually set via command line '--verbose=' switch.
inline kaldi::int32 GetVerboseLevel() { return g_kaldi_verbose_level; }
inline int32 GetVerboseLevel() { return g_kaldi_verbose_level; }
/// This should be rarely used, except by programs using Kaldi as library; /// This should be rarely used, except by programs using Kaldi as library;
/// command-line programs set the verbose level automatically from ParseOptions. /// command-line programs set the verbose level automatically from ParseOptions.

+ 14
- 14
kaldi/base/kaldi-types.h

@ -41,22 +41,22 @@ typedef float BaseFloat;
// for discussion on what to do if you need compile kaldi // for discussion on what to do if you need compile kaldi
// without OpenFST, see the bottom of this this file // without OpenFST, see the bottom of this this file
//#include <fst/types.h>
//
//namespace kaldi {
//using ::int16;
//using ::int32;
//using ::int64;
//using ::uint16;
//using ::uint32;
//using ::uint64;
//typedef float float32;
//typedef double double64;
//} // end namespace kaldi
#include <fst/types.h>
namespace kaldi {
using ::int16;
using ::int32;
using ::int64;
using ::uint16;
using ::uint32;
using ::uint64;
typedef float float32;
typedef double double64;
} // end namespace kaldi
// In a theoretical case you decide compile Kaldi without the OpenFST // In a theoretical case you decide compile Kaldi without the OpenFST
// comment the previous namespace statement and uncomment the following // comment the previous namespace statement and uncomment the following
/*
namespace kaldi { namespace kaldi {
typedef int8_t int8; typedef int8_t int8;
typedef int16_t int16; typedef int16_t int16;
@ -70,6 +70,6 @@ namespace kaldi {
typedef float float32; typedef float float32;
typedef double double64; typedef double double64;
} // end namespace kaldi } // end namespace kaldi
*/
#endif // KALDI_BASE_KALDI_TYPES_H_ #endif // KALDI_BASE_KALDI_TYPES_H_

+ 1
- 1
kaldi/fstext/determinize-lattice.h

@ -20,7 +20,7 @@
#ifndef KALDI_FSTEXT_DETERMINIZE_LATTICE_H_ #ifndef KALDI_FSTEXT_DETERMINIZE_LATTICE_H_
#define KALDI_FSTEXT_DETERMINIZE_LATTICE_H_ #define KALDI_FSTEXT_DETERMINIZE_LATTICE_H_
#include <fst/fst-decl.h> #include <fst/fst-decl.h>
//#include <fst/fstlib.h>
#include <fst/fstlib.h>
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <set> #include <set>

+ 2
- 2
kaldi/fstext/lattice-weight.h

@ -24,9 +24,9 @@
#include <limits> #include <limits>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/kaldi-types.h"
#include "base/kaldi-common.h" #include "base/kaldi-common.h"
//#include "fst/fstlib.h"
#include "fst/fstlib.h"
namespace fst { namespace fst {

+ 2
- 2
post_processor/processor/wetext_processor.cc

@ -19,7 +19,7 @@ Processor::Processor(const std::string& tagger_path,
const std::string& verbalizer_path) { const std::string& verbalizer_path) {
tagger_.reset(StdVectorFst::Read(tagger_path)); tagger_.reset(StdVectorFst::Read(tagger_path));
verbalizer_.reset(StdVectorFst::Read(verbalizer_path)); verbalizer_.reset(StdVectorFst::Read(verbalizer_path));
compiler_ = std::make_shared<StringCompiler<StdArc>>(fst::TokenType::BYTE);
// compiler_ = std::make_shared<StringCompiler<StdArc>>(fst::TokenType::BYTE);
printer_ = std::make_shared<StringPrinter<StdArc>>(fst::TokenType::BYTE); printer_ = std::make_shared<StringPrinter<StdArc>>(fst::TokenType::BYTE);
if (tagger_path.find("_tn_") != tagger_path.npos) { if (tagger_path.find("_tn_") != tagger_path.npos) {
@ -44,7 +44,7 @@ std::string Processor::ShortestPath(const StdVectorFst& lattice) {
std::string Processor::Compose(const std::string& input, std::string Processor::Compose(const std::string& input,
const StdVectorFst* fst) { const StdVectorFst* fst) {
StdVectorFst input_fst; StdVectorFst input_fst;
compiler_->operator()(input, &input_fst);
// compiler_->operator()(input, &input_fst);
StdVectorFst lattice; StdVectorFst lattice;
fst::Compose(input_fst, *fst, &lattice); fst::Compose(input_fst, *fst, &lattice);

+ 2
- 2
utils/log.h

@ -14,10 +14,10 @@
#ifndef UTILS_LOG_H_ #ifndef UTILS_LOG_H_
#define UTILS_LOG_H_ #define UTILS_LOG_H_
// Because openfst is a dynamic library compiled with gflags/glog, we must use // Because openfst is a dynamic library compiled with gflags/glog, we must use
// the gflags/glog from openfst to avoid them linked both statically and // the gflags/glog from openfst to avoid them linked both statically and
// dynamically into the executable. // dynamically into the executable.
#ifndef FST_LOG_H_
#include "fst/log.h" #include "fst/log.h"
#endif
#endif // UTILS_LOG_H_ #endif // UTILS_LOG_H_

Loading…
Cancel
Save