Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c12bd24
Set bufsize=0 in Popen to avoid buffer issues on stdin.write()
adamdotdevin Aug 24, 2018
d91bffe
Merge pull request #202 from statmuse/master
strob Aug 24, 2018
e2d6b57
change Python 3.7 reserved keyword "async" to "async_mode"
lvscar Sep 18, 2018
1aa3f58
Merge pull request #206 from lvscar/master
strob Sep 22, 2018
6c0bb96
added explicit utf-8 encoding to text file read and write
peteruhrig Jan 2, 2019
9d0ac7e
Decode last few frames after receiving "get-final"
dogancan Jan 6, 2019
f33b037
Merge pull request #213 from peteruhrig/patch-1
strob Jan 7, 2019
ce6873d
Merge pull request #214 from dogancan/patch-1
strob Jan 7, 2019
a928cac
'You shouldn't "make clean" before running "configure".' -dpovey
strob Jun 16, 2019
cc8125d
Fix CI syntax failure
cnbeining Sep 5, 2019
794b2ff
Merge pull request #229 from cnbeining/fix-ci
strob Sep 5, 2019
c3d3f0e
Allow the use of SoX if ffmpeg is not available
iskunk Jan 9, 2020
48aea6a
Merge pull request #240 from iskunk/sox
strob Jan 15, 2020
3d8718f
Improve guide
Mistobaan May 14, 2020
2148efc
Merge pull request #254 from Mistobaan/patch-1
strob May 14, 2020
bfbc668
update kaldi submodule to fix build on recent macos
strob Mar 14, 2022
f0314c9
fix DMG not finding FFMPEG
sarahayu Mar 2, 2023
e51b22d
bump version
sarahayu Mar 2, 2023
f29245a
Merge pull request #320 from sarahayu/bundling-for-ventura
strob Mar 5, 2023
6ac7e37
Update kaldi to latest version and remove OpenBLAS dep
strob Feb 2, 2024
04a614f
Merge pull request #327 from lowerquality/no-blas-new-kaldi
strob Apr 25, 2024
07ffdf1
update gentle homepage and add pipfile with locked python deps
strob Feb 16, 2025
f9beb67
remove unsupported language-model feature
strob Feb 16, 2025
087a3b7
Merge pull request #341 from lowerquality/new-website-and-model-link
strob Feb 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ script:
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push lowerquality/gentle:latest
docker push lowerquality/gentle:latest;
fi
12 changes: 12 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
twisted = "*"

[dev-packages]

[requires]
python_version = "3.10"
174 changes: 174 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ curl -F "audio=@audio.mp3" -F "transcript=@words.txt" "http://localhost:8765/tra
If you've downloaded the source code you can also run the aligner as a command line program:

```bash
git clone https://github.com/lowerquality/gentle.git
cd gentle
./install.sh
python3 align.py audio.mp3 words.txt
```

Expand Down
4 changes: 2 additions & 2 deletions align.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def on_progress(p):
logging.debug("%s: %s" % (k, v))


with open(args.txtfile) as fh:
with open(args.txtfile, encoding="utf-8") as fh:
transcript = fh.read()

resources = gentle.Resources()
Expand All @@ -54,7 +54,7 @@ def on_progress(p):
aligner = gentle.ForcedAligner(resources, transcript, nthreads=args.nthreads, disfluency=args.disfluency, conservative=args.conservative, disfluencies=disfluencies)
result = aligner.transcribe(wavfile, progress_cb=on_progress, logging=logging)

fh = open(args.output, 'w') if args.output else sys.stdout
fh = open(args.output, 'w', encoding="utf-8") if args.output else sys.stdout
fh.write(result.to_json(indent=2))
if args.output:
logging.info("output written to %s" % (args.output))
Empty file modified examples/gentle_curl.sh
100644 → 100755
Empty file.
5 changes: 2 additions & 3 deletions ext/install_kaldi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
cd kaldi/tools
make clean
make
./extras/install_openblas.sh
cd ../src
make clean
./configure --static --static-math=yes --static-fst=yes --use-cuda=no --openblas-root=../tools/OpenBLAS/install
# make clean (sometimes helpful after upgrading upstream?)
./configure --static --static-math=yes --static-fst=yes --use-cuda=no
make depend
cd ../../
41 changes: 21 additions & 20 deletions ext/k3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "online2/online-endpoint.h"
#include "fstext/fstext-lib.h"
#include "lat/lattice-functions.h"
#include "lat/lattice-functions-transition-model.h"
#include "lat/word-align-lattice.h"
#include "nnet3/decodable-simple-looped.h"

Expand All @@ -15,7 +16,7 @@
#endif

const int arate = 8000;

