Skip to content

Commit

Permalink
remove unused files and bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Caroline Chen committed Dec 10, 2021
1 parent aae60da commit 894e80c
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 1,548 deletions.
5 changes: 0 additions & 5 deletions torchaudio/csrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,9 @@ if (BUILD_FL_DECODER)
set(
LIBTORCHAUDIO_DECODER_SOURCES
decoder/src/decoder/LexiconDecoder.cpp
decoder/src/decoder/LexiconFreeDecoder.cpp
decoder/src/decoder/LexiconFreeSeq2SeqDecoder.cpp
decoder/src/decoder/LexiconSeq2SeqDecoder.cpp
decoder/src/decoder/Trie.cpp
decoder/src/decoder/Utils.cpp
decoder/src/decoder/lm/ConvLM.cpp
decoder/src/decoder/lm/KenLM.cpp
decoder/src/decoder/lm/ZeroLM.cpp
decoder/src/dictionary/String.cpp
decoder/src/dictionary/System.cpp
decoder/src/dictionary/Dictionary.cpp
Expand Down
19 changes: 0 additions & 19 deletions torchaudio/csrc/decoder/bindings/_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
#include <pybind11/stl.h>

#include "torchaudio/csrc/decoder/src/decoder/LexiconDecoder.h"
#include "torchaudio/csrc/decoder/src/decoder/LexiconFreeDecoder.h"

// TODO: is this include necessary?
#include "torchaudio/csrc/decoder/src/decoder/lm/KenLM.h"

namespace py = pybind11;
Expand Down Expand Up @@ -111,20 +108,4 @@ std::vector<DecodeResult> LexiconDecoder_decode(
return decoder.decode(reinterpret_cast<const float*>(emissions), T, N);
}

void LexiconFreeDecoder_decodeStep(
LexiconFreeDecoder& decoder,
uintptr_t emissions,
int T,
int N) {
decoder.decodeStep(reinterpret_cast<const float*>(emissions), T, N);
}

std::vector<DecodeResult> LexiconFreeDecoder_decode(
LexiconFreeDecoder& decoder,
uintptr_t emissions,
int T,
int N) {
return decoder.decode(reinterpret_cast<const float*>(emissions), T, N);
}

} // namespace
53 changes: 0 additions & 53 deletions torchaudio/csrc/decoder/bindings/pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,6 @@ PYBIND11_MODULE(_torchaudio_decoder, m) {
.def_readwrite("log_add", &LexiconDecoderOptions::logAdd)
.def_readwrite("criterion_type", &LexiconDecoderOptions::criterionType);

py::class_<LexiconFreeDecoderOptions>(m, "LexiconFreeDecoderOptions")
.def(
py::init<
const int,
const int,
const double,
const double,
const double,
const bool,
const CriterionType>(),
"beam_size"_a,
"beam_size_token"_a,
"beam_threshold"_a,
"lm_weight"_a,
"sil_score"_a,
"log_add"_a,
"criterion_type"_a)
.def_readwrite("beam_size", &LexiconFreeDecoderOptions::beamSize)
.def_readwrite("beam_size_token", &LexiconFreeDecoderOptions::beamSizeToken)
.def_readwrite("beam_threshold", &LexiconFreeDecoderOptions::beamThreshold)
.def_readwrite("lm_weight", &LexiconFreeDecoderOptions::lmWeight)
.def_readwrite("sil_score", &LexiconFreeDecoderOptions::silScore)
.def_readwrite("log_add", &LexiconFreeDecoderOptions::logAdd)
.def_readwrite("criterion_type", &LexiconFreeDecoderOptions::criterionType);

py::class_<DecodeResult>(m, "DecodeResult")
.def(py::init<int>(), "length"_a)
.def_readwrite("score", &DecodeResult::score)
Expand Down Expand Up @@ -140,31 +115,6 @@ PYBIND11_MODULE(_torchaudio_decoder, m) {
"look_back"_a = 0)
.def("get_all_final_hypothesis", &LexiconDecoder::getAllFinalHypothesis);

py::class_<LexiconFreeDecoder>(m, "LexiconFreeDecoder")
.def(py::init<
LexiconFreeDecoderOptions,
const LMPtr,
const int,
const int,
const std::vector<float>&>())
.def("decode_begin", &LexiconFreeDecoder::decodeBegin)
.def(
"decode_step",
&LexiconFreeDecoder_decodeStep,
"emissions"_a,
"T"_a,
"N"_a)
.def("decode_end", &LexiconFreeDecoder::decodeEnd)
.def("decode", &LexiconFreeDecoder_decode, "emissions"_a, "T"_a, "N"_a)
.def("prune", &LexiconFreeDecoder::prune, "look_back"_a = 0)
.def(
"get_best_hypothesis",
&LexiconFreeDecoder::getBestHypothesis,
"look_back"_a = 0)
.def(
"get_all_final_hypothesis",
&LexiconFreeDecoder::getAllFinalHypothesis);


// FLASHLIGHT DICTIONARY
py::class_<Dictionary>(m, "Dictionary")
Expand All @@ -189,8 +139,5 @@ PYBIND11_MODULE(_torchaudio_decoder, m) {
"indices"_a);
m.def("create_word_dict", &createWordDict, "lexicon"_a);
m.def("load_words", &loadWords, "filename"_a, "max_words"_a = -1);
m.def("pack_replabels", &packReplabels, "tokens"_a, "dict"_a, "max_reps"_a);
m.def(
"unpack_replabels", &unpackReplabels, "tokens"_a, "dict"_a, "max_reps"_a);
#endif
}
207 changes: 0 additions & 207 deletions torchaudio/csrc/decoder/src/decoder/LexiconFreeDecoder.cpp

This file was deleted.

Loading

0 comments on commit 894e80c

Please sign in to comment.