diff --git a/Cargo.lock b/Cargo.lock index 77c7fd935b..6d21cab31e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -335,7 +335,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "arpabet" -version = "1.0.0" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arpabet_cmudict 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arpabet_parser 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arpabet_types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arpabet_cmudict" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arpabet_parser 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arpabet_types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arpabet_parser" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arpabet_types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arpabet_types" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -901,10 +934,10 @@ dependencies = [ [[package]] name = "grapheme_to_phoneme" -version = "0.0.3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arpabet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arpabet 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ndarray 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "ndarray-npy 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1467,6 +1500,15 @@ dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "phf_generator" version = "0.8.0" @@ -2222,13 +2264,13 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "anyhow 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "arpabet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arpabet 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "grapheme_to_phoneme 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "grapheme_to_phoneme 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "limitation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2472,7 +2514,10 @@ dependencies = [ "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum anyhow 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2494382e9ba43995f3c56359e518641f450f5c36feeb4632a75cde2ec297c867" "checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff" -"checksum arpabet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c76d18638cfaa15c3e7c521ef8a223614bee6b802433d788815347f28a0c4add" +"checksum arpabet 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d7bcdb435d536dfa262abef687e3e0517da921cb56bda1d56c6a03e1d7b8d16" +"checksum arpabet_cmudict 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "493246593f4f5b249ea42ff224e2e60655a305762959e45c788cca684b7b446f" +"checksum arpabet_parser 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a5b409d512e07dfabce3cdd864470fa6bf51e8aa762eeee3265e359f0687a9" +"checksum arpabet_types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3a6e204a66085d5d06c76b16bb2218d496ee291a5a0fad221a9c53b08862e4" "checksum ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" "checksum async-trait 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" @@ -2538,7 +2583,7 @@ dependencies = [ "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" -"checksum grapheme_to_phoneme 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df2915a3acab6ce0b29f2f88f63f5c53d67c7335705355e4ff017245bd4d83d3" +"checksum grapheme_to_phoneme 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1af33031ec99fd5585783e2caba8e017c01a9efb1318fed9fc9250420dd019f" "checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" @@ -2603,6 +2648,7 @@ dependencies = [ "checksum pest_generator 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" "checksum pest_meta 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" "checksum phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +"checksum phf_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" "checksum phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" "checksum phf_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" "checksum phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" diff --git a/tts_service/Cargo.toml b/tts_service/Cargo.toml index 9e0f224500..b1247567eb 100644 --- a/tts_service/Cargo.toml +++ b/tts_service/Cargo.toml @@ -40,7 +40,7 @@ toml = "0.5.6" #rusty_redis_rate_limiting = { git = "https://github.com/tinrab/rusty-redis-rate-limiting", rev = "46d95040708df92d46cef22d319d0182e12a2c0c" } # My libraries -arpabet = "1.0.0" -grapheme_to_phoneme = "0.0.3" +arpabet = "2.0.0" +grapheme_to_phoneme = "0.1.0" numerics = "0.0.1" sentence = "0.0.2" diff --git a/tts_service/deployed_models.toml b/tts_service/deployed_models.toml index e60a40a009..2c96a6e5fd 100644 --- a/tts_service/deployed_models.toml +++ b/tts_service/deployed_models.toml @@ -17,7 +17,7 @@ name = "Moistcr1tikal" slug = "moistcr1tikal" model_pipeline = "ArpabetGlowTtsMelgan" glow_tts = "glow-tts_moistcr1tikal_ljstx_2020.10.09_expr-1_chkpt-4858.torchjit" -melgan = "melgan_manyvoice5.0_2020-07-23_12d5838_10760.torchjit" # TODO: Needs custom vocoder +melgan = "melgan_moistcr1tikal_2020-10-10_d3b9647_12000.torchjit" # TODO: Train more [[speakers]] name = "Paula Deen" diff --git a/tts_service/models.toml b/tts_service/models.toml index 40d6e11718..e14d3e9316 100644 --- a/tts_service/models.toml +++ b/tts_service/models.toml @@ -43,7 +43,7 @@ name = "Moistcr1tikal" slug = "moistcr1tikal" model_pipeline = "ArpabetGlowTtsMelgan" glow_tts = "glow-tts_moistcr1tikal_ljstx_2020.10.09_expr-1_chkpt-4858.torchjit" -melgan = "melgan_manyvoice5.0_2020-07-23_12d5838_10760.torchjit" # TODO: Needs custom vocoder +melgan = "melgan_moistcr1tikal_2020-10-10_d3b9647_12000.torchjit" # TODO: Train more [[speakers]] name = "Paula Deen" diff --git a/tts_service/src/endpoints/speak/legacy_tts.rs b/tts_service/src/endpoints/speak/legacy_tts.rs index 843803fcd1..04a794707d 100644 --- a/tts_service/src/endpoints/speak/legacy_tts.rs +++ b/tts_service/src/endpoints/speak/legacy_tts.rs @@ -8,7 +8,7 @@ use actix_web::{ HttpResponse, }; -use arpabet::Arpabet; +use arpabet; use crate::AppState; use crate::model::old_model::TacoMelModel; use crate::text::arpabet::text_to_arpabet_encoding; @@ -48,8 +48,8 @@ pub async fn post_tts(_request: HttpRequest, let cleaned_text = clean_text(&text); - let arpabet = Arpabet::load_cmudict(); - let encoded = text_to_arpabet_encoding(arpabet, &cleaned_text); + let cmudict = arpabet::load_cmudict(); + let encoded = text_to_arpabet_encoding(cmudict, &cleaned_text); let sample_rate_hz = app_state.default_sample_rate_hz; diff --git a/tts_service/src/endpoints/speak/speak.rs b/tts_service/src/endpoints/speak/speak.rs index d8ed63bb91..b56db67c64 100644 --- a/tts_service/src/endpoints/speak/speak.rs +++ b/tts_service/src/endpoints/speak/speak.rs @@ -9,7 +9,7 @@ use actix_web::{ Result as ActixResult, }; -use arpabet::Arpabet; +use arpabet; use crate::AppState; use crate::database::model::NewSentence; use crate::endpoints::helpers::ip_address::get_request_ip; @@ -78,8 +78,8 @@ pub async fn post_speak(request: HttpRequest, info!("Melgan Model: {}", melgan_model); info!("Text: {}", text); - let arpabet = Arpabet::load_cmudict(); - let encoded = text_to_arpabet_encoding(arpabet, &cleaned_text); + let cmudict = arpabet::load_cmudict(); + let encoded = text_to_arpabet_encoding(cmudict, &cleaned_text); let tacotron = app_state.model_cache.get_or_load_arbabet_tacotron(&tacotron_model) .expect(&format!("Couldn't load tacotron model: {}", tacotron_model)); diff --git a/tts_service/src/main.rs b/tts_service/src/main.rs index ae69ec9a99..601216979a 100644 --- a/tts_service/src/main.rs +++ b/tts_service/src/main.rs @@ -32,6 +32,8 @@ use anyhow::Result as AnyhowResult; use actix::{Addr, SyncArbiter, Context}; use arpabet::Arpabet; +use arpabet::load_cmudict; +use arpabet::load_from_file as arpabet_load_from_file; use crate::database::connector::DatabaseConnector; use crate::database::sentence_recorder::SentenceRecorder; use crate::endpoints::index::get_root; @@ -295,15 +297,15 @@ pub fn main() -> AnyhowResult<()> { info!("Loading default CMUdict Arpabet..."); // Here we introduce silly internet words such as "lulz". // NB: The extras file takes precedence for any dictionary collisions. - let cmu_dict = Arpabet::load_cmudict(); + let cmu_dict = load_cmudict(); info!("Loading Arpabet extensions..."); - let extra_arpabet = Arpabet::load_from_file(&extras_filename)?; + let extra_arpabet = arpabet_load_from_file(&extras_filename)?; let arpabet = cmu_dict.combine(&extra_arpabet); arpabet.clone() }, None => { info!("Loading default CMUdict Arpabet..."); - Arpabet::load_cmudict().clone() + load_cmudict().clone() }, };