void ConfigFeatureInfo(kaldi::OnlineNnet2FeaturePipelineInfo& info,
std::string ivector_model_dir) {
// Configure inline to avoid absolute paths in ".conf" files
Expand All @@ -32,7 +33,7 @@ void ConfigFeatureInfo(kaldi::OnlineNnet2FeaturePipelineInfo& info,
&info.ivector_extractor_info.diag_ubm);
ReadKaldiObject(ivector_model_dir + "/final.ie",
&info.ivector_extractor_info.extractor);

info.ivector_extractor_info.num_gselect = 5;
info.ivector_extractor_info.min_post = 0.025;
info.ivector_extractor_info.posterior_scale = 0.1;
Expand Down Expand Up @@ -77,12 +78,12 @@ int main(int argc, char *argv[]) {
using namespace kaldi;
using namespace fst;

setbuf(stdout, NULL);
setbuf(stdout, NULL);

std::string nnet_dir = "exp/tdnn_7b_chain_online";
std::string graph_dir = nnet_dir + "/graph_pp";
std::string fst_rxfilename = graph_dir + "/HCLG.fst";

if(argc == 3) {
nnet_dir = argv[1];
graph_dir = nnet_dir + "/graph_pp";
Expand All @@ -92,7 +93,7 @@ int main(int argc, char *argv[]) {
usage();
return EXIT_FAILURE;
}

#ifdef HAVE_CUDA
fprintf(stdout, "Cuda enabled\n");
CuDevice &cu_device = CuDevice::Instantiate();
Expand All @@ -102,7 +103,7 @@ int main(int argc, char *argv[]) {
#endif
const std::string ivector_model_dir = nnet_dir + "/ivector_extractor";
const std::string nnet3_rxfilename = nnet_dir + "/final.mdl";

const std::string word_syms_rxfilename = graph_dir + "/words.txt";
const string word_boundary_filename = graph_dir + "/phones/word_boundary.int";
const string phone_syms_rxfilename = graph_dir + "/phones.txt";
Expand All @@ -116,7 +117,7 @@ int main(int argc, char *argv[]) {
ConfigDecoding(nnet3_decoding_config);
OnlineEndpointConfig endpoint_config;
ConfigEndpoint(endpoint_config);


BaseFloat frame_shift = feature_info.FrameShiftInSeconds();

Expand All @@ -133,16 +134,16 @@ int main(int argc, char *argv[]) {
nnet_simple_looped_opts.acoustic_scale = 1.0; // changed from 0.1?

nnet3::DecodableNnetSimpleLoopedInfo de_nnet_simple_looped_info(nnet_simple_looped_opts, &am_nnet);

fst::Fst<fst::StdArc> *decode_fst = ReadFstKaldi(fst_rxfilename);

fst::SymbolTable *word_syms =
fst::SymbolTable::ReadText(word_syms_rxfilename);

fst::SymbolTable* phone_syms =
fst::SymbolTable::ReadText(phone_syms_rxfilename);


OnlineIvectorExtractorAdaptationState adaptation_state(feature_info.ivector_extractor_info);

OnlineNnet2FeaturePipeline feature_pipeline(feature_info);
Expand All @@ -151,7 +152,7 @@ int main(int argc, char *argv[]) {
OnlineSilenceWeighting silence_weighting(
trans_model,
feature_info.silence_weighting_config);

SingleUtteranceNnet3Decoder decoder(nnet3_decoding_config,
trans_model,
de_nnet_simple_looped_info,
Expand All @@ -172,7 +173,7 @@ int main(int argc, char *argv[]) {
else if(strcmp(cmd,"reset\n") == 0) {
feature_pipeline.~OnlineNnet2FeaturePipeline();
new (&feature_pipeline) OnlineNnet2FeaturePipeline(feature_info);

decoder.~SingleUtteranceNnet3Decoder();
new (&decoder) SingleUtteranceNnet3Decoder(nnet3_decoding_config,
trans_model,
Expand All @@ -188,11 +189,11 @@ int main(int argc, char *argv[]) {
fgets(cmd, sizeof(cmd), stdin);
sscanf(cmd, "%d\n", &chunk_len);

int16_t audio_chunk[chunk_len];
int16_t audio_chunk[chunk_len];
Vector<BaseFloat> wave_part = Vector<BaseFloat>(chunk_len);

fread(&audio_chunk, 2, chunk_len, stdin);

// We need to copy this into the `wave_part' Vector<BaseFloat> thing.
// From `gst-audio-source.cc' in gst-kaldi-nnet2
for (int i = 0; i < chunk_len ; ++i) {
Expand All @@ -214,14 +215,14 @@ int main(int argc, char *argv[]) {
fprintf(stdout, "ok\n");
}
else if(strcmp(cmd, "get-final\n") == 0) {
feature_pipeline.InputFinished(); // XXX: this is new: what does it do?

feature_pipeline.InputFinished(); // Computes last few frames of input
decoder.AdvanceDecoding(); // Decodes remaining frames
decoder.FinalizeDecoding();

Lattice final_lat;
decoder.GetBestPath(true, &final_lat);
CompactLattice clat;
ConvertLattice(final_lat, &clat);
ConvertLattice(final_lat, &clat);

// Compute prons alignment (see: kaldi/latbin/nbest-to-prons.cc)
CompactLattice aligned_clat;
Expand Down Expand Up @@ -254,12 +255,12 @@ int main(int argc, char *argv[]) {
}

fprintf(stdout, "done with words\n");

}
else {

fprintf(stderr, "unknown command %s\n", cmd);

}
}
}
2 changes: 1 addition & 1 deletion ext/kaldi
Submodule kaldi updated 5387 files
Loading