diff --git a/Cargo.lock b/Cargo.lock index 38cfed1798..d066b84f44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -289,33 +289,6 @@ dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "aligned_alloc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "alsa-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "anyhow" version = "1.0.30" @@ -423,28 +396,6 @@ name = "base64" version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bindgen" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bitflags" version = "1.2.1" @@ -468,11 +419,6 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "build_const" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byteorder" version = "1.3.2" @@ -531,14 +477,6 @@ name = "cc" version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cexpr" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cfg-if" version = "0.1.10" @@ -555,30 +493,6 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "clang-sys" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clap" -version = "2.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -595,11 +509,6 @@ dependencies = [ "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "color_quant" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "combine" version = "3.8.1" @@ -617,52 +526,6 @@ name = "copyless" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "coreaudio-rs" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "coreaudio-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "coreaudio-sys" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cpal" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "alsa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "coreaudio-rs 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crc" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crc32fast" version = "1.2.0" @@ -671,37 +534,6 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-deque" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-utils" version = "0.7.0" @@ -740,15 +572,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "deflate" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "derive_more" version = "0.99.2" @@ -812,18 +635,6 @@ dependencies = [ "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "env_logger" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "env_logger" version = "0.7.1" @@ -836,11 +647,6 @@ dependencies = [ "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "failure" version = "0.1.6" @@ -861,22 +667,6 @@ dependencies = [ "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "filetime" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fixedbitset" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "flate2" version = "1.0.13" @@ -1021,20 +811,6 @@ dependencies = [ "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gif" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "h2" version = "0.2.1" @@ -1053,11 +829,6 @@ dependencies = [ "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "half" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "heck" version = "0.3.1" @@ -1131,22 +902,6 @@ dependencies = [ "unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "image" -version = "0.23.0-preview.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jpeg-decoder 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "png 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tiff 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "indexmap" version = "1.3.0" @@ -1155,14 +910,6 @@ dependencies = [ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "inflate" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "iovec" version = "0.1.4" @@ -1195,15 +942,6 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "jpeg-decoder" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "kernel32-sys" version = "0.2.2" @@ -1228,15 +966,6 @@ name = "libc" version = "0.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "libz-sys" version = "1.0.25" @@ -1288,11 +1017,6 @@ dependencies = [ "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "match_cfg" version = "0.1.0" @@ -1321,24 +1045,6 @@ name = "memchr" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "memoffset" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "metadeps" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "mime" version = "0.3.14" @@ -1400,11 +1106,6 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "multimap" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "mysqlclient-sys" version = "0.2.4" @@ -1601,24 +1302,11 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "petgraph" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "phf" version = "0.8.0" @@ -1692,17 +1380,6 @@ name = "pkg-config" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "png" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", - "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "podio" version = "0.1.6" @@ -1728,14 +1405,6 @@ name = "proc-macro-nested" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "proc-macro2" version = "1.0.7" @@ -1744,67 +1413,11 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "prost" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prost-build" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prost-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prost-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "1.0.2" @@ -1970,28 +1583,6 @@ name = "rawpointer" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rayon" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -2042,14 +1633,6 @@ name = "regex-syntax" version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "remove_dir_all" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "resolv-conf" version = "0.6.2" @@ -2064,14 +1647,6 @@ name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-hash" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc_version" version = "0.2.3" @@ -2085,11 +1660,6 @@ name = "ryu" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "sample" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "schannel" version = "0.1.16" @@ -2107,11 +1677,6 @@ dependencies = [ "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" version = "1.0.0" @@ -2183,11 +1748,6 @@ name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "shlex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "signal-hook-registry" version = "1.2.0" @@ -2231,26 +1791,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "stdweb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "syn" version = "1.0.13" @@ -2272,39 +1812,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tacotron_melgan" -version = "0.0.1" -dependencies = [ - "hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", - "tch 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tacotron_tensorflow" -version = "0.0.1" -dependencies = [ - "hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "image 0.23.0-preview.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sample 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tensorflow 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tar" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tch" version = "0.1.7" @@ -2319,57 +1826,6 @@ dependencies = [ "zip 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tensorflow" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aligned_alloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tensorflow-internal-macros 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tensorflow-sys 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tensorflow-internal-macros" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tensorflow-sys" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "termcolor" version = "1.0.5" @@ -2378,14 +1834,6 @@ dependencies = [ "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "thread_local" version = "1.0.1" @@ -2402,16 +1850,6 @@ dependencies = [ "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tiff" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "time" version = "0.1.42" @@ -2541,11 +1979,6 @@ dependencies = [ "tokio 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "toml" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "toml" version = "0.5.6" @@ -2663,16 +2096,6 @@ name = "unicode-segmentation" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.2.0" @@ -2729,11 +2152,6 @@ name = "vcpkg" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "version_check" version = "0.1.5" @@ -2748,22 +2166,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "voder" version = "0.0.0" -[[package]] -name = "voice_conversion_sidecar" -version = "0.1.0" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "cpal 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wavy 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "world-sys 0.1.0", - "zmq 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "void" version = "1.0.2" @@ -2774,31 +2176,6 @@ name = "wasi" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "wavy" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "which" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "which" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "widestring" version = "0.4.0" @@ -2866,14 +2243,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "world-sys" -version = "0.1.0" -dependencies = [ - "bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -2883,14 +2252,6 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "xattr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "zip" version = "0.5.3" @@ -2903,26 +2264,6 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "zmq" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "zmq-sys 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "zmq-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [metadata] "checksum actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09e55f0a5c2ca15795035d90c46bd0e73a5123b72f68f12596d6ba5282051380" "checksum actix-connect 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2b61480a8d30c94d5c883d79ef026b02ad6809931b0a4bb703f9545cd8c986" @@ -2942,9 +2283,6 @@ dependencies = [ "checksum actix-web-codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de0878b30e62623770a4713a6338329fd0119703bafc211d3e4144f4d4a7bdd5" "checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" -"checksum aligned_alloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9dcebfb002ccde769c15bc841d0d5548a90e80fcd2ffed5131339e8074746f0a" -"checksum alsa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b0edcbbf9ef68f15ae1b620f722180b82a98b6f0628d30baa6b8d2a5abc87d58" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "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" @@ -2958,11 +2296,9 @@ dependencies = [ "checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" "checksum base64 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e223af0dc48c96d4f8342ec01a4974f139df863896b316681efd36742f22cc67" -"checksum bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" "checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38" @@ -2971,29 +2307,16 @@ dependencies = [ "checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" "checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76" -"checksum cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" -"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" -"checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" "checksum combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" "checksum copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127" -"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" -"checksum coreaudio-rs 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f229761965dad3e9b11081668a6ea00f1def7aa46062321b5ec245b834f6e491" -"checksum coreaudio-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e8f5954c1c7ccb55340443e8b29fca24013545a5e7d72c1ca7db4fc02b982ce" -"checksum cpal 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ded070249be850b5b59e1e3a44a70b8ae395e0e5c65b487131d8909a8208120" -"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" -"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" -"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" "checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" "checksum curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06aa71e9208a54def20792d877bc663d6aae0732b9852e612c4a933177c31283" "checksum curl-sys 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "f659f3ffac9582d6177bb86d1d2aa649f4eb9d0d4de9d03ccc08b402832ea340" -"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" "checksum derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2159be042979966de68315bce7034bb000c775f22e3e834e1c52ff78f041cae8" "checksum diesel 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "33d7ca63eb2efea87a7f56a283acc49e2ce4b2bd54adf7465dc1d81fef13d8fc" "checksum diesel_derives 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" @@ -3001,13 +2324,9 @@ dependencies = [ "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" "checksum enum-as-inner 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "900a6c7fbe523f4c2884eaf26b57b81bb69b6810a01a236390a7ac021d09492e" -"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" -"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d" -"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" @@ -3025,10 +2344,7 @@ dependencies = [ "checksum futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" -"checksum gif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1" -"checksum half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ff54597ea139063f4225f1ec47011b03c9de4a486957ff3fc506881dac951d0" "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" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" @@ -3038,40 +2354,32 @@ dependencies = [ "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -"checksum image 0.23.0-preview.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b322315de68cd2c36aa1e4e15763affb93c38724828a1652540992338251928" "checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2" -"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum jpeg-decoder 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0256f0aec7352539102a9efbcb75543227b7ab1117e0f95450023af730128451" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum limitation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e415413963930f7050f21994bfd336dc75ef8b5b3b142e99c55b72b61f726d5" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" -"checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf" "checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599" "checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151" "checksum mysqlclient-sys 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7e9637d93448044078aaafea7419aed69d301b4a12bcc4aa0ae856eb169bef85" "checksum ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25b001fc2f5df269365fb77bd8396ce6b1f61c9848f7f088c25e57494bacc57b" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" @@ -3092,9 +2400,7 @@ dependencies = [ "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" -"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" "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" @@ -3104,19 +2410,12 @@ dependencies = [ "checksum pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" "checksum pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" -"checksum png 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "247cb804bd7fc86d0c2b153d1374265e67945875720136ca8fe451f11c6aed52" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc" -"checksum prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96d14b1c185652833d24aaad41c5832b0be5616a590227c1fbff57c616754b23" -"checksum prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb788126ea840817128183f8f603dce02cb7aea25c2a0b764359d8e20010702e" -"checksum prost-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e7dc378b94ac374644181a2247cebf59a6ec1c88b49ac77f3a94b86b79d0e11" -"checksum prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1de482a366941c8d56d19b650fac09ca08508f2a696119ee7513ad590c8bac6f" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum r2d2 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1497e40855348e4a8a40767d8e55174bce1e445a3ac9254ad44ad468ee0485af" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" @@ -3135,23 +2434,17 @@ dependencies = [ "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" -"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" -"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redis 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bb1079bc5692c03e1479bb7086ac870ac2aaf7115b5e72d314c01368f1a747e" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" "checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" -"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum sample 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc0966ad788ec7289562643e05c611b7853e0618b7f9306aafd2fc727abfe168" "checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" "checksum scheduled-thread-pool 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0988d7fdf88d5e5fcf5923a0f1e8ab345f3e98ab4bc6bc45a2d5ff7f7458fbf6" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" @@ -3161,29 +2454,18 @@ dependencies = [ "checksum serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)" = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" "checksum siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "83da420ee8d1a89e640d0948c646c1c088758d3a3c538f943bfa97bdac17929d" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" -"checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" -"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" "checksum tch 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3da599d3cbdfc08755aec52bfc0c1360ebe6613c13434aef7eb56f05da0b2e5" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum tensorflow 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5334282bbf65c867731c9950dfdaecfb5f78055c2680df4ee130391d196b908" -"checksum tensorflow-internal-macros 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f4b9e069af8bc28b249cbc4197211f285f8ea06de8aa9801fe218b18063a429" -"checksum tensorflow-sys 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c5b0eb140a616636edff2cbd246700a31bd0404474c8478040682f478b84f3a9" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" -"checksum tiff 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "002351e428db1eb1d8656d4ca61947c3519ac3191e1c804d4600cd32093b77ad" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" "checksum tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" @@ -3194,7 +2476,6 @@ dependencies = [ "checksum tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" "checksum tokio-uds 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" -"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum torch-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f57908de000ae3932dff570eea87586bbf49d44efa81fb1a5580e79ef973da43" "checksum trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2a7f3a2ab8a919f5eca52a468866a67ed7d3efa265d48a652a9a3452272b413f" @@ -3203,8 +2484,6 @@ dependencies = [ "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf" "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" -"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" @@ -3212,14 +2491,10 @@ dependencies = [ "checksum v_escape_derive 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae" "checksum v_htmlescape 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e33e939c0d8cf047514fb6ba7d5aac78bc56677a6938b2ee67000b91f2e97e41" "checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" -"checksum wavy 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "feea5ba5ef38798f371bc995c1ca542d5162923d1bcbdaaf89916042bb61f006" -"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" -"checksum which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5475d47078209a02e60614f7ba5e645ef3ed60f771920ac1906d7c1cc65024c8" "checksum widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" @@ -3231,7 +2506,4 @@ dependencies = [ "checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" "checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" "checksum zip 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c21bb410afa2bd823a047f5bda3adb62f51074ac7e06263b2c97ecdd47e9fc6" -"checksum zmq 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aad98a7a617d608cd9e1127147f630d24af07c7cd95ba1533246d96cbdd76c66" -"checksum zmq-sys 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d33a2c51dde24d5b451a2ed4b488266df221a5eaee2ee519933dc46b9a9b3648" diff --git a/Cargo.toml b/Cargo.toml index 40aea7e427..daaf3f5814 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,16 +6,10 @@ authors = [ "Brandon Thomas ", [workspace] members = [ - "tacotron_melgan", - "tacotron_tensorflow", "tts_service", - "voice_converter_sidecar", ] default-members = [ - "tacotron_melgan", - "tacotron_tensorflow", "tts_service", - "voice_converter_sidecar", ] diff --git a/data/mels/LJ002-0320.mel b/data/mels/LJ002-0320.mel deleted file mode 100644 index 685ed5f5f5..0000000000 Binary files a/data/mels/LJ002-0320.mel and /dev/null differ diff --git a/data/mels/trump_2018_02_15-001.mel b/data/mels/trump_2018_02_15-001.mel deleted file mode 100644 index 7f6bf9d74c..0000000000 Binary files a/data/mels/trump_2018_02_15-001.mel and /dev/null differ diff --git a/data/text/tacotron_text_sequence.pt b/data/text/tacotron_text_sequence.pt deleted file mode 100644 index e1ff191c4f..0000000000 Binary files a/data/text/tacotron_text_sequence.pt and /dev/null differ diff --git a/deployment.yaml b/deployment.yaml deleted file mode 100644 index 7ff7025d6f..0000000000 --- a/deployment.yaml +++ /dev/null @@ -1,153 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: tts - namespace: mumble -spec: - type: LoadBalancer - selector: - app: tts - ports: - - name: http - protocol: TCP - port: 80 - targetPort: 12345 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tts - namespace: mumble - labels: - app: tts -spec: - replicas: 3 # 4 would never launch with cluster configs as of 2020-06-20 - selector: - matchLabels: - app: tts - template: - metadata: - labels: - app: tts - annotations: - bump: '1' - spec: - terminationGracePeriodSeconds: 60 - imagePullSecrets: - - name: regcred - volumes: - - name: downloads - hostPath: - path: /downloads - type: DirectoryOrCreate - containers: - - name: downloader - image: docker.pkg.github.com/ml-applications/do-spaces-downloader/do-spaces-downloader:58ec25e3aa3c - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: ACCESS_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_access_key_id - - name: SECRET_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_secret_access_key - - name: BUCKET_NAME - value: "upload-models" - - name: REGION - value: "nyc3" - # NB: These filesystem paths are strage because they need to be on the - # same filesystem. Rust can't handle moving files between filesystems yet: - # "Error: Invalid cross-device link (os error 18)" - - name: DOWNLOAD_DIR - value: "/data/downloads/downloaded" - - name: TEMP_DIR - value: "/data/downloads/tmp" - - name: MATCH_PATH - value: "" # previously "models/" - - name: SLEEP_TIMEOUT - value: "300" - - name: RUST_LOG - value: "info,do_spaces_downloader=debug" - - name: tts - # NB: Container builds are triggered by Github Actions - - # The following image runs a non-Arpabet engine that can run an - # LSpeech model that sounds 100% amazing - # image: docker.pkg.github.com/echelon/voder/tts-service:6b5c22567614 - # - image: docker.pkg.github.com/ml-applications/voder/tts-service:60211d6df69a - resources: - limits: - # 4 GiB (4096 MiB) - # 3 GiB (3072 MiB) - # 2 GiB (2048 MiB) - memory: "4Gi" # Just under 4 GB - cpu: "700m" # 700 milliCPU - requests: - #memory: "50Mi" - we're getting evicted! - # Warning FailedScheduling default-scheduler 0/6 nodes are available: 6 Insufficient memory. - # Normal NotTriggerScaleUp 29s cluster-autoscaler pod didn't trigger scale-up (it wouldn't fit if - # a new node is added): - # - memory: "4Gi" # Just under 4 GB - cpu: "700m" # 700 milliCPU - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: db-secrets - key: url - - name: BIND_ADDRESS - value: "0.0.0.0:12345" - - name: NUM_WORKERS - value: "5" - - name: ASSET_DIRECTORY - value: "/data/downloads/downloaded/frontend/build" # TODO - - name: MODEL_CONFIG_FILE - value: "/data/downloads/downloaded/models/deployed_models.toml" - - name: MAX_CHAR_LEN - value: "220" - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - ports: - - containerPort: 12345 - protocol: TCP - # If the readiness probe fails, the container is removed from the service. - readinessProbe: - httpGet: - path: /readiness - port: 12345 - # Check every two seconds. - periodSeconds: 2 - # Warmup period before first check. - initialDelaySeconds: 5 - # How long it takes for the probe to time out. - timeoutSeconds: 1 - # Number of attempts before the pod is marked unready - failureThreshold: 1 - # If the liveness probe fails, the container is subject to its restart policy - # Since the container can crash on its own, we'll omit this. - # livenessProbe: - # httpGet: - # path: /liveness - # port: 12345 - # initialDelaySeconds: 20 - # periodSeconds: 10 - # timeoutSeconds: 3 - # failureThreshold: 3 diff --git a/deployment_multi.yaml b/deployment_multi.yaml deleted file mode 100644 index 8cefc4c1d1..0000000000 --- a/deployment_multi.yaml +++ /dev/null @@ -1,358 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: service-trump - namespace: vocodes -spec: - #type: LoadBalancer - #type: ClusterIP - selector: - #model: trump - app: tts-trump - ports: - - name: http - protocol: TCP - port: 12345 - targetPort: 12345 - ---- - -kind: Service -apiVersion: v1 -metadata: - name: service-other - namespace: vocodes -spec: - #type: LoadBalancer - selector: - model: other - ports: - - name: http - protocol: TCP - port: 80 - targetPort: 12345 ---- - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tts-service-proxy - namespace: vocodes - labels: - app: tts-service-proxy -spec: - replicas: 1 - selector: - matchLabels: - app: tts-service-proxy - template: - metadata: - labels: - app: tts-service-proxy - annotations: - bump: '2' - spec: - terminationGracePeriodSeconds: 60 - imagePullSecrets: - - name: regcred - containers: - - name: tts-service-proxy - image: docker.pkg.github.com/ml-applications/voder-proxy/tts-service-proxy:67d094d38ef4 - #command: ["./launch.sh"] - #args: [""] - #command: ["sleep"] - #args: ["300000"] - env: - - name: ROUTE_ONE - value: "http://10.245.22.66:80" - - name: ROUTE_TWO - value: "http://10.245.179.52:80" - - name: RUST_LOG - value: "info" - ports: - - containerPort: 13900 - protocol: TCP - ---- - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tts-trump - namespace: vocodes - labels: - app: tts-trump - #model: trump -spec: - replicas: 1 # 4 would never launch with cluster configs as of 2020-06-20 - selector: - matchLabels: - app: tts-trump - template: - metadata: - labels: - app: tts-trump - annotations: - bump: '1' - spec: - terminationGracePeriodSeconds: 60 - imagePullSecrets: - - name: regcred - volumes: - - name: downloads - hostPath: - path: /downloads - type: DirectoryOrCreate - containers: - - name: downloader - image: docker.pkg.github.com/ml-applications/do-spaces-downloader/do-spaces-downloader:58ec25e3aa3c - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: ACCESS_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_access_key_id - - name: SECRET_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_secret_access_key - - name: BUCKET_NAME - value: "upload-models" - - name: REGION - value: "nyc3" - # NB: These filesystem paths are strage because they need to be on the - # same filesystem. Rust can't handle moving files between filesystems yet: - # "Error: Invalid cross-device link (os error 18)" - - name: DOWNLOAD_DIR - value: "/data/downloads/downloaded" - - name: TEMP_DIR - value: "/data/downloads/tmp" - - name: MATCH_PATH - value: "" # previously "models/" - - name: SLEEP_TIMEOUT - value: "300" - - name: RUST_LOG - value: "info,do_spaces_downloader=debug" - - name: tts - # NB: Container builds are triggered by Github Actions - - # The following image runs a non-Arpabet engine that can run an - # LSpeech model that sounds 100% amazing - # image: docker.pkg.github.com/echelon/voder/tts-service:6b5c22567614 - # - image: docker.pkg.github.com/ml-applications/voder/tts-service:60211d6df69a - resources: - limits: - # 4 GiB (4096 MiB) - # 3 GiB (3072 MiB) - # 2 GiB (2048 MiB) - memory: "4Gi" # Just under 4 GB - cpu: "700m" # 700 milliCPU - requests: - #memory: "50Mi" - we're getting evicted! - # Warning FailedScheduling default-scheduler 0/6 nodes are available: 6 Insufficient memory. - # Normal NotTriggerScaleUp 29s cluster-autoscaler pod didn't trigger scale-up (it wouldn't fit if - # a new node is added): - # - memory: "2Gi" # Just under 4 GB - cpu: "300m" # 700 milliCPU - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: db-secrets - key: url - - name: BIND_ADDRESS - value: "0.0.0.0:12345" - - name: NUM_WORKERS - value: "5" - - name: ASSET_DIRECTORY - value: "/data/downloads/downloaded/frontend/build" # TODO - - name: MODEL_CONFIG_FILE - value: "/data/downloads/downloaded/models/deployed_models.toml" - - name: MAX_CHAR_LEN - value: "220" - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - ports: - - containerPort: 12345 - protocol: TCP - # If the readiness probe fails, the container is removed from the service. - readinessProbe: - httpGet: - path: /readiness - port: 12345 - # Check every two seconds. - periodSeconds: 2 - # Warmup period before first check. - initialDelaySeconds: 5 - # How long it takes for the probe to time out. - timeoutSeconds: 1 - # Number of attempts before the pod is marked unready - failureThreshold: 1 - # If the liveness probe fails, the container is subject to its restart policy - # Since the container can crash on its own, we'll omit this. - # livenessProbe: - # httpGet: - # path: /liveness - # port: 12345 - # initialDelaySeconds: 20 - # periodSeconds: 10 - # timeoutSeconds: 3 - # failureThreshold: 3 - # - ---- - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tts-other - namespace: vocodes - labels: - app: tts-other - model: other -spec: - replicas: 1 # 4 would never launch with cluster configs as of 2020-06-20 - selector: - matchLabels: - app: tts-other - template: - metadata: - labels: - app: tts-other - annotations: - bump: '1' - spec: - terminationGracePeriodSeconds: 60 - imagePullSecrets: - - name: regcred - volumes: - - name: downloads - hostPath: - path: /downloads - type: DirectoryOrCreate - containers: - - name: downloader - image: docker.pkg.github.com/ml-applications/do-spaces-downloader/do-spaces-downloader:58ec25e3aa3c - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: ACCESS_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_access_key_id - - name: SECRET_KEY - valueFrom: - secretKeyRef: - name: spaces-secrets - key: aws_secret_access_key - - name: BUCKET_NAME - value: "upload-models" - - name: REGION - value: "nyc3" - # NB: These filesystem paths are strage because they need to be on the - # same filesystem. Rust can't handle moving files between filesystems yet: - # "Error: Invalid cross-device link (os error 18)" - - name: DOWNLOAD_DIR - value: "/data/downloads/downloaded" - - name: TEMP_DIR - value: "/data/downloads/tmp" - - name: MATCH_PATH - value: "" # previously "models/" - - name: SLEEP_TIMEOUT - value: "300" - - name: RUST_LOG - value: "info,do_spaces_downloader=debug" - - name: tts - # NB: Container builds are triggered by Github Actions - - # The following image runs a non-Arpabet engine that can run an - # LSpeech model that sounds 100% amazing - # image: docker.pkg.github.com/echelon/voder/tts-service:6b5c22567614 - # - image: docker.pkg.github.com/ml-applications/voder/tts-service:60211d6df69a - resources: - limits: - # 4 GiB (4096 MiB) - # 3 GiB (3072 MiB) - # 2 GiB (2048 MiB) - memory: "4Gi" # Just under 4 GB - cpu: "700m" # 700 milliCPU - requests: - #memory: "50Mi" - we're getting evicted! - # Warning FailedScheduling default-scheduler 0/6 nodes are available: 6 Insufficient memory. - # Normal NotTriggerScaleUp 29s cluster-autoscaler pod didn't trigger scale-up (it wouldn't fit if - # a new node is added): - # - memory: "2Gi" # Just under 4 GB - cpu: "300m" # 700 milliCPU - volumeMounts: - - name: downloads - mountPath: /data/downloads - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: db-secrets - key: url - - name: BIND_ADDRESS - value: "0.0.0.0:12345" - - name: NUM_WORKERS - value: "5" - - name: ASSET_DIRECTORY - value: "/data/downloads/downloaded/frontend/build" # TODO - - name: MODEL_CONFIG_FILE - value: "/data/downloads/downloaded/models/deployed_models.toml" - - name: MAX_CHAR_LEN - value: "220" - command: ["./launch.sh"] - args: [""] - #command: ["sleep"] - #args: ["300000"] - ports: - - containerPort: 12345 - protocol: TCP - # If the readiness probe fails, the container is removed from the service. - readinessProbe: - httpGet: - path: /readiness - port: 12345 - # Check every two seconds. - periodSeconds: 2 - # Warmup period before first check. - initialDelaySeconds: 5 - # How long it takes for the probe to time out. - timeoutSeconds: 1 - # Number of attempts before the pod is marked unready - failureThreshold: 1 - # If the liveness probe fails, the container is subject to its restart policy - # Since the container can crash on its own, we'll omit this. - # livenessProbe: - # httpGet: - # path: /liveness - # port: 12345 - # initialDelaySeconds: 20 - # periodSeconds: 10 - # timeoutSeconds: 3 - # failureThreshold: 3 diff --git a/pod_cleanup.sh b/pod_cleanup.sh deleted file mode 100755 index f5f4232790..0000000000 --- a/pod_cleanup.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# For some reason, pods aren't going away after they're marked for deletion. -# They're getting stuck as "Terminating" for days at a time, leading to an -# accumulation of limitless stale pods. -# -# I'm not sure what the cause is, but there are lots of reports of this on -# Google. -# -# One thing I uncovered (in kubernetes events) that might be related: -# -# 22m Normal TaintManagerEviction pod/{name} Marking for deletion Pod {name} -# -# But I honestly don't know what is causing this. Perhaps the fuse filesytem? -# Perhaps DigitalOcean weirdness? -# -# This stop-gap non-solution is taken from https://stackoverflow.com/q/50336665 -# -function cleanup_pods() { - namespace=$1 - - echo "Cleanup pods in namespace ${namespace}" - - pods=$( kubectl -n ${namespace} get pods | grep -v Running | tail -n +2 | awk -F " " '{print $1}' ) - - for pod in $pods; - do - echo "Deleting pod ${pod}" - kubectl -n ${namespace} delete pod $pod --grace-period=0 --force 2> /dev/null - done -} - -cleanup_pods "mumble" -cleanup_pods "trumped" - diff --git a/tacotron_melgan/Cargo.toml b/tacotron_melgan/Cargo.toml deleted file mode 100644 index 5f219f846e..0000000000 --- a/tacotron_melgan/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "tacotron_melgan" -version = "0.0.1" -authors = [ "Brandon Thomas ", - "Brandon Thomas " ] - -[[bin]] -name = "tacotron_melgan" -path = "src/main.rs" - -[dependencies] -hound = "3.4.0" # wav codec -rand = "0.7.2" # random sampling for testing (TODO: temp) -#rocket = "0.4.2" # http server -#rocket_contrib = "0.4.2" # http server -serde = "1.0.104" -serde_derive = "1.0.104" -serde_json = "1.0.44" -tch = "0.1.3" # libtorch bindings (pytorch) diff --git a/tacotron_melgan/README.md b/tacotron_melgan/README.md deleted file mode 100644 index 65b4e71463..0000000000 --- a/tacotron_melgan/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Tacotron + Melgan -================= -Runs Tacotron2 + Melgan as a fully end-to-end TTS system. - -Compiling ---------- -Libtorch has been problematic, so I have a good version here: - -``` -export LIBTORCH=/home/bt/dev/3rd/libtorch -export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH -``` - -This was downloaded from -https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.3.1%2Bcpu.zip - diff --git a/tacotron_melgan/convert_mel_to_torch.py b/tacotron_melgan/convert_mel_to_torch.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tacotron_melgan/jit_containerize_tensor.py b/tacotron_melgan/jit_containerize_tensor.py deleted file mode 100755 index 5d3f61aa70..0000000000 --- a/tacotron_melgan/jit_containerize_tensor.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 -# parts taken from: https://github.com/pytorch/pytorch/issues/20356#issuecomment-545572400 -""" -SUPER STUPID HACK - -libtensor/tch.rs do not seem to be able to load tensors saved from -mytorch with `foo_tensor.save()`. This gets around the problem by -wrapping tensors in JIT containers that can be loaded. The source -tensor can be pulled out by calling `forward` on the module. -""" - -import torch -import torch.nn as nn -import torch.nn.functional as F - -import sys -from collections import OrderedDict - -# If set, change the tensor type. -output_type = 'double' - -if output_type == 'float': - torch.set_default_tensor_type('torch.FloatTensor') -elif output_type == 'double': - torch.set_default_tensor_type('torch.DoubleTensor') - -def cuda_to_cpu(model): - """Recursively make everything non-CUDA""" - if isinstance(model, dict) or isinstance(model, OrderedDict): - for key, value in model.items(): - model[key] = cuda_to_cpu(value) - return model - if isinstance(model, list): - for i, value in enumerate(model): - model[i] = cuda_to_cpu(value) - elif isinstance(model, torch.Tensor): - return model.cpu() - else: - return model - -class Container(torch.nn.Module): - def __init__(self, payload): - super(Container, self).__init__() - self.tensor = payload - def forward(self, x): - return self.tensor # XXX: This is how we return the wrapped tensor. Such a hack. - -def main(filename): - output_filename = '{}.containerized.pt'.format(filename) - - print('Loading tensor file: {}'.format(filename)) - tensor = torch.load(filename, map_location=torch.device('cpu')) - - if output_type == 'float': - tensor = tensor.float() - elif output_type == 'double': - tensor = tensor.double() - - if not isinstance(tensor, torch.Tensor): - type_ = type(tensor) - raise Exception('File should contain object of type Tensor, not {}'.format(type_)) - - print('Switching device from CUDA to CPU (if necessary)') - tensor = cuda_to_cpu(tensor) - - print('Containerizing. Libtorch can\'t read raw tensors from ' \ - + 'pytorch (at least I don\'t know how)') - - container = Container(tensor) - jit_container = torch.jit.script(container) - - print('Saving: {}'.format(output_filename)) - jit_container.save(output_filename) - -if __name__ == '__main__': - if len(sys.argv) != 2: - print('Must supply input filename') - sys.exit(1) - - filename = sys.argv[1] - main(filename) - diff --git a/tacotron_melgan/layers.py b/tacotron_melgan/layers.py deleted file mode 100644 index 66816f98b2..0000000000 --- a/tacotron_melgan/layers.py +++ /dev/null @@ -1,81 +0,0 @@ -import torch -#from librosa.filters import mel as librosa_mel_fn -#from audio_processing import dynamic_range_compression -#from audio_processing import dynamic_range_decompression -#from stft import STFT - - -class LinearNorm(torch.nn.Module): - def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): - super(LinearNorm, self).__init__() - self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) - - torch.nn.init.xavier_uniform_( - self.linear_layer.weight, - gain=torch.nn.init.calculate_gain(w_init_gain)) - - def forward(self, x): - return self.linear_layer(x) - - -class ConvNorm(torch.nn.Module): - def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, - padding=None, dilation=1, bias=True, w_init_gain='linear'): - super(ConvNorm, self).__init__() - if padding is None: - assert(kernel_size % 2 == 1) - padding = int(dilation * (kernel_size - 1) / 2) - - self.conv = torch.nn.Conv1d(in_channels, out_channels, - kernel_size=kernel_size, stride=stride, - padding=padding, dilation=dilation, - bias=bias) - - torch.nn.init.xavier_uniform_( - self.conv.weight, gain=torch.nn.init.calculate_gain(w_init_gain)) - - def forward(self, signal): - conv_signal = self.conv(signal) - return conv_signal - - -class TacotronSTFT(torch.nn.Module): - def __init__(self, filter_length=1024, hop_length=256, win_length=1024, - n_mel_channels=80, sampling_rate=22050, mel_fmin=0.0, - mel_fmax=8000.0): - super(TacotronSTFT, self).__init__() - self.n_mel_channels = n_mel_channels - self.sampling_rate = sampling_rate - self.stft_fn = STFT(filter_length, hop_length, win_length) - mel_basis = librosa_mel_fn( - sampling_rate, filter_length, n_mel_channels, mel_fmin, mel_fmax) - mel_basis = torch.from_numpy(mel_basis).float() - self.register_buffer('mel_basis', mel_basis) - - def spectral_normalize(self, magnitudes): - output = dynamic_range_compression(magnitudes) - return output - - @torch.jit.ignore - def spectral_de_normalize(self, magnitudes): - output = dynamic_range_decompression(magnitudes) - return output - - def mel_spectrogram(self, y): - """Computes mel-spectrograms from a batch of waves - PARAMS - ------ - y: Variable(torch.FloatTensor) with shape (B, T) in range [-1, 1] - - RETURNS - ------- - mel_output: torch.FloatTensor of shape (B, n_mel_channels, T) - """ - assert(torch.min(y.data) >= -1) - assert(torch.max(y.data) <= 1) - - magnitudes, phases = self.stft_fn.transform(y) - magnitudes = magnitudes.data - mel_output = torch.matmul(self.mel_basis, magnitudes) - mel_output = self.spectral_normalize(mel_output) - return mel_output diff --git a/tacotron_melgan/requirements.txt b/tacotron_melgan/requirements.txt deleted file mode 100644 index 8636b28531..0000000000 --- a/tacotron_melgan/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -PyYAML==5.2 -torch==1.3.1 diff --git a/tacotron_melgan/src/main.rs b/tacotron_melgan/src/main.rs deleted file mode 100644 index d4aea75c30..0000000000 --- a/tacotron_melgan/src/main.rs +++ /dev/null @@ -1,68 +0,0 @@ -#![feature(proc_macro_hygiene, decl_macro)] - -//#[macro_use] extern crate rocket; -//#[macro_use] extern crate rocket_contrib; -#[macro_use] extern crate serde_derive; -extern crate hound; -extern crate rand; -extern crate serde; -extern crate serde_json; -extern crate tch; - -use tch::CModule; -use tch::Tensor; -use tch::nn::Module; -use tch::nn::ModuleT; -//use server::run_server; - -pub mod melgan; -pub mod model; -//pub mod server; -pub mod tacotron; - -pub fn main() { - println!("Tacotron2 + MelGan"); - - //melgan::run_melgan_network(); - //tacotron::run_tacotron(); - //run_end_to_end(); - - //run_server(); -} - -fn run_end_to_end() { - println!("Load Tacotron Model"); - let tacotron_model = - model::load_model_file("/home/bt/dev/voder/tacotron_melgan/tacotron_jit_model_voder_c0cac635.pt"); - - println!("Load Melgan Model"); - let melgan_model = - model::load_model_file("/home/bt/dev/voder/tacotron_melgan/melgan_jit_model_voder_c0cac635.pt"); - - println!("Load Text Sequence Tensor"); - let text_sequence = - model::load_wrapped_tensor_file("/home/bt/dev/voder/data/text/tacotron_text_sequence.pt.containerized.pt"); - - //for i in 0..10 { - println!(">>> Evaluating Tacotron Model"); - let mut mel_tensor = tacotron_model.forward(&text_sequence); - - println!("Result mel tensor: {:?}", mel_tensor); - - if mel_tensor.dim() == 2 { - println!("mel unsqeeze"); - mel_tensor = mel_tensor.unsqueeze(0); - } - - let audio_tensor = melgan_model.forward(&mel_tensor); - - println!("Result audio tensor: {:?}", audio_tensor); - - let audio = melgan::audio_tensor_to_audio_signal(audio_tensor); - - println!("Writing audio file..."); - melgan::write_audio_file(audio, "double_model_results_2.wav"); - - println!("Done."); - //} -} diff --git a/tacotron_melgan/src/melgan.rs b/tacotron_melgan/src/melgan.rs deleted file mode 100644 index 980b94beb1..0000000000 --- a/tacotron_melgan/src/melgan.rs +++ /dev/null @@ -1,99 +0,0 @@ -use tch::CModule; -use tch::Tensor; -use tch::nn::Module; -use tch; - -use rand::Rng; - -use model::{ - load_model_file, - load_wrapped_tensor_file, -}; -use hound::Sample; - -const WRAPPED_MODEL_PATH : &'static str = "/home/bt/dev/voder/tacotron_melgan/melgan_jit_model_voder_c0cac635.pt"; - -const EXAMPLE_MEL_1: &'static str = "/home/bt/dev/voder/data/mels/LJ002-0320.mel.containerized.pt"; -const EXAMPLE_MEL_2 : &'static str = "/home/bt/dev/voder/data/mels/trump_2018_02_15-001.mel.containerized.pt"; - -//pub const MAX_WAV_VALUE : f32 = 32768.0f32; -//pub const HALF_WAV_VALUE : f32 = MAX_WAV_VALUE * 0.5f32; - -// TODO: This is an hparam and should be dynamic. -//pub const HOP_LENGTH : i64 = 256; - -pub fn audio_tensor_to_audio_signal(mel: Tensor) -> Vec { - let mut flat_audio_tensor = mel.squeeze(); - - println!("Sqeueezed tensor: {:?}, dim: {}", - flat_audio_tensor, - flat_audio_tensor.dim()); - - let length = flat_audio_tensor.size1().unwrap() as usize; - println!("Length: {}", length); - - //let trim_back = HOP_LENGTH * 10; - //let new_size = length as i64 - trim_back; - //println!("Old size: {}", length); - //println!("New size: {}", new_size); - //flat_audio_tensor = flat_audio_tensor.resize_(&[new_size]); - - //flat_audio_tensor = flat_audio_tensor * MAX_WAV_VALUE as f64; - - let mut data : Vec = Vec::with_capacity(length); - - for i in 0 .. length { - data.push(0.0f32); - } - - flat_audio_tensor.copy_data(data.as_mut_slice(), length as usize); - - data.iter().map(|x| x.trunc() as i16).collect() -} - -fn debug_print_sample(audio: &Vec, num_samples: usize) { - let mut rng = rand::thread_rng(); - for _ in 0..num_samples { - let ri = rng.gen_range(0, audio.len()); - println!("audio_data[{}]: {:?}", ri, audio.get(ri as usize)); - } -} - -pub fn run_melgan_network() { - let mut mel = load_wrapped_tensor_file(EXAMPLE_MEL_1); - println!("Got mel: {:?} of dim {}", mel, mel.dim()); - - if mel.dim() == 2 { - println!("mel unsqeeze"); - mel = mel.unsqueeze(0); - } - - let melgan_model = load_model_file(WRAPPED_MODEL_PATH); - - println!("Evaluating model..."); - let output = melgan_model.forward(&mel); - - println!("Result tensor: {:?}", output); - - let audio = audio_tensor_to_audio_signal(output); - - //debug_print_sample(&audio, 10); - - write_audio_file(audio, "melgan_output.wav"); -} - -pub fn write_audio_file(audio_signal: Vec, filename: &str) { - let spec = hound::WavSpec { - channels: 1, - sample_rate: 20000, - bits_per_sample: 16, - sample_format: hound::SampleFormat::Int, - }; - - let mut writer = hound::WavWriter::create(filename, spec).unwrap(); - - for sample in audio_signal { - //let sample = sample * 0.0001f32; - writer.write_sample(sample).unwrap(); - } -} diff --git a/tacotron_melgan/src/model.rs b/tacotron_melgan/src/model.rs deleted file mode 100644 index 87617daa21..0000000000 --- a/tacotron_melgan/src/model.rs +++ /dev/null @@ -1,130 +0,0 @@ -use hound::SampleFormat; -use hound::WavSpec; -use hound::WavWriter; - -use tch::{CModule, Device, Kind}; -use tch::Tensor; -use tch::nn::Module; -use tch; - -use std::io::Cursor; -use std::io::BufWriter; - -use melgan::audio_tensor_to_audio_signal; - -/// Load a Torch model -pub fn load_model_file(filename: &str) -> CModule { - println!("Loading model: {}", filename); - tch::CModule::load(filename).unwrap() -} - -/// This is a _HACK_ to load a single Tensor. -/// -/// It seems currently impossible to load tensors into tch.rs (libtorch), -/// (eg with 'Tensor::load(filename)') that are saved from pytorch. They -/// use different serialization formats. Luckily, I can embed a tensor in -/// a JIT module and unpack it from there instead. The most -/// straightforward way of getting it out is to define a 'forward()' -/// method that simply returns the wrapped tensor. -/// -/// I wrote a script to wrap tensors: 'jit_containerize_tensor.py'. -pub fn load_wrapped_tensor_file(filename: &str) -> Tensor { - println!("Loading wrapped tensor file: {}", filename); - let module = tch::CModule::load(filename).unwrap(); - let mut temp = Tensor::zeros( - &[10, 10, 10], - (tch::Kind::Float, tch::Device::Cpu) - ); - module.forward(&temp) -} - -pub struct TacoMelModel { - tacotron_model: CModule, - melgan_model: CModule, -} - -impl TacoMelModel { - - pub fn create(tacotron_filename: &str, melgan_filename: &str) -> Self { - let tacotron_model = load_model_file(tacotron_filename); - let melgan_model = load_model_file(melgan_filename); - - Self { - tacotron_model, - melgan_model, - } - } - - pub fn run_tts(&self, text: &str) -> Vec { - println!("Text : {:?}", text); - let copied = text.to_string().to_ascii_lowercase(); - let mut text_buffer : Vec = Vec::new(); - - for ch in copied.chars() { - // TODO: HORRIBLE EXPERIMENTAL HACK. Write a formal module to clean and process text - let mut v = ch as i64 - 59; - if v < 1 { - v = 11; // NB: Space - } - text_buffer.push(v); - } - - println!("Text buffer: {:?}", text_buffer); - - let text_tensor = Tensor::of_slice(text_buffer.as_slice()); - - println!("Text tensor: {:?}", text_tensor); - - let text_tensor = text_tensor.unsqueeze(0); - - println!("Text tensor unsq: {:?}", text_tensor); - - let mut mel_tensor = self.tacotron_model.forward(&text_tensor); - - //println!("Loading mel..."); - //let mel_tensor = load_wrapped_tensor_file("/home/bt/dev/tacotron-melgan/saved_mel.pt.containerized.pt"); - - println!("\n\n>>> Mel tensor:\n{:?}\n\n", mel_tensor); - - //let repr = mel_tensor.to_string(20000).unwrap(); - //println!("\n{:?}\n\n", repr); - - println!("Running melgan..."); - - let audio_tensor = self.melgan_model.forward(&mel_tensor); - - println!("\n\n>>> Audio tensor:\n{:?}\n\n", audio_tensor); - - audio_tensor_to_audio_signal(audio_tensor) - } - - pub fn run_tts_audio(&self, text: &str) -> Vec { - let audio_signal = self.run_tts(text); - - audio_signal_to_wav_bytes(audio_signal) - } -} - -pub fn audio_signal_to_wav_bytes(audio_signal: Vec) -> Vec { - let spec = WavSpec { - channels: 1, - sample_rate: 20000, - bits_per_sample: 16, - sample_format: SampleFormat::Int, - }; - let bytes: Vec = Vec::new(); - let seek: Cursor> = Cursor::new(bytes); - let mut buffer = BufWriter::new(seek); - { - let mut writer = WavWriter::new(&mut buffer, spec).unwrap(); - for s in audio_signal { - //let s = s * 0.00001f32; // TODO: Find a more appropriate multiplier - writer.write_sample(s).unwrap(); - } - writer.finalize().unwrap(); // TODO: Error - } - match buffer.into_inner() { - Err(_) => { Vec::new() }, // TODO: Error - Ok(r) => { r.get_ref().to_vec() }, - } -} diff --git a/tacotron_melgan/src/server.rs b/tacotron_melgan/src/server.rs deleted file mode 100644 index f921c42662..0000000000 --- a/tacotron_melgan/src/server.rs +++ /dev/null @@ -1,135 +0,0 @@ -use rocket::{Request, State, Response}; -use rocket::response::content::Content; -use rocket::http::{RawStr, ContentType}; -use rocket_contrib::json::{Json, JsonValue}; -use model::{TacoMelModel, load_wrapped_tensor_file, load_model_file, audio_signal_to_wav_bytes}; -use tch::nn::Module; -use melgan::audio_tensor_to_audio_signal; -use tch::Tensor; -use std::panic; - -#[derive(Serialize, Deserialize)] -struct Message { - contents: String, -} - -#[get("/")] -fn get_index() -> String { - format!("Hello") -} - -#[get("/tts?")] -fn get_tts(model: State, text: &RawStr) -> Content> { - - let result = panic::catch_unwind(|| { - let audio_bytes = model.inner().run_tts_audio(text.as_str()); - audio_bytes - }); - - match result { - Err(_) => { - Content(ContentType::Plain, "there was an error".as_bytes().to_vec()) - }, - Ok(audio_bytes) => { - Content(ContentType::new("audio", "wav"), audio_bytes) - } - } -} - -fn print_mel(tensor: &Tensor, i: i64) { - let t = tensor.squeeze(); - print!("M[{}][0:5] =", i); - for j in 0..5 { - print!(" {:?}", t.get(i).get(j)); - } - println!(); -} - -fn print_audio(tensor: &Tensor, i: i64) { - let t = tensor.squeeze(); - println!("A[{}] = {:?}", i, t.get(i)); -} - -fn print_audio_signal(signal: &Vec, i: usize) { - println!("W[{}] = {:?}", i, signal.get(i).unwrap()); -} - - -#[get("/tts_test")] -fn get_tts_test() -> Content> { - println!("Loading melgan model..."); - let melgan_filename = "/home/bt/dev/tacotron-melgan/shared_melgan_container.pt"; - let melgan_filename = "/home/bt/dev/tacotron-melgan/shared_melgan_container2.pt"; - let melgan_model = load_model_file(melgan_filename); - - println!("Loading mel..."); - let mel_tensor = load_wrapped_tensor_file("/home/bt/dev/tacotron-melgan/saved_mel.pt.containerized.pt"); - - println!("⚙️"); - print_mel(&mel_tensor, 0); - print_mel(&mel_tensor, 1); - print_mel(&mel_tensor, 2); - print_mel(&mel_tensor, 3); - print_mel(&mel_tensor, 4); - print_mel(&mel_tensor, 79); - - //println!("\n\n>>> Mel tensor:\n{:?}\n\n", mel_tensor); - - let audio_tensor = melgan_model.forward(&mel_tensor); - - print_audio(&audio_tensor, 0); - print_audio(&audio_tensor, 1); - print_audio(&audio_tensor, 2); - print_audio(&audio_tensor, 100); - print_audio(&audio_tensor, 101); - print_audio(&audio_tensor, 102); - - //println!("\n\n>>> Audio tensor:\n{:?}\n\n", mel_tensor); - - let audio_signal = audio_tensor_to_audio_signal(audio_tensor); - - print_audio_signal(&audio_signal, 0); - print_audio_signal(&audio_signal, 1); - print_audio_signal(&audio_signal, 2); - print_audio_signal(&audio_signal, 100); - print_audio_signal(&audio_signal, 101); - print_audio_signal(&audio_signal, 102); - - let audio_bytes = audio_signal_to_wav_bytes(audio_signal); - Content(ContentType::new("audio", "wav"), audio_bytes) -} - -#[catch(404)] -fn not_found(req: &Request) -> String { - format!("I couldn't find '{}'. Try something else?", req.uri()) -} - -pub fn run_server() { - /*let options = Options::Index | Options::DotFiles; - rocket::ignite() - .mount("/static", StaticFiles::from("/www/public")) - .mount("/pub", StaticFiles::new("/www/public", options).rank(-1))*/ - - //let tacotron = "/home/bt/dev/voder/tacotron_melgan/tacotron_jit_model_voder_c0cac635.pt"; - let tacotron = "/home/bt/dev/voder/tacotron_melgan/tacotron_container4.pt"; - //let melgan = "/home/bt/dev/voder/tacotron_melgan/melgan_jit_model_voder_c0cac635.pt"; - let melgan = "/home/bt/dev/voder/tacotron_melgan/melgan_container2.pt"; - let melgan = "/home/bt/dev/tacotron-melgan/shared_melgan_container.pt"; - let melgan = "/home/bt/dev/tacotron-melgan/shared_melgan_container2.pt"; - let model = TacoMelModel::create( - tacotron, - melgan); - - rocket::ignite() - .mount("/", routes![ - get_index, - get_tts, - get_tts_test, - ]) - .manage(model) - .register(catchers![not_found]) - .launch(); -} - - - diff --git a/tacotron_melgan/src/tacotron.rs b/tacotron_melgan/src/tacotron.rs deleted file mode 100644 index df37f5bc1b..0000000000 --- a/tacotron_melgan/src/tacotron.rs +++ /dev/null @@ -1,116 +0,0 @@ -use tch::Tensor; -use tch::CModule; -use tch; -use tch::nn::Module; - -const WRAPPED_MODEL_PATH : &'static str = "/home/bt/dev/voder/tacotron_melgan/tacotron_jit_model_voder_c0cac635.pt"; -//const EXAMPLE_TEXT_SEQUENCE : &'static str = "/home/bt/dev/voder/data/text/tacotron_text_sequence.pt"; -const EXAMPLE_TEXT_SEQUENCE : &'static str = "/home/bt/dev/voder/data/text/tacotron_text_sequence.pt.containerized.pt"; - -pub fn load_tacotron_model(filename: &str) -> CModule { - // TODO - println!("Loading model: {}", filename); - tch::CModule::load(filename).unwrap() -} - -pub fn load_wrapped_text(filename: &str) -> Tensor { - println!("Loading wrapped text sequence file: {}", filename); - let module = tch::CModule::load(filename).unwrap(); - let mut temp = Tensor::zeros( - &[10, 10, 10], - (tch::Kind::Float, tch::Device::Cpu) - ); - module.forward(&temp) -} - - -pub fn run_tacotron() { - let mut text_sequence = load_wrapped_text(EXAMPLE_TEXT_SEQUENCE); - println!("Got text_sequence: {:?} of dim {}", text_sequence, text_sequence.dim()); - - let mut vs = tch::nn::VarStore::new(tch::Device::Cpu); - let tacotron_model = load_tacotron_model(WRAPPED_MODEL_PATH); - - for i in 0..10 { - println!("Evaluating model... {}", i); - let output = tacotron_model.forward(&text_sequence); - - println!("Result tensor: {:?}", output); - } -} - -/*println!("Tacotron2 + MelGan"); - -// Create the model and load the weights from the file. -let mut vs = tch::nn::VarStore::new(tch::Device::Cpu); - -println!("Loading Wrapped model: {}", WRAPPED_MODEL_PATH); - -println!("loaded"); - -/* Just gotta do this... - model = Generator(hp.audio.n_mel_channels).cuda() - model.load_state_dict(checkpoint['model_g']) - model.eval(inference=False) - - with torch.no_grad(): - for melpath in tqdm.tqdm(glob.glob(os.path.join(args.input_folder, '*.mel'))): - mel = torch.load(melpath) - if len(mel.shape) == 2: - mel = mel.unsqueeze(0) - - filename = melpath.replace('.mel', '_reconstructed_epoch%04d.png' % checkpoint['epoch']) - #render_histogram(mel, filename) - mel = mel.cuda() - - audio = model.inference(mel) - audio = audio.cpu().detach().numpy() - - out_path = melpath.replace('.mel', '_reconstructed_epoch%04d.wav' % checkpoint['epoch']) - write(out_path, hp.audio.sampling_rate, audio) -*/ - -//vs.load(WRAPPED_MODEL_PATH).unwrap(); - -println!("Loading trained model..."); -let model = tch::CModule::load(WRAPPED_MODEL_PATH).unwrap(); - -// NB: This is just random data for now. Kind of mel shaped since it's an image. -//let path = "/home/bt/Downloads/virtual-studio-design.jpg"; -//let image = imagenet::load_image_and_resize(path, 100, 100).unwrap(); -//let image = imagenet::load_image(EXAMPLE_MEL_PATH).unwrap(); - -println!("Loading mel file..."); -let mel_file = Tensor::load(EXAMPLE_MEL_PATH).unwrap(); - -println!("Forwarding mel to model..."); -let output = model.forward_ts(&[mel_file.unsqueeze(0)]).unwrap(); - - -/*// TODO: Now how do I evaluate the model? -//let resnet18 = tch::vision::resnet::resnet18(&vs.root(), imagenet::CLASS_COUNT); - -let path = "/home/bt/Downloads/virtual-studio-design.jpg"; -let image = imagenet::load_image_and_resize(path, 100, 100).unwrap(); - -// NB: This works -let net = Box::new(resnet::resnet18(&vs.root(), imagenet::CLASS_COUNT)); - -for _ in 0..10 { - let output = net - .forward_t(&image.unsqueeze(0), /*train=*/ false) - .softmax(-1, tch::Kind::Float); // Convert to probability. - - for (probability, class) in imagenet::top(&output, 5).iter() { - println!("{:50} {:5.2}%", class, 100.0 * probability) - } -}*/ - -/*// Apply the forward pass of the model to get the logits. -let output = net - .forward_t(&image.unsqueeze(0), /*train=*/ false) - .softmax(-1, tch::Kind::Float); // Convert to probability. - -// Print the top 5 categories for this image. -Ok(())*/ -*/ diff --git a/tacotron_melgan/tacotron_model.py b/tacotron_melgan/tacotron_model.py deleted file mode 100644 index 2f470da0a2..0000000000 --- a/tacotron_melgan/tacotron_model.py +++ /dev/null @@ -1,604 +0,0 @@ -# Adapted from nvidia's tacotron2 codebase - -from math import sqrt -import torch -from torch.autograd import Variable -from torch import nn -from torch.nn import functional as F -from layers import ConvNorm, LinearNorm -#from utils import to_gpu, get_mask_from_lengths - -class LocationLayer(nn.Module): - def __init__(self, attention_n_filters, attention_kernel_size, - attention_dim): - super(LocationLayer, self).__init__() - padding = int((attention_kernel_size - 1) / 2) - self.location_conv = ConvNorm(2, attention_n_filters, - kernel_size=attention_kernel_size, - padding=padding, bias=False, stride=1, - dilation=1) - self.location_dense = LinearNorm(attention_n_filters, attention_dim, - bias=False, w_init_gain='tanh') - - def forward(self, attention_weights_cat): - processed_attention = self.location_conv(attention_weights_cat) - processed_attention = processed_attention.transpose(1, 2) - processed_attention = self.location_dense(processed_attention) - return processed_attention - - -class Attention(nn.Module): - def __init__(self, attention_rnn_dim, embedding_dim, attention_dim, - attention_location_n_filters, attention_location_kernel_size): - super(Attention, self).__init__() - self.query_layer = LinearNorm(attention_rnn_dim, attention_dim, - bias=False, w_init_gain='tanh') - self.memory_layer = LinearNorm(embedding_dim, attention_dim, bias=False, - w_init_gain='tanh') - self.v = LinearNorm(attention_dim, 1, bias=False) - self.location_layer = LocationLayer(attention_location_n_filters, - attention_location_kernel_size, - attention_dim) - self.score_mask_value = -float("inf") - - def get_alignment_energies(self, query, processed_memory, - attention_weights_cat): - """ - PARAMS - ------ - query: decoder output (batch, n_mel_channels * n_frames_per_step) - processed_memory: processed encoder outputs (B, T_in, attention_dim) - attention_weights_cat: cumulative and prev. att weights (B, 2, max_time) - - RETURNS - ------- - alignment (batch, max_time) - """ - - processed_query = self.query_layer(query.unsqueeze(1)) - processed_attention_weights = self.location_layer(attention_weights_cat) - energies = self.v(torch.tanh( - processed_query + processed_attention_weights + processed_memory)) - - energies = energies.squeeze(-1) - return energies - - def forward(self, attention_hidden_state, memory, processed_memory, - #attention_weights_cat, mask): - attention_weights_cat): - """ - PARAMS - ------ - attention_hidden_state: attention rnn last output - memory: encoder outputs - processed_memory: processed encoder outputs - attention_weights_cat: previous and cummulative attention weights - mask: binary mask for padded data - """ - alignment = self.get_alignment_energies( - attention_hidden_state, processed_memory, attention_weights_cat) - - #if mask is not None: - # alignment.data.masked_fill_(mask, self.score_mask_value) - - attention_weights = F.softmax(alignment, dim=1) - attention_context = torch.bmm(attention_weights.unsqueeze(1), memory) - attention_context = attention_context.squeeze(1) - - return attention_context, attention_weights - - -class Prenet(nn.Module): - def __init__(self, in_dim, sizes): - super(Prenet, self).__init__() - in_sizes = [in_dim] + sizes[:-1] - self.layers = nn.ModuleList( - [LinearNorm(in_size, out_size, bias=False) - for (in_size, out_size) in zip(in_sizes, sizes)]) - - def forward(self, x): - for linear in self.layers: - x = F.dropout(F.relu(linear(x)), p=0.5, training=True) - return x - - -class Postnet(nn.Module): - """Postnet - - Five 1-d convolution with 512 channels and kernel size 5 - """ - - def __init__(self, hparams): - super(Postnet, self).__init__() - self.convolutions = nn.ModuleList() - - # TODO(TEMP) - """ - self.convolutions.append( - nn.Sequential( - ConvNorm(hparams.n_mel_channels, hparams.postnet_embedding_dim, - kernel_size=hparams.postnet_kernel_size, stride=1, - padding=int((hparams.postnet_kernel_size - 1) / 2), - dilation=1, w_init_gain='tanh'), - nn.BatchNorm1d(hparams.postnet_embedding_dim)) - ) - - for i in range(1, hparams.postnet_n_convolutions - 1): - self.convolutions.append( - nn.Sequential( - ConvNorm(hparams.postnet_embedding_dim, - hparams.postnet_embedding_dim, - kernel_size=hparams.postnet_kernel_size, stride=1, - padding=int((hparams.postnet_kernel_size - 1) / 2), - dilation=1, w_init_gain='tanh'), - nn.BatchNorm1d(hparams.postnet_embedding_dim)) - ) - - self.convolutions.append( - nn.Sequential( - ConvNorm(hparams.postnet_embedding_dim, hparams.n_mel_channels, - kernel_size=hparams.postnet_kernel_size, stride=1, - padding=int((hparams.postnet_kernel_size - 1) / 2), - dilation=1, w_init_gain='linear'), - nn.BatchNorm1d(hparams.n_mel_channels)) - ) - """ - - def forward(self, x): - for i in range(len(self.convolutions) - 1): - x = F.dropout(torch.tanh(self.convolutions[i](x)), 0.5, self.training) - x = F.dropout(self.convolutions[-1](x), 0.5, self.training) - - return x - - -class Encoder(nn.Module): - """Encoder module: - - Three 1-d convolution banks - - Bidirectional LSTM - """ - def __init__(self, hparams): - super(Encoder, self).__init__() - - convolutions = [] - for _ in range(hparams.encoder_n_convolutions): - conv_layer = nn.Sequential( - ConvNorm(hparams.encoder_embedding_dim, - hparams.encoder_embedding_dim, - kernel_size=hparams.encoder_kernel_size, stride=1, - padding=int((hparams.encoder_kernel_size - 1) / 2), - dilation=1, w_init_gain='relu'), - nn.BatchNorm1d(hparams.encoder_embedding_dim)) - convolutions.append(conv_layer) - self.convolutions = nn.ModuleList(convolutions) - - self.lstm = nn.LSTM(hparams.encoder_embedding_dim, - int(hparams.encoder_embedding_dim / 2), 1, - batch_first=True, bidirectional=True) - - # def forward(self, x, input_lengths): - # for conv in self.convolutions: - # x = F.dropout(F.relu(conv(x)), 0.5, self.training) - - # x = x.transpose(1, 2) - - # # pytorch tensor are not reversible, hence the conversion - # #input_lengths = input_lengths.cpu().numpy() - # x = nn.utils.rnn.pack_padded_sequence( - # x, input_lengths, batch_first=True) - - # self.lstm.flatten_parameters() - # outputs, _ = self.lstm(x) - - # outputs, _ = nn.utils.rnn.pad_packed_sequence( - # outputs, batch_first=True) - - # return outputs - - # NB: This used to be 'inference' - def forward(self, x): - for conv in self.convolutions: - x = F.dropout(F.relu(conv(x)), 0.5, self.training) - - x = x.transpose(1, 2) - - # NB(bt): Don't need to flatten, per the method comments: - # Right now, this works only if the module is on the GPU and cuDNN is enabled. - #self.lstm.flatten_parameters() - outputs, _ = self.lstm(x) - - return outputs - -class Decoder(nn.Module): - def __init__(self, hparams): - super(Decoder, self).__init__() - - # NB(bt): Initializing these upfront because JIT script fails otherwise: - # "Tried to set nonexistent attribute: attention_hidden. - # Did you forget to initialize it in __init__()?:" - self.attention_hidden = torch.zeros(1,1) - self.attention_cell = torch.zeros(1, 1) - self.decoder_hidden = torch.zeros(1, 1) - self.decoder_cell = torch.zeros(1, 1) - self.attention_weights = torch.zeros(1, 1) - self.attention_weights_cum = torch.zeros(1, 1) - self.attention_context = torch.zeros(1, 1) - self.memory = torch.zeros(1, 1) - self.processed_memory = torch.zeros(1, 1) - - self.n_mel_channels = hparams.n_mel_channels - self.n_frames_per_step = hparams.n_frames_per_step - self.encoder_embedding_dim = hparams.encoder_embedding_dim - self.attention_rnn_dim = hparams.attention_rnn_dim - self.decoder_rnn_dim = hparams.decoder_rnn_dim - self.prenet_dim = hparams.prenet_dim - self.max_decoder_steps = hparams.max_decoder_steps - self.gate_threshold = hparams.gate_threshold - self.p_attention_dropout = hparams.p_attention_dropout - self.p_decoder_dropout = hparams.p_decoder_dropout - - self.prenet = Prenet( - hparams.n_mel_channels * hparams.n_frames_per_step, - [hparams.prenet_dim, hparams.prenet_dim]) - - self.attention_rnn = nn.LSTMCell( - hparams.prenet_dim + hparams.encoder_embedding_dim, - hparams.attention_rnn_dim) - - self.attention_layer = Attention( - hparams.attention_rnn_dim, hparams.encoder_embedding_dim, - hparams.attention_dim, hparams.attention_location_n_filters, - hparams.attention_location_kernel_size) - - self.decoder_rnn = nn.LSTMCell( - hparams.attention_rnn_dim + hparams.encoder_embedding_dim, - hparams.decoder_rnn_dim, 1) - - self.linear_projection = LinearNorm( - hparams.decoder_rnn_dim + hparams.encoder_embedding_dim, - hparams.n_mel_channels * hparams.n_frames_per_step) - - self.gate_layer = LinearNorm( - hparams.decoder_rnn_dim + hparams.encoder_embedding_dim, 1, - bias=True, w_init_gain='sigmoid') - - def get_go_frame(self, memory): - """ Gets all zeros frames to use as first decoder input - PARAMS - ------ - memory: decoder outputs - - RETURNS - ------- - decoder_input: all zeros frames - """ - - B = memory.size(0) - # NB(bt): Rewriting this as it doesn't work with scripting (but - # does with tracing). - # mem = memory.data.new(B, self.n_mel_channels * self.n_frames_per_step) - # decoder_input = Variable(mem.zero_()) - mem = torch.zeros(B, self.n_mel_channels * self.n_frames_per_step) - # NB(bt): I don't think I need a variable as we don't need to do backprop. - # decoder_input = Variable(mem) - # return decoder_input - return mem - - #def initialize_decoder_states(self, memory, mask): - def initialize_decoder_states(self, memory): - """ Initializes attention rnn states, decoder rnn states, attention - weights, attention cumulative weights, attention context, stores memory - and stores processed memory - PARAMS - ------ - memory: Encoder outputs - mask: Mask for padded data if training, expects None for inference - """ - B = memory.size(0) - MAX_TIME = memory.size(1) - - # NB(bt): Rewriting for scripting - #self.attention_hidden = Variable(memory.data.new( - # B, self.attention_rnn_dim).zero_()) - self.attention_hidden = torch.zeros(B, self.attention_rnn_dim) - #self.attention_cell = Variable(memory.data.new( - # B, self.attention_rnn_dim).zero_()) - self.attention_cell = torch.zeros(B, self.attention_rnn_dim) - - #self.decoder_hidden = Variable(memory.data.new( - # B, self.decoder_rnn_dim).zero_()) - self.decoder_hidden = torch.zeros(B, self.decoder_rnn_dim) - #self.decoder_cell = Variable(memory.data.new( - # B, self.decoder_rnn_dim).zero_()) - self.decoder_cell = torch.zeros(B, self.decoder_rnn_dim) - - #self.attention_weights = Variable(memory.data.new( - # B, MAX_TIME).zero_()) - self.attention_weights = torch.zeros(B, MAX_TIME) - #self.attention_weights_cum = Variable(memory.data.new( - # B, MAX_TIME).zero_()) - self.attention_weights_cum = torch.zeros(B, MAX_TIME) - #self.attention_context = Variable(memory.data.new( - # B, self.encoder_embedding_dim).zero_()) - self.attention_context = torch.zeros(B, self.encoder_embedding_dim) - - self.memory = memory - self.processed_memory = self.attention_layer.memory_layer(memory) - # NB(bt): Can't set to None in the CTOR as it gets optimized out. - # self.mask = mask - - def parse_decoder_inputs(self, decoder_inputs): - """ Prepares decoder inputs, i.e. mel outputs - PARAMS - ------ - decoder_inputs: inputs used for teacher-forced training, i.e. mel-specs - - RETURNS - ------- - inputs: processed decoder inputs - - """ - # (B, n_mel_channels, T_out) -> (B, T_out, n_mel_channels) - decoder_inputs = decoder_inputs.transpose(1, 2) - decoder_inputs = decoder_inputs.view( - decoder_inputs.size(0), - int(decoder_inputs.size(1)/self.n_frames_per_step), -1) - # (B, T_out, n_mel_channels) -> (T_out, B, n_mel_channels) - decoder_inputs = decoder_inputs.transpose(0, 1) - return decoder_inputs - - def parse_decoder_outputs(self, mel_outputs, gate_outputs, alignments): - """ Prepares decoder outputs for output - PARAMS - ------ - mel_outputs: - gate_outputs: gate output energies - alignments: - - RETURNS - ------- - mel_outputs: - gate_outpust: gate output energies - alignments: - """ - # type: (List[torch.Tensor], List[torch.Tensor], List[torch.Tensor]) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor] - - # (T_out, B) -> (B, T_out) - alignments = torch.stack(alignments).transpose(0, 1) - # (T_out, B) -> (B, T_out) - gate_outputs = torch.stack(gate_outputs).transpose(0, 1) - gate_outputs = gate_outputs.contiguous() - # (T_out, B, n_mel_channels) -> (B, T_out, n_mel_channels) - mel_outputs = torch.stack(mel_outputs).transpose(0, 1).contiguous() - # decouple frames per step - mel_outputs = mel_outputs.view( - mel_outputs.size(0), -1, self.n_mel_channels) - # (B, T_out, n_mel_channels) -> (B, n_mel_channels, T_out) - mel_outputs = mel_outputs.transpose(1, 2) - - return mel_outputs, gate_outputs, alignments - - def decode(self, decoder_input): - """ Decoder step using stored states, attention and memory - PARAMS - ------ - decoder_input: previous mel output - - RETURNS - ------- - mel_output: - gate_output: gate output energies - attention_weights: - """ - cell_input = torch.cat((decoder_input, self.attention_context), -1) - - #self.attention_hidden, self.attention_cell = self.attention_rnn( - results = self.attention_rnn(cell_input, (self.attention_hidden, self.attention_cell)) - self.attention_hidden = results[0] - self.attention_cell = results[1] - self.attention_hidden = F.dropout( - self.attention_hidden, self.p_attention_dropout, self.training) - - attention_weights_cat = torch.cat( - (self.attention_weights.unsqueeze(1), - self.attention_weights_cum.unsqueeze(1)), dim=1) - #self.attention_context, self.attention_weights = self.attention_layer( - results = self.attention_layer( - self.attention_hidden, self.memory, self.processed_memory, - #attention_weights_cat, self.mask) - attention_weights_cat) - self.attention_context = results[0] - self.attention_weights = results[1] - - self.attention_weights_cum += self.attention_weights - decoder_input = torch.cat( - (self.attention_hidden, self.attention_context), -1) - #self.decoder_hidden, self.decoder_cell = self.decoder_rnn( - results = self.decoder_rnn( - decoder_input, (self.decoder_hidden, self.decoder_cell)) - self.decoder_hidden = results[0] - self.decoder_cell = results[1] - self.decoder_hidden = F.dropout( - self.decoder_hidden, self.p_decoder_dropout, self.training) - - decoder_hidden_attention_context = torch.cat( - (self.decoder_hidden, self.attention_context), dim=1) - decoder_output = self.linear_projection( - decoder_hidden_attention_context) - - gate_prediction = self.gate_layer(decoder_hidden_attention_context) - return decoder_output, gate_prediction, self.attention_weights - -# def forward(self, memory, decoder_inputs, memory_lengths): -# """ Decoder forward pass for training -# PARAMS -# ------ -# memory: Encoder outputs -# decoder_inputs: Decoder inputs for teacher forcing. i.e. mel-specs -# memory_lengths: Encoder output lengths for attention masking. -# -# RETURNS -# ------- -# mel_outputs: mel outputs from the decoder -# gate_outputs: gate outputs from the decoder -# alignments: sequence of attention weights from the decoder -# """ -# -# decoder_input = self.get_go_frame(memory).unsqueeze(0) -# decoder_inputs = self.parse_decoder_inputs(decoder_inputs) -# decoder_inputs = torch.cat((decoder_input, decoder_inputs), dim=0) -# decoder_inputs = self.prenet(decoder_inputs) -# -# self.initialize_decoder_states( -# memory, mask=~get_mask_from_lengths(memory_lengths)) -# -# mel_outputs, gate_outputs, alignments = [], [], [] -# while len(mel_outputs) < decoder_inputs.size(0) - 1: -# decoder_input = decoder_inputs[len(mel_outputs)] -# mel_output, gate_output, attention_weights = self.decode( -# decoder_input) -# mel_outputs += [mel_output.squeeze(1)] -# gate_outputs += [gate_output.squeeze()] -# alignments += [attention_weights] -# -# mel_outputs, gate_outputs, alignments = self.parse_decoder_outputs( -# mel_outputs, gate_outputs, alignments) -# -# return mel_outputs, gate_outputs, alignments - - def forward(self, memory): - """ Decoder inference - PARAMS - ------ - memory: Encoder outputs - - RETURNS - ------- - mel_outputs: mel outputs from the decoder - gate_outputs: gate outputs from the decoder - alignments: sequence of attention weights from the decoder - """ - decoder_input = self.get_go_frame(memory) - - #self.initialize_decoder_states(memory, mask=None) - self.initialize_decoder_states(memory) - - mel_outputs, gate_outputs, alignments = [], [], [] - while True: - decoder_input = self.prenet(decoder_input) - mel_output, gate_output, alignment = self.decode(decoder_input) - - mel_outputs += [mel_output.squeeze(1)] - gate_outputs += [gate_output] - alignments += [alignment] - - if torch.sigmoid(gate_output.data) > self.gate_threshold: - break - elif len(mel_outputs) == self.max_decoder_steps: - print("Warning! Reached max decoder steps") - break - - decoder_input = mel_output - - mel_outputs, gate_outputs, alignments = self.parse_decoder_outputs( - mel_outputs, gate_outputs, alignments) - - return mel_outputs, gate_outputs, alignments - -class Tacotron2(nn.Module): - def __init__(self, hparams): - super(Tacotron2, self).__init__() - self.mask_padding = hparams.mask_padding - self.fp16_run = hparams.fp16_run - self.n_mel_channels = hparams.n_mel_channels - self.n_frames_per_step = hparams.n_frames_per_step - - # https://pytorch.org/docs/stable/tensors.html - #torch.set_default_tensor_type('torch.HalfTensor') - #torch.set_default_tensor_type('torch.DoubleTensor') - - self.embedding = nn.Embedding( - hparams.n_symbols, hparams.symbols_embedding_dim) - - std = sqrt(2.0 / (hparams.n_symbols + hparams.symbols_embedding_dim)) - val = sqrt(3.0) * std # uniform bounds for std - self.embedding.weight.data.uniform_(-val, val) - self.encoder = Encoder(hparams) - self.decoder = Decoder(hparams) - # NB(bt): Postnet does not seem to have different output per inference experiments - #self.postnet = Postnet(hparams) - -# def parse_batch(self, batch): -# text_padded, input_lengths, mel_padded, gate_padded, \ -# output_lengths = batch -# text_padded = to_gpu(text_padded).long() -# input_lengths = to_gpu(input_lengths).long() -# max_len = torch.max(input_lengths.data).item() -# mel_padded = to_gpu(mel_padded).float() -# gate_padded = to_gpu(gate_padded).float() -# output_lengths = to_gpu(output_lengths).long() -# -# return ( -# (text_padded, input_lengths, mel_padded, max_len, output_lengths), -# (mel_padded, gate_padded)) -# - #def parse_output(self, outputs, output_lengths=None): - def parse_output(self, outputs): - # type: (List[torch.Tensor]) -> List[torch.Tensor] - # NB(bt): Not calling this currently - """ - if self.mask_padding and output_lengths is not None: - mask = ~get_mask_from_lengths(output_lengths) - mask = mask.expand(self.n_mel_channels, mask.size(0), mask.size(1)) - mask = mask.permute(1, 0, 2) - - outputs[0].data.masked_fill_(mask, 0.0) - # NB(bt): No postnet. outputs[1].data.masked_fill_(mask, 0.0) - #outputs[2].data.masked_fill_(mask[:, 0, :], 1e3) # gate energies - outputs[1].data.masked_fill_(mask[:, 0, :], 1e3) # gate energies - """ - - return outputs - - """ - #def forward(self, inputs): - def forward(self, text_inputs, text_lengths, mels, max_len, output_lengths): - #text_inputs, text_lengths, mels, max_len, output_lengths = inputs - text_lengths, output_lengths = text_lengths.data, output_lengths.data - - embedded_inputs = self.embedding(text_inputs).transpose(1, 2) - - encoder_outputs = self.encoder(embedded_inputs, text_lengths) - - mel_outputs, gate_outputs, alignments = self.decoder( - encoder_outputs, mels, memory_lengths=text_lengths) - - mel_outputs_postnet = self.postnet(mel_outputs) - mel_outputs_postnet = mel_outputs + mel_outputs_postnet - - return self.parse_output( - [mel_outputs, mel_outputs_postnet, gate_outputs, alignments], - output_lengths) - """ - - # NB: This was the old 'inference' method. It's the single entrypoint into mel inference. - def forward(self, inputs): - #torch.set_default_tensor_type('torch.DoubleTensor') - temp = self.embedding(inputs) - embedded_inputs = temp.transpose(1, 2) - encoder_outputs = self.encoder.forward(embedded_inputs) - mel_outputs, gate_outputs, alignments = self.decoder.forward(encoder_outputs) - - # TODO(bt): The postnet seemed to produce the *same* output, but perhaps not necessary - #mel_outputs_postnet = self.postnet(mel_outputs) - #mel_outputs_postnet = mel_outputs + mel_outputs_postnet - - outputs = self.parse_output( - [ - mel_outputs, - #mel_outputs_postnet, - gate_outputs, - alignments - ]) - - #return outputs - return outputs[0].float() diff --git a/tacotron_melgan/wrap_melgan_model.py b/tacotron_melgan/wrap_melgan_model.py deleted file mode 100755 index b96d9b0613..0000000000 --- a/tacotron_melgan/wrap_melgan_model.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 -# From: https://github.com/pytorch/pytorch/issues/20356#issuecomment-545572400 -import torch -import torch.nn as nn -import torch.nn.functional as F - -from collections import OrderedDict -import re -import yaml - -#torch.set_default_tensor_type('torch.DoubleTensor') - -class ResStack(nn.Module): - def __init__(self, channel): - super(ResStack, self).__init__() - - block_list = [ - nn.Sequential( - nn.LeakyReLU(0.2), - nn.ReflectionPad1d(3**i), - nn.utils.weight_norm(nn.Conv1d(channel, channel, kernel_size=3, dilation=3**i)), - nn.LeakyReLU(0.2), - nn.utils.weight_norm(nn.Conv1d(channel, channel, kernel_size=1)), - ) - for i in range(3) - ] - - self.block0 = block_list[0] - self.block1 = block_list[1] - self.block2 = block_list[2] - - shortcut_list = [ - nn.utils.weight_norm(nn.Conv1d(channel, channel, kernel_size=1)) - for i in range(3) - ] - - self.shortcut0 = shortcut_list[0] - self.shortcut1 = shortcut_list[1] - self.shortcut2 = shortcut_list[2] - - - def forward(self, x): - x = self.shortcut0(x) + self.block0(x) - x = self.shortcut1(x) + self.block1(x) - x = self.shortcut2(x) + self.block2(x) - return x - -class Container(torch.nn.Module): - def __init__(self): - super().__init__() - - mel_channel = 80 # TODO: Load from yaml - - self.generator = nn.Sequential( - nn.ReflectionPad1d(3), - nn.utils.weight_norm(nn.Conv1d(mel_channel, 512, kernel_size=7, stride=1)), - - nn.LeakyReLU(0.2), - nn.utils.weight_norm(nn.ConvTranspose1d(512, 256, kernel_size=16, stride=8, padding=4)), - - ResStack(256), - - nn.LeakyReLU(0.2), - nn.utils.weight_norm(nn.ConvTranspose1d(256, 128, kernel_size=16, stride=8, padding=4)), - - ResStack(128), - - nn.LeakyReLU(0.2), - nn.utils.weight_norm(nn.ConvTranspose1d(128, 64, kernel_size=4, stride=2, padding=1)), - - ResStack(64), - - nn.LeakyReLU(0.2), - nn.utils.weight_norm(nn.ConvTranspose1d(64, 32, kernel_size=4, stride=2, padding=1)), - - ResStack(32), - - nn.LeakyReLU(0.2), - nn.ReflectionPad1d(3), - nn.utils.weight_norm(nn.Conv1d(32, 1, kernel_size=7, stride=1)), - nn.Tanh(), - ) - - # TODO: Looks unnecessary. Remove once this works. - def eval(self): - super(Container, self).eval() - - - def forward(self, mel): - mel = (mel + 5.0) / 5.0 # roughly normalize spectrogram - audio = self.generator(mel) - - # From inference() method: - audio = audio.squeeze() - #MAX_WAV_VALUE = 32768.0 - #audio = MAX_WAV_VALUE * audio - - #return audio.float() - return audio - - -print('Loading melgan model...') -melgan_model_file = '/home/bt/models/melgan-swpark/firstgo_a7c2351_3650.pt' -melgan_model_file = '/home/bt/models/melgan-swpark/ljs-high-pitch_8741385_6975.pt' -melgan_model = torch.load(melgan_model_file, map_location=torch.device('cpu')) - -module = Container() - -# NB: This is done so we can rename the model components above since `zip` won't work :( -BLOCK_REGEX = re.compile('blocks\.(\d+)\.') -SHORTCUT_REGEX = re.compile('shortcuts\.(\d+)\.') - -new_model_g = [] # Rebuild the ordered dict -for key, value in melgan_model['model_g'].items(): - if 'blocks.' in key: - new_key = BLOCK_REGEX.sub(r'block\1.', key) - key = new_key - elif 'shortcuts.' in key: - new_key = SHORTCUT_REGEX.sub(r'shortcut\1.', key) - key = new_key - new_model_g.append((key, value)) - - -melgan_model['model_g'] = OrderedDict(new_model_g) - -print('Load state dict...') -module.load_state_dict(melgan_model['model_g']) - -#output_filename = 'melgan_container2.pt' -output_filename = 'melgan_ljs-high-pitch_container.pt' - -# NB: Tracing evaluates the model on input and unrolls and hardcodes branching -# and loops. Scripting allows these to remain by converting the entire program -# to TorchScript. Scripting seems MUCH faster, is also harder get working. -trace_model = True -if trace_model: - print('Tracing model and saving as: {}'.format(output_filename)) - mel_file = '/home/bt/dev/voder/data/mels/LJ002-0320.mel' - mel = torch.load(mel_file, map_location=torch.device('cpu')) - # NB: Getting `Tracing failed sanity checks! Graphs differed across invocations!` - traced_script_module = torch.jit.trace(module, mel, check_trace=True) - traced_script_module.save(output_filename) -else: - print('Saving script model as: {}'.format(output_filename)) - container = torch.jit.script(module) - container.save(output_filename) - - diff --git a/tacotron_melgan/wrap_tacotron2_model.py b/tacotron_melgan/wrap_tacotron2_model.py deleted file mode 100755 index 17c5035426..0000000000 --- a/tacotron_melgan/wrap_tacotron2_model.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python3 -# Adapted From: https://github.com/pytorch/pytorch/issues/20356#issuecomment-545572400 -import torch -import torch.nn as nn -import torch.nn.functional as F - -from collections import OrderedDict -import re -import yaml -from math import sqrt - -from tacotron_model import Tacotron2 - -# Going back in time, this is an old trump txlearned model: -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_ljs_arpabet_ckpt30000_2020_02_06' -# Starting again with new samples: -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt7000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt11500' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt17000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt27000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt27000-18000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt53500' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-14_chkpt112500' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-23_chkpt8000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-23_chkpt13000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-24_chkpt2000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-24_chkpt16000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-25_chkpt7000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-25_chkpt17000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-25_chkpt26500' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-25_chkpt40000' -tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_trump_txlearn_arpabet_2020-05-25_chkpt50000' - - -#output_filename = 'tacotron_arpabet_1.pt' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_ckpt30000_2020_02_06.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt7000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt11500.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt17000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt27000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt27000-18000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_ckpt53500.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-14_chkpt112500.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-23_chkpt8000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-23_chkpt13000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-24_chkpt2000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-24_chkpt16000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-25_chkpt7000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-25_chkpt17000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-25_chkpt26500.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-25_chkpt40000.jit' -output_filename = 'tacotron2_trump_txlearn_ljs_arpabet_2020-05-25_chkpt50000.jit' - - -# NB: Tacotron's original shape is [148, 512]. Arpabet encoding is [256, 512]. -NUM_SYMBOLS_ENCODED = 256 # 148 by default, 256 with my custom Arpabet encoding - -#torch.set_default_tensor_type('torch.DoubleTensor') -#torch.set_default_tensor_type('torch.FloatTensor') - -print('Loading tacotron model...') -#tacotron_model_file = '/home/bt/models/tacotron2-nvidia/tacotron2_statedict.pt' -tacotron_model = torch.load(tacotron_model_file, map_location=torch.device('cpu')) - -def cuda_to_cpu(model): - """Recursively make everything non-CUDA""" - if isinstance(model, dict) or isinstance(model, OrderedDict): - for key, value in model.items(): - model[key] = cuda_to_cpu(value) - return model - if isinstance(model, list): - for i, value in enumerate(model): - model[i] = cuda_to_cpu(value) - elif isinstance(model, torch.Tensor): - return model.cpu() - else: - return model - -# TODO: Maybe not necessary anymore with `map_location=torch.device('cpu')` -#print('Converitng to CPU model...') -#tacotron_model = cuda_to_cpu(tacotron_model) - -print('Remove unused keys...') -new_state_dict = [] # Rebuild the ordered dict -for key, value in tacotron_model['state_dict'].items(): - if key.startswith('postnet'): - continue - new_state_dict.append((key, value)) - -tacotron_model['state_dict'] = OrderedDict(new_state_dict) - -print('Containerizing model...') -# Save arbitrary values supported by TorchScript -# https://pytorch.org/docs/master/jit.html#supported-type - -# Yay duck typing -class HParams: - mask_padding = True - fp16_run = False - n_mel_channels = 80 - n_frames_per_step = 1 - n_symbols = NUM_SYMBOLS_ENCODED - symbols_embedding_dim = 512 - encoder_kernel_size = 5 - encoder_n_convolutions = 3 - encoder_embedding_dim = 512 - attention_rnn_dim = 1024 - decoder_rnn_dim = 1024 - prenet_dim = 256 - max_decoder_steps = 1000 - gate_threshold = 0.5 - p_attention_dropout = 0.1 - p_decoder_dropout = 0.1 - attention_dim = 128 - attention_location_n_filters = 32 - attention_location_kernel_size = 31 - -module = Tacotron2(HParams()) - -print('Load state dict...') -module.load_state_dict(tacotron_model['state_dict']) -#module.eval() # NB: Complains unless called: Did you forget call .eval() on your model? - -# NB: Tracing evaluates the model on input and unrolls and hardcodes branching -# and loops. Scripting allows these to remain by converting the entire program -# to TorchScript. Scripting seems MUCH faster, is also harder get working. -trace_model = False -if trace_model: - print('Tracing model and saving as:'.format(output_filename)) - text_sequence_file = '/home/bt/dev/voder/data/text/tacotron_text_sequence.pt' - text_sequence = torch.load(text_sequence_file, map_location=torch.device('cpu')) - # NB: Getting `Tracing failed sanity checks! Graphs differed across invocations!` - traced_script_module = torch.jit.trace(module, text_sequence, check_trace=False) - traced_script_module.save(output_filename) -else: - print('Saving script model as: {}'.format(output_filename)) - container = torch.jit.script(module) - container.save(output_filename) - -print('Done.') diff --git a/tacotron_tensorflow/Cargo.toml b/tacotron_tensorflow/Cargo.toml deleted file mode 100644 index 3ccde92641..0000000000 --- a/tacotron_tensorflow/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "tacotron_tensorflow" -version = "0.0.1" -authors = [ "Brandon Thomas ", - "Brandon Thomas " ] - -[[bin]] -name = "tacotron_tensorflow" -path = "src/main.rs" - -[dependencies] -hound = "3.4.0" # wav encoder/decoder -image = "0.23.0-preview.0" -sample = "0.10.0" # DSP toolkit -tensorflow = "0.14.0" diff --git a/tacotron_tensorflow/src/main.rs b/tacotron_tensorflow/src/main.rs deleted file mode 100644 index e835c1b967..0000000000 --- a/tacotron_tensorflow/src/main.rs +++ /dev/null @@ -1,280 +0,0 @@ -/** - * This takes SavedModels from Keith Ito's Tacotron impl and runs them in Rust. - * Critically, it can short-circuit the entire model evaluation and only run the pipeline - * pieces that we care about. - */ -extern crate hound; -extern crate image; -extern crate sample; -extern crate tensorflow; - -pub mod model; - -use tensorflow::{ - SessionOptions, - Session, - Graph, - Tensor, - SessionRunArgs -}; - -use model::print_tensorfow_version; -use sample::ring_buffer::Slice; -use image::RgbImage; -use image::ImageBuffer; -use image::Rgb; -use image::imageops::{rotate90, flip_horizontal, flip_vertical, resize, FilterType, crop}; - -const INPUT_NAME : &'static str = "inputs"; -const INPUT_LENGTHS_NAME : &'static str = "input_lengths"; - -// NB: This goes through the griffin-lim pipeline, but is hella slow off GPU -// The output of this is *actual* audio, though there are a few more steps in the -// network to run before the audio is a 1:1 match with Tacotron Python. -// Tensor("model/griffinlim/Squeeze:0", shape=(?,), dtype=float32) -//const OUTPUT_NAME : &'static str = "model/griffinlim/Squeeze"; - -// This appears to be the mel spectrogram before griffin-lim reconstruction. -// Image output shows visible formants. If my thinking holds, we can short circuit -// Griffin-Lim reconstruction and send this to a trained MelGan network for a HUGE -// performance boost end-to-end. It should even be realtime on a CPU. -// Executing the model to this point is *extremely* fast. -const OUTPUT_NAME : &'static str = "model/Pow_1"; - -/** - * To save: - print('Saving model...') - - # https://github.com/tensorflow/models/issues/3530#issuecomment-395968881 - output_dir = './tx_trained2/' - builder = tf.saved_model.builder.SavedModelBuilder(output_dir) - - builder.add_meta_graph_and_variables( - self.session, - [tf.saved_model.tag_constants.SERVING], - main_op=tf.tables_initializer(), - ) - - builder.save() - - # Save the model text labels to dereference - definition = self.session.graph_def - directory = 'saved_model_labels' - tf.train.write_graph(definition, directory, 'model_labels.pb', as_text=True) - */ -pub fn main() { - println!("Tacotron"); - print_tensorfow_version(); - - let dir_name = "/home/bt/dev/2nd/tacotron/tx_trained2"; - - let mut graph = Graph::new(); - let session = Session::from_saved_model( - &SessionOptions::new(), - &["serve"], - &mut graph, - dir_name, - ).expect("Should load"); - - println!("Model Loaded!"); - - // cleaned string "my name is donald trump" - let sentence = vec![ - 40, 52, 64, - 41, 28, 40, 32, 64, - 36, 46, 64, - 31, 42, 41, 28, 39, 31, 64, - 47, 45, 48, 40, 43, 1 - ]; - - /*let sentence = vec![ - 40, 52, 64, - 40, 52, 64, - 40, 52, 64, - 40, 52, 64, - 40, 52, 64, - 40, 52, 64, - 40, 52, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 41, 28, 40, 32, 64, - 36, 46, 64, - 36, 46, 64, - 36, 46, 64, - 36, 46, 64, - 36, 46, 64, - 31, 42, 41, 28, 39, 31, 64, - 47, 45, 48, 40, 43, 1 - ];*/ - - //for _i in 0..32 { - convert_sentence(&mut graph, &session, &sentence) - //} -} - -fn convert_sentence(graph: &mut Graph, session: &Session, sentence: &Vec) -> () { - let mut input = Tensor::new(&[1, sentence.len() as u64]) - .with_values( - // cleaned string "my name is donald trump" - sentence.slice() - ) - .unwrap(); - let mut input_length = Tensor::new(&[1]) - .with_values(&[sentence.len() as i32]) - .unwrap(); - println!(">>> Input tensor dims: {:?}", input.dims()); - { - let mut args = SessionRunArgs::new(); - - println!(">>> Inputs ..."); - args.add_feed(&graph.operation_by_name_required(INPUT_NAME) - .expect(INPUT_NAME), 0, &input); - - println!(">>> Input Lengths ..."); - args.add_feed(&graph.operation_by_name_required(INPUT_LENGTHS_NAME) - .expect(INPUT_LENGTHS_NAME), 0, &input_length); - - let z = args.request_fetch( - &graph.operation_by_name_required(OUTPUT_NAME) - .expect(OUTPUT_NAME), 0); - - println!(">>> Running..."); - - session.run(&mut args).expect("Run success"); - - // Check our results. - let z_res = args.fetch::(z).expect("ret"); - - println!("z_rez.dims(): {:?}", z_res.dims()); - println!("z_rez: {:?}", z_res); - - println!("Data[0]: {:?}", &z_res.get(0)); - println!("Data[1]: {:?}", &z_res.get(1)); - println!("Data[2]: {:?}", &z_res.get(2)); - - visualize(z_res); - - //let processed = process_audio(z_res.to_vec()); - //write_wav(processed); - } -} - -fn visualize(tensor : Tensor) { - let dims = tensor.dims(); - let width = *dims.get(0).unwrap() as u32; - let height = *dims.get(1).unwrap() as u32; - - let mut image: RgbImage = ImageBuffer::new(width, height); - - let mut i: u32 = 0; - let mut j: u32 = 0; - let mut k: u32 = 0; - - for x in tensor.iter() { - if j >= height { - j = 0; - i += 1 - } - if i >= width { - println!("Break @ {}", k); - break; - } - /*if i % 5 == 0 { - image.put_pixel(i, j, Rgb([0, 0, 0])); - } else { - image.put_pixel(i, j, Rgb([0, 255, 0])); - }*/ - // [-1.0, 1.0] - let val = (*x) * 255f32; - let val = val.abs() as u8; - image.put_pixel(i, j, Rgb([val, val, val])); - j += 1; - k += 1; - } - - //image = rotate90(&image); - //image = flip_horizontal(&image); - image = flip_vertical(&image); - let cropped = crop(&mut image,0, 0, 200, height); - let mut image = cropped.to_image(); - image = resize(&image, 200, 100, FilterType::Triangle); - image.save("output.png").unwrap(); - - println!("Dimensions: {:?}", dims); - println!("Width: {:?}", width); - println!("Height: {:?}", height); - println!("Num pixels calc: {:?}", (width * height)); - println!("Num pixels covered: {:?}", k); -} - -fn process_audio(signal: Vec) -> Vec { - // wav *= 32767 / max(0.01, np.max(np.abs(wav))) - // scipy.io.wavfile.write(path, hparams.sample_rate, wav.astype(np.int16)) - - // abs - //[0.0000000e+00 4.1254760e-12 7.1285297e-11 ... 5.9092813e-14 4.0335224e-14 - // 2.1358613e-15] - //max abs - //0.08918631 - - let signal = signal.iter() - .map(|f| *f as f64) - .collect::>(); - - let abs = signal.iter() - .map(|f| f.abs()) - .collect::>(); - - println!("Abs[0]: {:?}", &abs.get(0)); - println!("Abs[1]: {:?}", &abs.get(1)); - println!("Abs[2]: {:?}", &abs.get(2)); - - let max : f64 = abs.iter() - .fold(0.01f64, |x, y| x.max(*y)); - - - let signal_mult = signal.iter() - .map(|f| *f * 32767.0f64) - .collect::>(); - - let signal_div = signal_mult.iter() - .map(|f| *f / max) - .collect::>(); - - println!("Max: {:?}", max); - - let mult = 32767.0f64 / max; - let rust_mult = 367225.3669259117; - let python_mult = 367399.4329151011; - - println!("Mult: {:?}", mult); - - /*let result = signal.iter() - .map(|f| f * python_mult) - .collect::>(); - - println!("Res[0]: {:?}", &abs.get(0)); - println!("Res[1]: {:?}", &abs.get(1)); - println!("Res[2]: {:?}", &abs.get(2));*/ - - signal_div -} - -fn write_wav(signal: Vec) { - let spec = hound::WavSpec { - channels: 1, - sample_rate: 16000, - bits_per_sample: 32, - sample_format: hound::SampleFormat::Float, - }; - let mut writer = hound::WavWriter::create("output.wav", spec).unwrap(); - - for sample in signal { - writer.write_sample(sample as f32).unwrap(); - } - writer.finalize().unwrap(); -} \ No newline at end of file diff --git a/tacotron_tensorflow/src/model.rs b/tacotron_tensorflow/src/model.rs deleted file mode 100644 index e3e7650c41..0000000000 --- a/tacotron_tensorflow/src/model.rs +++ /dev/null @@ -1,149 +0,0 @@ -use tensorflow::Code; -use tensorflow::Graph; -use tensorflow::ImportGraphDefOptions; -use tensorflow::Session; -use tensorflow::SessionOptions; -use tensorflow::SessionRunArgs; -use tensorflow::Status; -use tensorflow::Tensor; -use tensorflow::version; - -const INPUT_NAME : &'static str = "input_A_test"; -const OUTPUT_NAME : &'static str = "generator_A2B_3/output_transpose"; - -pub struct VoiceModel { - graph: Graph, - session: Session, -} - -impl VoiceModel { - pub fn load(dir_name: &str) -> Self { - let mut graph = Graph::new(); - let session = Session::from_saved_model( - &SessionOptions::new(), - &["serve"], - &mut graph, - dir_name, - ).expect("Should load"); - - VoiceModel { - graph, - session, - } - } - - pub fn evaluate(&self, input: &Tensor) { - println!(">>> Input tensor dims: {:?}", input.dims()); - - // Run the graph. - let mut args = SessionRunArgs::new(); - - // input_A_test: - // Tensor("input_A_test:0", shape=(?, 24, ?), dtype=float32) - args.add_feed(&self.graph.operation_by_name_required(INPUT_NAME) - .expect(INPUT_NAME), 0, &input); - - // generation_B_test: - // Tensor("generator_A2B_3/output_transpose:0", shape=(?, 24, ?), dtype=float32) - let z = args.request_fetch( - &self.graph.operation_by_name_required(OUTPUT_NAME) - .expect(OUTPUT_NAME), 0); - - self.session.run(&mut args).expect("Run success"); - - // Check our results. - let z_res = args.fetch::(z).expect("ret"); - - println!("z_rez.dims(): {:?}", z_res.dims()); - println!("z_rez: {:?}", z_res); - } -} - -pub fn load_model() { - let model_dir = "/home/bt/dev/voder/saved_model"; - let model = VoiceModel::load(model_dir); - - // ] generation_B_test: Tensor("generator_A2B_3/output_transpose:0", shape=(?, 24, ?), dtype=float32) - // ] input_A_test: Tensor("input_A_test:0", shape=(?, 24, ?), dtype=float32) - // ] inputs.shape: (1, 24, 380) -- the last dimension is the signal - - let mut input = Tensor::new(&[1, 24, 10]) - .with_values(&[ - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0f32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - ]) - .unwrap(); - - model.evaluate(&input); - model.evaluate(&input); - model.evaluate(&input); -} - -/*fn load_model_2() { - // from regression_checkpoint.rs example - - let filename = "/home/bt/dev/voder/saved_model/saved_model.pb"; - - let mut graph = Graph::new(); - let mut proto = Vec::new(); - - File::open(filename) - .expect("opened") - .read_to_end(&mut proto) - .expect("cannot read"); - - graph.import_graph_def(&proto, &ImportGraphDefOptions::new()).expect("cannot import"); - - let session = Session::new(&SessionOptions::new(), &graph).expect("cannot session"); - - /*let op_x = graph.operation_by_name_required("x").expect("x"); - let op_y = graph.operation_by_name_required("y").expect("y"); - let op_init = graph.operation_by_name_required("init").expect("init"); - let op_train = graph.operation_by_name_required("train").expect("train"); - let op_w = graph.operation_by_name_required("w").expect("w"); - let op_b = graph.operation_by_name_required("b").expect("b"); - let op_file_path = graph.operation_by_name_required("save/Const").expect("const"); - let op_save = graph.operation_by_name_required("save/control_dependency").expect("save");*/ - - //let file_path_tensor: Tensor = - // Tensor::from(String::from("/home/bt/dev/voder/extra_model/sf1_tm1.ckpt.data-00000-of-00001")); - //println!("Tensor: {:?}", file_path_tensor); -}*/ - -pub fn print_tensorfow_version() { - // Python TensorFlow version: 1.14.0 - // Rust TensorFlow version: 1.13.1 (default, must be hand-upgraded) - let version = version().expect("version"); - println!("Tensorflow version: {}", version); - - let graph = Graph::new(); - let options = SessionOptions::new(); - let session = Session::new(&options, &graph).unwrap(); - let devices = session.device_list().unwrap(); - for device in devices { - println!("Device: {:?}", device); - } -} - diff --git a/voice_converter_sidecar/Cargo.toml b/voice_converter_sidecar/Cargo.toml deleted file mode 100644 index 44a4c412b7..0000000000 --- a/voice_converter_sidecar/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "voice_conversion_sidecar" -version = "0.1.0" -authors = [ "Brandon Thomas ", - "Brandon Thomas " ] -[[bin]] -name = "voice_converter_sidecar" -path = "src/main.rs" - -[dependencies] -byteorder = "1.3.2" # byte-level operations -bytes = "0.4.12" # required by 'prost' -cpal = "0.10.0" # hardware audio out -failure = "0.1.5" # required by cpal -prost = "0.5.*" # protobuf -prost-types = "0.5.0" # protobuf -wavy = "0.1.2" # real time audio capture and playback -# TODO: Move these into the voder project workspace. -world-sys = { path = "/home/bt/dev/world-sys" } # AWESOME WORLD VOCODER BINDINGS HAH HA HAH -zmq = "0.9.2" # zeromq - -[build-dependencies] -prost-build = "0.5.0" diff --git a/voice_converter_sidecar/README.md b/voice_converter_sidecar/README.md deleted file mode 100644 index 53648631d8..0000000000 --- a/voice_converter_sidecar/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Voice Converter Sidecar -======================= -This project spins up a Rust binary to handle audio input and output, then -ships microphone audio over proto/zeromq to a Python sidecar running -CycleGAN-VC to convert it into target speech. - -### CycleGAN -I've included a pared down copy of CycleGAN for the purposes of model -evaluation. It handles all of the audio buffering / sidecar integration -pieces. [The original CycleGAN I used is here](https://github.com/leimao/Voice_Converter_CycleGAN). - -#### Note on Training -It's possible to train and evaluate at the same time using dual GPUs -(at least my dual 1080Ti setup). To run the sidecar on a particular -GPU (0-indexded), use: - -``` -CUDA_VISIBLE_DEVICES=1 ./sidecar.py -``` - -### Proto Compilation (for Python) -Codegen for Rust is built in. Codegen for Python uses, - -``` -protoc --python_out=cycle_gan protos/audio.proto -``` - -### Current Results -Currently there is 4.39 seconds of delay between speaking and generated output -with the sidecar setup on my desktop computer. This is really great and seems -promising. - -This gets up to 6.0 seconds later. Drift continues to accrue, but it's a slow -build. diff --git a/voice_converter_sidecar/build.rs b/voice_converter_sidecar/build.rs deleted file mode 100644 index 5c0635ef0c..0000000000 --- a/voice_converter_sidecar/build.rs +++ /dev/null @@ -1,11 +0,0 @@ -extern crate prost_build; - -fn main() { - //prost_build::compile_protos(&["protos/audio.proto"], - // &["protos/"]).unwrap(); - prost_build::Config::new() - .out_dir("src/protos/") - .compile_protos(&["protos/audio.proto"], - &["protos/"]) - .unwrap(); -} \ No newline at end of file diff --git a/voice_converter_sidecar/cycle_gan/demo_server.py b/voice_converter_sidecar/cycle_gan/demo_server.py deleted file mode 100755 index 3b767ba631..0000000000 --- a/voice_converter_sidecar/cycle_gan/demo_server.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python3 - -""" -Starts a demo HTTP server to capture and transform audio -as a live demonstration of the trained model. - -Brandon Thomas 2019-07-29 -""" - -import argparse -import falcon -import io -import librosa -import numpy as np -import os -import scipy -import soundfile -import tensorflow as tf -import subprocess -import tempfile - -from falcon_multipart.middleware import MultipartMiddleware -from model import CycleGAN -from preprocess import * -from wsgiref import simple_server - -print("TensorFlow version: {}".format(tf.version.VERSION)) - -INDEX_HTML = ''' - - - -

Voice Demo

- - - - -
-
- -
-
- - - -''' - - -class Converter(): - def __init__(self, model_dir, model_name): - self.num_features = 24 - self.sampling_rate = 16000 - self.frame_period = 5.0 - - self.model = CycleGAN(num_features = self.num_features, mode = 'test') - - self.model.load(filepath = os.path.join(model_dir, model_name)) - - """ - # NB: Save the graph - definition = self.model.sess.graph_def - directory = 'saved_model_2' - tf.train.write_graph(definition, directory, 'saved_model_2.pb', as_text=True) - - # https://github.com/tensorflow/models/issues/3530#issuecomment-395968881 - output_dir = './saved_model/' - builder = tf.saved_model.builder.SavedModelBuilder(output_dir) - - builder.add_meta_graph_and_variables( - self.model.sess, - [tf.saved_model.tag_constants.SERVING], - main_op=tf.tables_initializer(), - ) - - builder.save() - """ - - """ - builder.add_meta_graph_and_variables( - self.model.sess, - [tf.saved_model.tag_constants.SERVING], - signature_def_map={ - 'predict_images': - prediction_signature, - signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY: - classification_signature, - }, - main_op=tf.tables_initializer()) - """ - - self.mcep_normalization_params = np.load(os.path.join(model_dir, 'mcep_normalization.npz')) - self.mcep_mean_A = self.mcep_normalization_params['mean_A'] - self.mcep_std_A = self.mcep_normalization_params['std_A'] - self.mcep_mean_B = self.mcep_normalization_params['mean_B'] - self.mcep_std_B = self.mcep_normalization_params['std_B'] - - self.logf0s_normalization_params = np.load(os.path.join(model_dir, 'logf0s_normalization.npz')) - self.logf0s_mean_A = self.logf0s_normalization_params['mean_A'] - self.logf0s_std_A = self.logf0s_normalization_params['std_A'] - self.logf0s_mean_B = self.logf0s_normalization_params['mean_B'] - self.logf0s_std_B = self.logf0s_normalization_params['std_B'] - - def convert(self, wav, conversion_direction='A2B'): - wav = wav_padding(wav = wav, sr = self.sampling_rate, frame_period = self.frame_period, multiple = 4) - f0, timeaxis, sp, ap = world_decompose(wav = wav, fs = self.sampling_rate, frame_period = self.frame_period) - coded_sp = world_encode_spectral_envelop(sp = sp, fs = self.sampling_rate, dim = self.num_features) - coded_sp_transposed = coded_sp.T - - if conversion_direction == 'A2B': - f0_converted = pitch_conversion(f0 = f0, mean_log_src = self.logf0s_mean_A, std_log_src = self.logf0s_std_A, mean_log_target = self.logf0s_mean_B, std_log_target = self.logf0s_std_B) - coded_sp_norm = (coded_sp_transposed - self.mcep_mean_A) / self.mcep_std_A - coded_sp_converted_norm = self.model.test(inputs = np.array([coded_sp_norm]), direction = conversion_direction)[0] - coded_sp_converted = coded_sp_converted_norm * self.mcep_std_B + self.mcep_mean_B - else: - f0_converted = pitch_conversion(f0 = f0, mean_log_src = self.logf0s_mean_B, std_log_src = self.logf0s_std_B, mean_log_target = self.logf0s_mean_A, std_log_target = self.logf0s_std_A) - coded_sp_norm = (coded_sp_transposed - self.mcep_mean_B) / self.mcep_std_B - coded_sp_converted_norm = self.model.test(inputs = np.array([coded_sp_norm]), direction = conversion_direction)[0] - coded_sp_converted = coded_sp_converted_norm * self.mcep_std_A + self.mcep_mean_A - - coded_sp_converted = coded_sp_converted.T - coded_sp_converted = np.ascontiguousarray(coded_sp_converted) - decoded_sp_converted = world_decode_spectral_envelop(coded_sp = coded_sp_converted, fs = self.sampling_rate) - wav_transformed = world_speech_synthesis(f0 = f0_converted, decoded_sp = decoded_sp_converted, ap = ap, fs = self.sampling_rate, frame_period = self.frame_period) - - # For debugging model output, uncomment the following line: - # librosa.output.write_wav('model_output.wav', wav_transformed, self.sampling_rate) - - # TODO: Perhaps ditch this. It's probably unnecessary work. - upsampled = librosa.resample(wav_transformed, self.sampling_rate, 48000) - pcm_data = upsampled.astype(np.float64) - stereo_pcm_data = np.tile(pcm_data, (2,1)).T - - buf = io.BytesIO() - scipy.io.wavfile.write(buf, 48000, stereo_pcm_data.astype(np.float32)) - return buf - -# Set up model -# This should live long in memory, so we do it up front. -model_dir_default = './model/sf1_tm1' -model_name_default = 'sf1_tm1.ckpt' -converter = Converter(model_dir_default, model_name_default) - -class IndexHandler(): - def on_get(self, request, response): - response.content_type = 'text/html' - response.body = INDEX_HTML - -class ApiHandler(): - def on_post(self, request, response): - # NB: uses middleware to pull out data. - form_data = request.params['audio_data'].file - data, samplerate = soundfile.read(form_data) - - print('samplerate', samplerate) - print('data', data) - print('data.shape', data.shape) - print('data.dtype', data.dtype) - - # For debugging browser input, uncomment the following line: - # scipy.io.wavfile.write('browser_input_audio.wav', samplerate, data) - - # NB: Convert the input stereo signal into mono. - # In the future the frontend should be responsible for sampling details. - mono = data[:, 0] - print('mono', mono) - print('mono.shape', mono.shape) - print('mono.dtype', mono.dtype) - - # NB: We must downsample to the rate that the network is trained on. - downsampled = librosa.resample(mono, samplerate, 16000) - print('downsampled', downsampled) - print('downsampled.shape', downsampled.shape) - print('downsampled.dtype', downsampled.dtype) - - # Evaluate the model - print(">>> Converting...") - results = converter.convert(downsampled, conversion_direction = 'A2B') - - print('type(results)', type(results)) - - temp_dir = tempfile.TemporaryDirectory(prefix='tmp_ml_audio') - temp_file = tempfile.NamedTemporaryFile(suffix='.wav') - - temp_file.write(results.read()) - - out_file = temp_dir.name + '/output.ogg' - - # NB: Browsers have a great deal of trouble decoding WAV files unless they are in the - # narrow slice of the WAV spec expected. None of the {librosa, scipy, soundfile} python - # tools do a good job of this, so here we shell out to ffmpeg and generate OGG. - # It's lazy and messy, but it works for now. - # See https://github.com/librosa/librosa/issues/361 for a survey of the library landscape - # See https://bugzilla.mozilla.org/show_bug.cgi?id=523837 for one of dozens of browser codec bugs - _stdout = subprocess.check_output(['ffmpeg', '-i', temp_file.name, '-acodec', 'libvorbis', out_file]) - - response.content_type = 'audio/ogg' - with open(out_file, mode='rb') as f: - response.data = f.read() - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--port', type=int, default=8000) - args = parser.parse_args() - - api = falcon.API(middleware=[MultipartMiddleware()]) - api.add_route('/', IndexHandler()) - api.add_route('/upload', ApiHandler()) - api.add_static_route('/script', os.path.abspath('./script')) - api.add_static_route('/sound', os.path.abspath('./sound')) - print('Serving on 0.0.0.0:%d' % args.port) - simple_server.make_server('0.0.0.0', args.port, api).serve_forever() - -if __name__ == '__main__': - main() - diff --git a/voice_converter_sidecar/cycle_gan/model.py b/voice_converter_sidecar/cycle_gan/model.py deleted file mode 100644 index cf7a32c1e7..0000000000 --- a/voice_converter_sidecar/cycle_gan/model.py +++ /dev/null @@ -1,183 +0,0 @@ -import os -import tensorflow as tf -from module import discriminator, generator_gatedcnn -from utils import l1_loss, l2_loss, cross_entropy_loss -from datetime import datetime - -class CycleGAN(object): - - def __init__(self, num_features, discriminator = discriminator, generator = generator_gatedcnn, mode = 'train', log_dir = './log'): - - self.num_features = num_features - self.input_shape = [None, num_features, None] # [batch_size, num_features, num_frames] - - self.discriminator = discriminator - self.generator = generator - self.mode = mode - - self.build_model() - self.optimizer_initializer() - - self.saver = tf.train.Saver() - - #config = tf.ConfigProto(device_count = {'GPU': 1}) - #self.sess = tf.Session(config=config) - self.sess = tf.Session() - self.sess.run(tf.global_variables_initializer()) - - if self.mode == 'train': - self.train_step = 0 - now = datetime.now() - self.log_dir = os.path.join(log_dir, now.strftime('%Y%m%d-%H%M%S')) - self.writer = tf.summary.FileWriter(self.log_dir, tf.get_default_graph()) - self.generator_summaries, self.discriminator_summaries = self.summary() - - def build_model(self): - - # Placeholders for real training samples - self.input_A_real = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_A_real') - self.input_B_real = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_B_real') - # Placeholders for fake generated samples - self.input_A_fake = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_A_fake') - self.input_B_fake = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_B_fake') - # Placeholder for test samples - self.input_A_test = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_A_test') - self.input_B_test = tf.placeholder(tf.float32, shape = self.input_shape, name = 'input_B_test') - - self.generation_B = self.generator(inputs = self.input_A_real, reuse = False, scope_name = 'generator_A2B') - self.cycle_A = self.generator(inputs = self.generation_B, reuse = False, scope_name = 'generator_B2A') - - self.generation_A = self.generator(inputs = self.input_B_real, reuse = True, scope_name = 'generator_B2A') - self.cycle_B = self.generator(inputs = self.generation_A, reuse = True, scope_name = 'generator_A2B') - - self.generation_A_identity = self.generator(inputs = self.input_A_real, reuse = True, scope_name = 'generator_B2A') - self.generation_B_identity = self.generator(inputs = self.input_B_real, reuse = True, scope_name = 'generator_A2B') - - self.discrimination_A_fake = self.discriminator(inputs = self.generation_A, reuse = False, scope_name = 'discriminator_A') - self.discrimination_B_fake = self.discriminator(inputs = self.generation_B, reuse = False, scope_name = 'discriminator_B') - - # Cycle loss - self.cycle_loss = l1_loss(y = self.input_A_real, y_hat = self.cycle_A) + l1_loss(y = self.input_B_real, y_hat = self.cycle_B) - - # Identity loss - self.identity_loss = l1_loss(y = self.input_A_real, y_hat = self.generation_A_identity) + l1_loss(y = self.input_B_real, y_hat = self.generation_B_identity) - - # Place holder for lambda_cycle and lambda_identity - self.lambda_cycle = tf.placeholder(tf.float32, None, name = 'lambda_cycle') - self.lambda_identity = tf.placeholder(tf.float32, None, name = 'lambda_identity') - - # Generator loss - # Generator wants to fool discriminator - self.generator_loss_A2B = l2_loss(y = tf.ones_like(self.discrimination_B_fake), y_hat = self.discrimination_B_fake) - self.generator_loss_B2A = l2_loss(y = tf.ones_like(self.discrimination_A_fake), y_hat = self.discrimination_A_fake) - - # Merge the two generators and the cycle loss - self.generator_loss = self.generator_loss_A2B + self.generator_loss_B2A + self.lambda_cycle * self.cycle_loss + self.lambda_identity * self.identity_loss - - # Discriminator loss - self.discrimination_input_A_real = self.discriminator(inputs = self.input_A_real, reuse = True, scope_name = 'discriminator_A') - self.discrimination_input_B_real = self.discriminator(inputs = self.input_B_real, reuse = True, scope_name = 'discriminator_B') - self.discrimination_input_A_fake = self.discriminator(inputs = self.input_A_fake, reuse = True, scope_name = 'discriminator_A') - self.discrimination_input_B_fake = self.discriminator(inputs = self.input_B_fake, reuse = True, scope_name = 'discriminator_B') - - # Discriminator wants to classify real and fake correctly - self.discriminator_loss_input_A_real = l2_loss(y = tf.ones_like(self.discrimination_input_A_real), y_hat = self.discrimination_input_A_real) - self.discriminator_loss_input_A_fake = l2_loss(y = tf.zeros_like(self.discrimination_input_A_fake), y_hat = self.discrimination_input_A_fake) - self.discriminator_loss_A = (self.discriminator_loss_input_A_real + self.discriminator_loss_input_A_fake) / 2 - - self.discriminator_loss_input_B_real = l2_loss(y = tf.ones_like(self.discrimination_input_B_real), y_hat = self.discrimination_input_B_real) - self.discriminator_loss_input_B_fake = l2_loss(y = tf.zeros_like(self.discrimination_input_B_fake), y_hat = self.discrimination_input_B_fake) - self.discriminator_loss_B = (self.discriminator_loss_input_B_real + self.discriminator_loss_input_B_fake) / 2 - - # Merge the two discriminators into one - self.discriminator_loss = self.discriminator_loss_A + self.discriminator_loss_B - - # Categorize variables because we have to optimize the two sets of the variables separately - trainable_variables = tf.trainable_variables() - self.discriminator_vars = [var for var in trainable_variables if 'discriminator' in var.name] - self.generator_vars = [var for var in trainable_variables if 'generator' in var.name] - #for var in t_vars: print(var.name) - - # Reserved for test - self.generation_B_test = self.generator(inputs = self.input_A_test, reuse = True, scope_name = 'generator_A2B') - self.generation_A_test = self.generator(inputs = self.input_B_test, reuse = True, scope_name = 'generator_B2A') - - - def optimizer_initializer(self): - - self.generator_learning_rate = tf.placeholder(tf.float32, None, name = 'generator_learning_rate') - self.discriminator_learning_rate = tf.placeholder(tf.float32, None, name = 'discriminator_learning_rate') - self.discriminator_optimizer = tf.train.AdamOptimizer(learning_rate = self.discriminator_learning_rate, beta1 = 0.5).minimize(self.discriminator_loss, var_list = self.discriminator_vars) - self.generator_optimizer = tf.train.AdamOptimizer(learning_rate = self.generator_learning_rate, beta1 = 0.5).minimize(self.generator_loss, var_list = self.generator_vars) - - def train(self, input_A, input_B, lambda_cycle, lambda_identity, generator_learning_rate, discriminator_learning_rate): - - generation_A, generation_B, generator_loss, _, generator_summaries = self.sess.run( - [self.generation_A, self.generation_B, self.generator_loss, self.generator_optimizer, self.generator_summaries], \ - feed_dict = {self.lambda_cycle: lambda_cycle, self.lambda_identity: lambda_identity, self.input_A_real: input_A, self.input_B_real: input_B, self.generator_learning_rate: generator_learning_rate}) - - self.writer.add_summary(generator_summaries, self.train_step) - - discriminator_loss, _, discriminator_summaries = self.sess.run([self.discriminator_loss, self.discriminator_optimizer, self.discriminator_summaries], \ - feed_dict = {self.input_A_real: input_A, self.input_B_real: input_B, self.discriminator_learning_rate: discriminator_learning_rate, self.input_A_fake: generation_A, self.input_B_fake: generation_B}) - - self.writer.add_summary(discriminator_summaries, self.train_step) - - self.train_step += 1 - - return generator_loss, discriminator_loss - - - def test(self, inputs, direction): - #print(">>> model.test()!") - - if direction == 'A2B': - #print("generation_B_test: {}".format(self.generation_B_test)) - #print("input_A_test: {}".format(self.input_A_test)) - generation = self.sess.run(self.generation_B_test, feed_dict = {self.input_A_test: inputs}) - elif direction == 'B2A': - #print("generation_A_test: {}".format(self.generation_A_test)) - #print("input_B_test: {}".format(self.input_B_test)) - generation = self.sess.run(self.generation_A_test, feed_dict = {self.input_B_test: inputs}) - else: - raise Exception('Conversion direction must be specified.') - - return generation - - - def save(self, directory, filename): - - if not os.path.exists(directory): - os.makedirs(directory) - self.saver.save(self.sess, os.path.join(directory, filename)) - - return os.path.join(directory, filename) - - def load(self, filepath): - - self.saver.restore(self.sess, filepath) - - - def summary(self): - - with tf.name_scope('generator_summaries'): - cycle_loss_summary = tf.summary.scalar('cycle_loss', self.cycle_loss) - identity_loss_summary = tf.summary.scalar('identity_loss', self.identity_loss) - generator_loss_A2B_summary = tf.summary.scalar('generator_loss_A2B', self.generator_loss_A2B) - generator_loss_B2A_summary = tf.summary.scalar('generator_loss_B2A', self.generator_loss_B2A) - generator_loss_summary = tf.summary.scalar('generator_loss', self.generator_loss) - generator_summaries = tf.summary.merge([cycle_loss_summary, identity_loss_summary, generator_loss_A2B_summary, generator_loss_B2A_summary, generator_loss_summary]) - - with tf.name_scope('discriminator_summaries'): - discriminator_loss_A_summary = tf.summary.scalar('discriminator_loss_A', self.discriminator_loss_A) - discriminator_loss_B_summary = tf.summary.scalar('discriminator_loss_B', self.discriminator_loss_B) - discriminator_loss_summary = tf.summary.scalar('discriminator_loss', self.discriminator_loss) - discriminator_summaries = tf.summary.merge([discriminator_loss_A_summary, discriminator_loss_B_summary, discriminator_loss_summary]) - - return generator_summaries, discriminator_summaries - - -if __name__ == '__main__': - - model = CycleGAN(num_features = 24) - #print('Graph Compile Successeded.') diff --git a/voice_converter_sidecar/cycle_gan/module.py b/voice_converter_sidecar/cycle_gan/module.py deleted file mode 100644 index 4319d9a1e2..0000000000 --- a/voice_converter_sidecar/cycle_gan/module.py +++ /dev/null @@ -1,214 +0,0 @@ -import tensorflow as tf - -def gated_linear_layer(inputs, gates, name = None): - - activation = tf.multiply(x = inputs, y = tf.sigmoid(gates), name = name) - - return activation - -def instance_norm_layer( - inputs, - epsilon = 1e-06, - activation_fn = None, - name = None): - - instance_norm_layer = tf.contrib.layers.instance_norm( - inputs = inputs, - epsilon = epsilon, - activation_fn = activation_fn) - - return instance_norm_layer - -def conv1d_layer( - inputs, - filters, - kernel_size, - strides = 1, - padding = 'same', - activation = None, - kernel_initializer = None, - name = None): - - conv_layer = tf.layers.conv1d( - inputs = inputs, - filters = filters, - kernel_size = kernel_size, - strides = strides, - padding = padding, - activation = activation, - kernel_initializer = kernel_initializer, - name = name) - - return conv_layer - -def conv2d_layer( - inputs, - filters, - kernel_size, - strides, - padding = 'same', - activation = None, - kernel_initializer = None, - name = None): - - conv_layer = tf.layers.conv2d( - inputs = inputs, - filters = filters, - kernel_size = kernel_size, - strides = strides, - padding = padding, - activation = activation, - kernel_initializer = kernel_initializer, - name = name) - - return conv_layer - -def residual1d_block( - inputs, - filters = 1024, - kernel_size = 3, - strides = 1, - name_prefix = 'residule_block_'): - - h1 = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_conv') - h1_norm = instance_norm_layer(inputs = h1, activation_fn = None, name = name_prefix + 'h1_norm') - h1_gates = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_gates') - h1_norm_gates = instance_norm_layer(inputs = h1_gates, activation_fn = None, name = name_prefix + 'h1_norm_gates') - h1_glu = gated_linear_layer(inputs = h1_norm, gates = h1_norm_gates, name = name_prefix + 'h1_glu') - h2 = conv1d_layer(inputs = h1_glu, filters = filters // 2, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h2_conv') - h2_norm = instance_norm_layer(inputs = h2, activation_fn = None, name = name_prefix + 'h2_norm') - - h3 = inputs + h2_norm - - return h3 - -def downsample1d_block( - inputs, - filters, - kernel_size, - strides, - name_prefix = 'downsample1d_block_'): - - h1 = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_conv') - h1_norm = instance_norm_layer(inputs = h1, activation_fn = None, name = name_prefix + 'h1_norm') - h1_gates = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_gates') - h1_norm_gates = instance_norm_layer(inputs = h1_gates, activation_fn = None, name = name_prefix + 'h1_norm_gates') - h1_glu = gated_linear_layer(inputs = h1_norm, gates = h1_norm_gates, name = name_prefix + 'h1_glu') - - return h1_glu - -def downsample2d_block( - inputs, - filters, - kernel_size, - strides, - name_prefix = 'downsample2d_block_'): - - h1 = conv2d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_conv') - h1_norm = instance_norm_layer(inputs = h1, activation_fn = None, name = name_prefix + 'h1_norm') - h1_gates = conv2d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_gates') - h1_norm_gates = instance_norm_layer(inputs = h1_gates, activation_fn = None, name = name_prefix + 'h1_norm_gates') - h1_glu = gated_linear_layer(inputs = h1_norm, gates = h1_norm_gates, name = name_prefix + 'h1_glu') - - return h1_glu - -def upsample1d_block( - inputs, - filters, - kernel_size, - strides, - shuffle_size = 2, - name_prefix = 'upsample1d_block_'): - - h1 = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_conv') - h1_shuffle = pixel_shuffler(inputs = h1, shuffle_size = shuffle_size, name = name_prefix + 'h1_shuffle') - h1_norm = instance_norm_layer(inputs = h1_shuffle, activation_fn = None, name = name_prefix + 'h1_norm') - - h1_gates = conv1d_layer(inputs = inputs, filters = filters, kernel_size = kernel_size, strides = strides, activation = None, name = name_prefix + 'h1_gates') - h1_shuffle_gates = pixel_shuffler(inputs = h1_gates, shuffle_size = shuffle_size, name = name_prefix + 'h1_shuffle_gates') - h1_norm_gates = instance_norm_layer(inputs = h1_shuffle_gates, activation_fn = None, name = name_prefix + 'h1_norm_gates') - - h1_glu = gated_linear_layer(inputs = h1_norm, gates = h1_norm_gates, name = name_prefix + 'h1_glu') - - return h1_glu - -def pixel_shuffler(inputs, shuffle_size = 2, name = None): - - n = tf.shape(inputs)[0] - w = tf.shape(inputs)[1] - c = inputs.get_shape().as_list()[2] - - oc = c // shuffle_size - ow = w * shuffle_size - - outputs = tf.reshape(tensor = inputs, shape = [n, ow, oc], name = name) - - return outputs - -def generator_gatedcnn(inputs, reuse = False, scope_name = 'generator_gatedcnn'): - - # inputs has shape [batch_size, num_features, time] - # we need to convert it to [batch_size, time, num_features] for 1D convolution - inputs = tf.transpose(inputs, perm = [0, 2, 1], name = 'input_transpose') - - with tf.variable_scope(scope_name) as scope: - # Discriminator would be reused in CycleGAN - if reuse: - scope.reuse_variables() - else: - assert scope.reuse is False - - h1 = conv1d_layer(inputs = inputs, filters = 128, kernel_size = 15, strides = 1, activation = None, name = 'h1_conv') - h1_gates = conv1d_layer(inputs = inputs, filters = 128, kernel_size = 15, strides = 1, activation = None, name = 'h1_conv_gates') - h1_glu = gated_linear_layer(inputs = h1, gates = h1_gates, name = 'h1_glu') - - # Downsample - d1 = downsample1d_block(inputs = h1_glu, filters = 256, kernel_size = 5, strides = 2, name_prefix = 'downsample1d_block1_') - d2 = downsample1d_block(inputs = d1, filters = 512, kernel_size = 5, strides = 2, name_prefix = 'downsample1d_block2_') - - # Residual blocks - r1 = residual1d_block(inputs = d2, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block1_') - r2 = residual1d_block(inputs = r1, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block2_') - r3 = residual1d_block(inputs = r2, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block3_') - r4 = residual1d_block(inputs = r3, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block4_') - r5 = residual1d_block(inputs = r4, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block5_') - r6 = residual1d_block(inputs = r5, filters = 1024, kernel_size = 3, strides = 1, name_prefix = 'residual1d_block6_') - - # Upsample - u1 = upsample1d_block(inputs = r6, filters = 1024, kernel_size = 5, strides = 1, shuffle_size = 2, name_prefix = 'upsample1d_block1_') - u2 = upsample1d_block(inputs = u1, filters = 512, kernel_size = 5, strides = 1, shuffle_size = 2, name_prefix = 'upsample1d_block2_') - - # Output - o1 = conv1d_layer(inputs = u2, filters = 24, kernel_size = 15, strides = 1, activation = None, name = 'o1_conv') - o2 = tf.transpose(o1, perm = [0, 2, 1], name = 'output_transpose') - - return o2 - - -def discriminator(inputs, reuse = False, scope_name = 'discriminator'): - - # inputs has shape [batch_size, num_features, time] - # we need to add channel for 2D convolution [batch_size, num_features, time, 1] - inputs = tf.expand_dims(inputs, -1) - - with tf.variable_scope(scope_name) as scope: - # Discriminator would be reused in CycleGAN - if reuse: - scope.reuse_variables() - else: - assert scope.reuse is False - - h1 = conv2d_layer(inputs = inputs, filters = 128, kernel_size = [3, 3], strides = [1, 2], activation = None, name = 'h1_conv') - h1_gates = conv2d_layer(inputs = inputs, filters = 128, kernel_size = [3, 3], strides = [1, 2], activation = None, name = 'h1_conv_gates') - h1_glu = gated_linear_layer(inputs = h1, gates = h1_gates, name = 'h1_glu') - - # Downsample - d1 = downsample2d_block(inputs = h1_glu, filters = 256, kernel_size = [3, 3], strides = [2, 2], name_prefix = 'downsample2d_block1_') - d2 = downsample2d_block(inputs = d1, filters = 512, kernel_size = [3, 3], strides = [2, 2], name_prefix = 'downsample2d_block2_') - d3 = downsample2d_block(inputs = d2, filters = 1024, kernel_size = [6, 3], strides = [1, 2], name_prefix = 'downsample2d_block3_') - - # Output - o1 = tf.layers.dense(inputs = d3, units = 1, activation = tf.nn.sigmoid) - - return o1 - diff --git a/voice_converter_sidecar/cycle_gan/preprocess.py b/voice_converter_sidecar/cycle_gan/preprocess.py deleted file mode 100644 index f073b0bbb8..0000000000 --- a/voice_converter_sidecar/cycle_gan/preprocess.py +++ /dev/null @@ -1,238 +0,0 @@ -import librosa -import numpy as np -import os -import pyworld - -def load_wavs(wav_dir, sr): - - wavs = list() - for file in os.listdir(wav_dir): - file_path = os.path.join(wav_dir, file) - wav, _ = librosa.load(file_path, sr = sr, mono = True) - #wav = wav.astype(np.float64) - wavs.append(wav) - - return wavs - -def world_decompose(wav, fs, frame_period = 5.0): - - # Decompose speech signal into f0, spectral envelope and aperiodicity using WORLD - wav = wav.astype(np.float64) - f0, timeaxis = pyworld.harvest(wav, fs, frame_period = frame_period, f0_floor = 71.0, f0_ceil = 800.0) - sp = pyworld.cheaptrick(wav, f0, timeaxis, fs) - ap = pyworld.d4c(wav, f0, timeaxis, fs) - - return f0, timeaxis, sp, ap - -def world_encode_spectral_envelop(sp, fs, dim = 24): - - # Get Mel-cepstral coefficients (MCEPs) - - #sp = sp.astype(np.float64) - coded_sp = pyworld.code_spectral_envelope(sp, fs, dim) - - return coded_sp - -def world_decode_spectral_envelop(coded_sp, fs): - - fftlen = pyworld.get_cheaptrick_fft_size(fs) - #coded_sp = coded_sp.astype(np.float32) - #coded_sp = np.ascontiguousarray(coded_sp) - decoded_sp = pyworld.decode_spectral_envelope(coded_sp, fs, fftlen) - - return decoded_sp - - -def world_encode_data(wavs, fs, frame_period = 5.0, coded_dim = 24): - - f0s = list() - timeaxes = list() - sps = list() - aps = list() - coded_sps = list() - - for wav in wavs: - f0, timeaxis, sp, ap = world_decompose(wav = wav, fs = fs, frame_period = frame_period) - coded_sp = world_encode_spectral_envelop(sp = sp, fs = fs, dim = coded_dim) - f0s.append(f0) - timeaxes.append(timeaxis) - sps.append(sp) - aps.append(ap) - coded_sps.append(coded_sp) - - return f0s, timeaxes, sps, aps, coded_sps - - -def transpose_in_list(lst): - - transposed_lst = list() - for array in lst: - transposed_lst.append(array.T) - return transposed_lst - - -def world_decode_data(coded_sps, fs): - - decoded_sps = list() - - for coded_sp in coded_sps: - decoded_sp = world_decode_spectral_envelop(coded_sp, fs) - decoded_sps.append(decoded_sp) - - return decoded_sps - - -def world_speech_synthesis(f0, decoded_sp, ap, fs, frame_period): - - #decoded_sp = decoded_sp.astype(np.float64) - wav = pyworld.synthesize(f0, decoded_sp, ap, fs, frame_period) - # Librosa could not save wav if not doing so - wav = wav.astype(np.float32) - - return wav - - -def world_synthesis_data(f0s, decoded_sps, aps, fs, frame_period): - - wavs = list() - - for f0, decoded_sp, ap in zip(f0s, decoded_sps, aps): - wav = world_speech_synthesis(f0, decoded_sp, ap, fs, frame_period) - wavs.append(wav) - - return wavs - - -def coded_sps_normalization_fit_transoform(coded_sps): - - coded_sps_concatenated = np.concatenate(coded_sps, axis = 1) - coded_sps_mean = np.mean(coded_sps_concatenated, axis = 1, keepdims = True) - coded_sps_std = np.std(coded_sps_concatenated, axis = 1, keepdims = True) - - coded_sps_normalized = list() - for coded_sp in coded_sps: - coded_sps_normalized.append((coded_sp - coded_sps_mean) / coded_sps_std) - - return coded_sps_normalized, coded_sps_mean, coded_sps_std - -def coded_sps_normalization_transoform(coded_sps, coded_sps_mean, coded_sps_std): - - coded_sps_normalized = list() - for coded_sp in coded_sps: - coded_sps_normalized.append((coded_sp - coded_sps_mean) / coded_sps_std) - - return coded_sps_normalized - -def coded_sps_normalization_inverse_transoform(normalized_coded_sps, coded_sps_mean, coded_sps_std): - - coded_sps = list() - for normalized_coded_sp in normalized_coded_sps: - coded_sps.append(normalized_coded_sp * coded_sps_std + coded_sps_mean) - - return coded_sps - -def coded_sp_padding(coded_sp, multiple = 4): - - num_features = coded_sp.shape[0] - num_frames = coded_sp.shape[1] - num_frames_padded = int(np.ceil(num_frames / multiple)) * multiple - num_frames_diff = num_frames_padded - num_frames - num_pad_left = num_frames_diff // 2 - num_pad_right = num_frames_diff - num_pad_left - coded_sp_padded = np.pad(coded_sp, ((0, 0), (num_pad_left, num_pad_right)), 'constant', constant_values = 0) - - return coded_sp_padded - -def wav_padding(wav, sr, frame_period, multiple = 4): - - assert wav.ndim == 1 - num_frames = len(wav) - num_frames_padded = int((np.ceil((np.floor(num_frames / (sr * frame_period / 1000)) + 1) / multiple + 1) * multiple - 1) * (sr * frame_period / 1000)) - num_frames_diff = num_frames_padded - num_frames - num_pad_left = num_frames_diff // 2 - num_pad_right = num_frames_diff - num_pad_left - wav_padded = np.pad(wav, (num_pad_left, num_pad_right), 'constant', constant_values = 0) - - return wav_padded - - -def logf0_statistics(f0s): - - log_f0s_concatenated = np.ma.log(np.concatenate(f0s)) - log_f0s_mean = log_f0s_concatenated.mean() - log_f0s_std = log_f0s_concatenated.std() - - return log_f0s_mean, log_f0s_std - -def pitch_conversion(f0, mean_log_src, std_log_src, mean_log_target, std_log_target): - - # Logarithm Gaussian normalization for Pitch Conversions - f0_converted = np.exp((np.log(f0) - mean_log_src) / std_log_src * std_log_target + mean_log_target) - - return f0_converted - -def wavs_to_specs(wavs, n_fft = 1024, hop_length = None): - - stfts = list() - for wav in wavs: - stft = librosa.stft(wav, n_fft = n_fft, hop_length = hop_length) - stfts.append(stft) - - return stfts - - -def wavs_to_mfccs(wavs, sr, n_fft = 1024, hop_length = None, n_mels = 128, n_mfcc = 24): - - mfccs = list() - for wav in wavs: - mfcc = librosa.feature.mfcc(y = wav, sr = sr, n_fft = n_fft, hop_length = hop_length, n_mels = n_mels, n_mfcc = n_mfcc) - mfccs.append(mfcc) - - return mfccs - - -def mfccs_normalization(mfccs): - - mfccs_concatenated = np.concatenate(mfccs, axis = 1) - mfccs_mean = np.mean(mfccs_concatenated, axis = 1, keepdims = True) - mfccs_std = np.std(mfccs_concatenated, axis = 1, keepdims = True) - - mfccs_normalized = list() - for mfcc in mfccs: - mfccs_normalized.append((mfcc - mfccs_mean) / mfccs_std) - - return mfccs_normalized, mfccs_mean, mfccs_std - - -def sample_train_data(dataset_A, dataset_B, n_frames = 128): - - num_samples = min(len(dataset_A), len(dataset_B)) - train_data_A_idx = np.arange(len(dataset_A)) - train_data_B_idx = np.arange(len(dataset_B)) - np.random.shuffle(train_data_A_idx) - np.random.shuffle(train_data_B_idx) - train_data_A_idx_subset = train_data_A_idx[:num_samples] - train_data_B_idx_subset = train_data_B_idx[:num_samples] - - train_data_A = list() - train_data_B = list() - - for idx_A, idx_B in zip(train_data_A_idx_subset, train_data_B_idx_subset): - data_A = dataset_A[idx_A] - frames_A_total = data_A.shape[1] - assert frames_A_total >= n_frames - start_A = np.random.randint(frames_A_total - n_frames + 1) - end_A = start_A + n_frames - train_data_A.append(data_A[:,start_A:end_A]) - - data_B = dataset_B[idx_B] - frames_B_total = data_B.shape[1] - assert frames_B_total >= n_frames - start_B = np.random.randint(frames_B_total - n_frames + 1) - end_B = start_B + n_frames - train_data_B.append(data_B[:,start_B:end_B]) - - train_data_A = np.array(train_data_A) - train_data_B = np.array(train_data_B) - - return train_data_A, train_data_B \ No newline at end of file diff --git a/voice_converter_sidecar/cycle_gan/protos/audio_pb2.py b/voice_converter_sidecar/cycle_gan/protos/audio_pb2.py deleted file mode 100644 index 735b5e398c..0000000000 --- a/voice_converter_sidecar/cycle_gan/protos/audio_pb2.py +++ /dev/null @@ -1,260 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: protos/audio.proto - -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='protos/audio.proto', - package='voder_audio', - syntax='proto3', - serialized_pb=_b('\n\x12protos/audio.proto\x12\x0bvoder_audio\"\xe6\x04\n\x12VocodeAudioRequest\x12\x13\n\x0b\x66loat_audio\x18\x01 \x03(\x02\x12\x1c\n\x14request_batch_number\x18\x02 \x01(\x03\x12\x43\n\rvocode_params\x18\n \x01(\x0b\x32,.voder_audio.VocodeAudioRequest.VocodeParams\x12\x13\n\x0bskip_vocode\x18\x04 \x01(\x08\x12\x1b\n\x13\x62uffer_size_minimum\x18\x06 \x01(\x05\x12\x1d\n\x15\x64iscard_vocoded_audio\x18\x08 \x01(\x08\x1a\x86\x03\n\x0cVocodeParams\x12\x1b\n\x13initial_sample_rate\x18\x01 \x01(\x05\x12\x1c\n\x14original_source_rate\x18\t \x01(\x05\x12!\n\x19original_source_save_file\x18\n \x01(\x08\x12\x1c\n\x14pre_convert_resample\x18\x02 \x01(\x08\x12!\n\x19pre_convert_resample_rate\x18\x03 \x01(\x05\x12&\n\x1epre_convert_resample_save_file\x18\x04 \x01(\x08\x12*\n\"model_hyperparameter_sampling_rate\x18\x05 \x01(\x05\x12\x17\n\x0fmodel_save_file\x18\x0b \x01(\x08\x12\x1d\n\x15post_convert_resample\x18\x06 \x01(\x08\x12\"\n\x1apost_convert_resample_rate\x18\x07 \x01(\x05\x12\'\n\x1fpost_convert_resample_save_file\x18\x08 \x01(\x08\"I\n\x13VocodeAudioResponse\x12\x13\n\x0b\x66loat_audio\x18\x01 \x03(\x02\x12\x1d\n\x15response_batch_number\x18\x02 \x01(\x03\x62\x06proto3') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - - - - -_VOCODEAUDIOREQUEST_VOCODEPARAMS = _descriptor.Descriptor( - name='VocodeParams', - full_name='voder_audio.VocodeAudioRequest.VocodeParams', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='initial_sample_rate', full_name='voder_audio.VocodeAudioRequest.VocodeParams.initial_sample_rate', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='original_source_rate', full_name='voder_audio.VocodeAudioRequest.VocodeParams.original_source_rate', index=1, - number=9, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='original_source_save_file', full_name='voder_audio.VocodeAudioRequest.VocodeParams.original_source_save_file', index=2, - number=10, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='pre_convert_resample', full_name='voder_audio.VocodeAudioRequest.VocodeParams.pre_convert_resample', index=3, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='pre_convert_resample_rate', full_name='voder_audio.VocodeAudioRequest.VocodeParams.pre_convert_resample_rate', index=4, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='pre_convert_resample_save_file', full_name='voder_audio.VocodeAudioRequest.VocodeParams.pre_convert_resample_save_file', index=5, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='model_hyperparameter_sampling_rate', full_name='voder_audio.VocodeAudioRequest.VocodeParams.model_hyperparameter_sampling_rate', index=6, - number=5, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='model_save_file', full_name='voder_audio.VocodeAudioRequest.VocodeParams.model_save_file', index=7, - number=11, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='post_convert_resample', full_name='voder_audio.VocodeAudioRequest.VocodeParams.post_convert_resample', index=8, - number=6, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='post_convert_resample_rate', full_name='voder_audio.VocodeAudioRequest.VocodeParams.post_convert_resample_rate', index=9, - number=7, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='post_convert_resample_save_file', full_name='voder_audio.VocodeAudioRequest.VocodeParams.post_convert_resample_save_file', index=10, - number=8, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=260, - serialized_end=650, -) - -_VOCODEAUDIOREQUEST = _descriptor.Descriptor( - name='VocodeAudioRequest', - full_name='voder_audio.VocodeAudioRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='float_audio', full_name='voder_audio.VocodeAudioRequest.float_audio', index=0, - number=1, type=2, cpp_type=6, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='request_batch_number', full_name='voder_audio.VocodeAudioRequest.request_batch_number', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='vocode_params', full_name='voder_audio.VocodeAudioRequest.vocode_params', index=2, - number=10, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='skip_vocode', full_name='voder_audio.VocodeAudioRequest.skip_vocode', index=3, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='buffer_size_minimum', full_name='voder_audio.VocodeAudioRequest.buffer_size_minimum', index=4, - number=6, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='discard_vocoded_audio', full_name='voder_audio.VocodeAudioRequest.discard_vocoded_audio', index=5, - number=8, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[_VOCODEAUDIOREQUEST_VOCODEPARAMS, ], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=36, - serialized_end=650, -) - - -_VOCODEAUDIORESPONSE = _descriptor.Descriptor( - name='VocodeAudioResponse', - full_name='voder_audio.VocodeAudioResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='float_audio', full_name='voder_audio.VocodeAudioResponse.float_audio', index=0, - number=1, type=2, cpp_type=6, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='response_batch_number', full_name='voder_audio.VocodeAudioResponse.response_batch_number', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=652, - serialized_end=725, -) - -_VOCODEAUDIOREQUEST_VOCODEPARAMS.containing_type = _VOCODEAUDIOREQUEST -_VOCODEAUDIOREQUEST.fields_by_name['vocode_params'].message_type = _VOCODEAUDIOREQUEST_VOCODEPARAMS -DESCRIPTOR.message_types_by_name['VocodeAudioRequest'] = _VOCODEAUDIOREQUEST -DESCRIPTOR.message_types_by_name['VocodeAudioResponse'] = _VOCODEAUDIORESPONSE - -VocodeAudioRequest = _reflection.GeneratedProtocolMessageType('VocodeAudioRequest', (_message.Message,), dict( - - VocodeParams = _reflection.GeneratedProtocolMessageType('VocodeParams', (_message.Message,), dict( - DESCRIPTOR = _VOCODEAUDIOREQUEST_VOCODEPARAMS, - __module__ = 'protos.audio_pb2' - # @@protoc_insertion_point(class_scope:voder_audio.VocodeAudioRequest.VocodeParams) - )) - , - DESCRIPTOR = _VOCODEAUDIOREQUEST, - __module__ = 'protos.audio_pb2' - # @@protoc_insertion_point(class_scope:voder_audio.VocodeAudioRequest) - )) -_sym_db.RegisterMessage(VocodeAudioRequest) -_sym_db.RegisterMessage(VocodeAudioRequest.VocodeParams) - -VocodeAudioResponse = _reflection.GeneratedProtocolMessageType('VocodeAudioResponse', (_message.Message,), dict( - DESCRIPTOR = _VOCODEAUDIORESPONSE, - __module__ = 'protos.audio_pb2' - # @@protoc_insertion_point(class_scope:voder_audio.VocodeAudioResponse) - )) -_sym_db.RegisterMessage(VocodeAudioResponse) - - -# @@protoc_insertion_point(module_scope) diff --git a/voice_converter_sidecar/cycle_gan/requirements.txt b/voice_converter_sidecar/cycle_gan/requirements.txt deleted file mode 100644 index 143c687f82..0000000000 --- a/voice_converter_sidecar/cycle_gan/requirements.txt +++ /dev/null @@ -1,36 +0,0 @@ -absl-py==0.7.1 -astor==0.8.0 -audioread==2.1.8 -cffi==1.12.3 -Cython==0.29.12 -decorator==4.4.0 -falcon==2.0.0 -falcon-multipart==0.2.0 -gast==0.2.2 -google-pasta==0.1.7 -grpcio==1.22.0 -h5py==2.9.0 -joblib==0.13.2 -Keras-Applications==1.0.8 -Keras-Preprocessing==1.1.0 -librosa==0.7.0 -llvmlite==0.29.0 -Markdown==3.1.1 -numba==0.45.0 -numpy==1.16.4 -protobuf==3.9.0 -pycparser==2.19 -pyworld==0.2.8 -pyzmq==18.1.0 -resampy==0.2.1 -scikit-learn==0.21.2 -scipy==1.3.0 -six==1.12.0 -SoundFile==0.10.2 -tensorboard==1.14.0 -tensorflow-estimator==1.14.0 -tensorflow-gpu==1.14.0 -termcolor==1.1.0 -Werkzeug==0.15.5 -wrapt==1.11.2 -zmq==0.0.0 diff --git a/voice_converter_sidecar/cycle_gan/script/recorder.js b/voice_converter_sidecar/cycle_gan/script/recorder.js deleted file mode 100644 index 0fcb6b3cab..0000000000 --- a/voice_converter_sidecar/cycle_gan/script/recorder.js +++ /dev/null @@ -1,357 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Recorder = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -""" - -# noinspection PyInterpreter -import argparse -import io -import librosa -import numpy as np -import os -import pathlib -import scipy -import soundfile -import struct -import subprocess -import tempfile -import tensorflow as tf -import zmq - -from model import CycleGAN -from preprocess import * -from protos.audio_pb2 import VocodeAudioRequest -from protos.audio_pb2 import VocodeAudioResponse - -print("TensorFlow version: {}".format(tf.version.VERSION)) - - -class Converter(): - def __init__(self, model_dir, model_name): - self.num_features = 24 - self.frame_period = 5.0 - - self.model = CycleGAN(num_features = self.num_features, mode = 'test') - - self.model.load(filepath = os.path.join(model_dir, model_name)) - - self.mcep_normalization_params = np.load(os.path.join(model_dir, 'mcep_normalization.npz')) - self.mcep_mean_A = self.mcep_normalization_params['mean_A'] - self.mcep_std_A = self.mcep_normalization_params['std_A'] - self.mcep_mean_B = self.mcep_normalization_params['mean_B'] - self.mcep_std_B = self.mcep_normalization_params['std_B'] - - self.logf0s_normalization_params = np.load(os.path.join(model_dir, - 'logf0s_normalization.npz')) - self.logf0s_mean_A = self.logf0s_normalization_params['mean_A'] - self.logf0s_std_A = self.logf0s_normalization_params['std_A'] - self.logf0s_mean_B = self.logf0s_normalization_params['mean_B'] - self.logf0s_std_B = self.logf0s_normalization_params['std_B'] - - def convert_partial(self, wav, conversion_direction='A2B', model_sampling_rate=16000): - wav = wav_padding(wav = wav, - sr = model_sampling_rate, - frame_period = self.frame_period, - multiple = 4) - - #librosa.output.write_wav('wav_padding.wav', wav, model_sampling_rate) - - f0, timeaxis, sp, ap = world_decompose(wav = wav, - fs = model_sampling_rate, - frame_period = self.frame_period) - coded_sp = world_encode_spectral_envelop(sp = sp, - fs = model_sampling_rate, - dim = self.num_features) - coded_sp_transposed = coded_sp.T - - f0_converted = pitch_conversion(f0 = f0, - mean_log_src = self.logf0s_mean_A, - std_log_src = self.logf0s_std_A, - mean_log_target = self.logf0s_mean_B, - std_log_target = self.logf0s_std_B) - coded_sp_norm = (coded_sp_transposed - self.mcep_mean_A) / self.mcep_std_A - - coded_sp_converted_norm = self.model.test(inputs = np.array([coded_sp_norm]), - direction = conversion_direction)[0] - coded_sp_converted = coded_sp_converted_norm * self.mcep_std_B + self.mcep_mean_B - - coded_sp_converted = coded_sp_converted.T - coded_sp_converted = np.ascontiguousarray(coded_sp_converted) - decoded_sp_converted = world_decode_spectral_envelop(coded_sp = coded_sp_converted, - fs = model_sampling_rate) - wav_transformed = world_speech_synthesis(f0 = f0_converted, - decoded_sp = decoded_sp_converted, - ap = ap, - fs = model_sampling_rate, - frame_period = self.frame_period) - - # For debugging model output, uncomment the following line: - #librosa.output.write_wav('model_output.wav', wav_transformed, model_sampling_rate) - - # TODO: Perhaps ditch this. It's probably unnecessary work. - #upsampled = librosa.resample(wav_transformed, model_sampling_rate, 48000) - #pcm_data = upsampled.astype(np.float64) - #stereo_pcm_data = np.tile(pcm_data, (2,1)).T - #return stereo_pcm_data.astype(np.float32) - #librosa.output.write_wav('model_output.wav', pcm_data, 48000) - - #return wav - return wav_transformed - - #def convert(self, wav, conversion_direction='A2B'): - # pcm_data = self.convert_partial(wav, conversion_direction=conversion_direction) - # buf = io.BytesIO() - # # pcm_data: A 1-D or 2-D numpy array of either integer or float data-type. - # # To write multiple-channels, use a 2-D array of shape (Nsamples, Nchannels). - # scipy.io.wavfile.write(buf, 48000, pcm_data) - # return buf - -# Set up model -# This should live long in memory, so we do it up front. -model_dir_default = './model/sf1_tm1' -model_name_default = 'sf1_tm1.ckpt' - -# TODO: UNCOMMENT -converter = Converter(model_dir_default, model_name_default) - -TEMP_DIR = tempfile.TemporaryDirectory(prefix='queue_audio') - -def temp_file_name(suffix='.wav'): - # NB: Not actually using the tempfile. Just the random name. - temp_file = tempfile.NamedTemporaryFile(suffix=suffix) - name = os.path.basename(temp_file.name) - return os.path.join(TEMP_DIR.name, name) - -def convert(audio, - vocode_params=None, - request_batch_number=0, - skip_vocode=False, - save_files=False, - discard_vocoded_audio=False): - #audio = np.array(audio, dtype=np.int16) - #data, samplerate = soundfile.read(audio) - #print('samplerate', samplerate) - """ - samplerate 44100 - data.shape (77824, 2) - data.dtype float64 - mono [0.0050354 0.00518799 0.0050354 ... 0.11651611 0.11935425 0.1164856 ] - mono.shape (77824,) - mono.dtype float64 - downsampled [0.00329925 0.00577342 0.00474898 ... 0.0851728 0.1166483 0. ] - downsampled.shape (28236,) - downsampled.dtype float64 - - 1) Data should be float64 - 2) Output is BYTES!! Not floats. - 3) Result is still somehow mono!? - -------------------------------------------------- - - demo_server.py - - capture sample rate = 44100 - downsample for algorithm = 16000 - upsample after done = 48000 - - """ - - audio = np.array(audio, dtype=np.float64) - print('audio.shape', audio.shape) - print('audio.type', audio.dtype) - - #source_rate = 88000 # Experimentally determined for Rust library 'CPAL' - #source_rate = 44100 - - if vocode_params.original_source_save_file: - #filename = temp_file_name('.wav') - filename = 'debug/{}_original_source.wav'.format(request_batch_number) - print('----- Original wav file out: {}'.format(filename)) - scipy.io.wavfile.write(filename, vocode_params.original_source_rate, audio) - - # NB: Convert the input stereo signal into mono. - # In the future the frontend should be responsible for sampling details. - #audio = audio[:, 0] - - if vocode_params.pre_convert_resample: - print("Resampling audio from {} Hz to {} Hz".format(vocode_params.original_source_rate, - vocode_params.pre_convert_resample_rate)) - audio = librosa.resample(audio, vocode_params.original_source_rate, vocode_params.pre_convert_resample_rate) - print('resampled_audio.shape', audio.shape) - print('resampled_audio.type', audio.dtype) - if vocode_params.pre_convert_resample_save_file: - #filename = temp_file_name('.wav') - filename = 'debug/{}_pre_convert_resample.wav'.format(request_batch_number) - print('----- Pre-downsampled file out: {}'.format(filename)) - scipy.io.wavfile.write(filename, vocode_params.pre_convert_resample_rate, audio) - - if skip_vocode: - return audio - - results = converter.convert_partial(audio, - conversion_direction='A2B', - model_sampling_rate=vocode_params.model_hyperparameter_sampling_rate) - - if vocode_params.model_save_file: - #filename = temp_file_name('.wav') - filename = 'debug/{}_model_output.wav'.format(request_batch_number) - print('----- Model file out: {}'.format(filename)) - scipy.io.wavfile.write(filename, vocode_params.model_hyperparameter_sampling_rate, results) - - print('results.type', type(results)) - print('results.len', len(results)) - - if vocode_params.post_convert_resample: - print("Resampling output audio from {} Hz to {} Hz".format(vocode_params.model_hyperparameter_sampling_rate, - vocode_params.post_convert_resample_rate)) - #consume_rate = 68000 # Experimentally determined for Rust lib 'CPAL' - results = librosa.resample(results, - vocode_params.model_hyperparameter_sampling_rate, - vocode_params.post_convert_resample_rate) - if vocode_params.post_convert_resample_save_file: - #filename = temp_file_name('.wav') - filename = 'debug/{}_post_convert_resample.wav'.format(request_batch_number) - print('----- Upsampled (transformed) file out: {}'.format(filename)) - scipy.io.wavfile.write(filename, vocode_params.post_convert_resample_rate, results) - - if discard_vocoded_audio: - return audio - else: - return results - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--port', type=int, default=5555) - args = parser.parse_args() - - context = zmq.Context() - socket = context.socket(zmq.REP) - socket.bind("tcp://*:{}".format(args.port)) - print('Running server...') - - queue = [] - while True: - # Wait for next request from client - message = socket.recv() - - vocode_request = VocodeAudioRequest.FromString(message) - vocode_params = vocode_request.vocode_params - - queue.extend(vocode_request.float_audio) - - if len(queue) >= vocode_request.buffer_size_minimum: - #results = queue[:] - results = convert(queue, - vocode_params=vocode_params, - request_batch_number=vocode_request.request_batch_number, - skip_vocode=vocode_request.skip_vocode, - discard_vocoded_audio=vocode_request.discard_vocoded_audio) - queue = [] - - vocode_response = VocodeAudioResponse() - vocode_response.float_audio[:] = results - - socket.send(vocode_response.SerializeToString()) - else: - # Must send reply back to client - socket.send(b"OK") - -if __name__ == '__main__': - main() - diff --git a/voice_converter_sidecar/cycle_gan/utils.py b/voice_converter_sidecar/cycle_gan/utils.py deleted file mode 100644 index 858af12c74..0000000000 --- a/voice_converter_sidecar/cycle_gan/utils.py +++ /dev/null @@ -1,17 +0,0 @@ -import tensorflow as tf -import os -import random -import numpy as np - -def l1_loss(y, y_hat): - - return tf.reduce_mean(tf.abs(y - y_hat)) - -def l2_loss(y, y_hat): - - return tf.reduce_mean(tf.square(y - y_hat)) - -def cross_entropy_loss(logits, labels): - return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits = logits, labels = labels)) - - diff --git a/voice_converter_sidecar/protos/audio.proto b/voice_converter_sidecar/protos/audio.proto deleted file mode 100644 index 46e26b60a1..0000000000 --- a/voice_converter_sidecar/protos/audio.proto +++ /dev/null @@ -1,64 +0,0 @@ -syntax = "proto3"; -package voder_audio; - -message VocodeAudioRequest { - repeated float float_audio = 1; - - // An autoincrement sent with each request. - int64 request_batch_number = 2; - - message VocodeParams { - // The initial sample rate coming from the microphone. - int32 initial_sample_rate = 1; - - // Original sample - int32 original_source_rate = 9; - bool original_source_save_file = 10; - - // Resample before passing to the algorithm? - bool pre_convert_resample = 2; - int32 pre_convert_resample_rate = 3; - bool pre_convert_resample_save_file = 4; - - // The hard-coded hyperparameter of the model. - // Probably don't want to change from 16000. - int32 model_hyperparameter_sampling_rate = 5; - bool model_save_file = 11; - - // Resample after passing to the algorithm? - bool post_convert_resample = 6; - int32 post_convert_resample_rate = 7; - bool post_convert_resample_save_file = 8; - } - - VocodeParams vocode_params = 10; - - // We'll resend these params for every batch, but will only use - // the last batch's settings. Kind of a dumb API, but it'll work. - //int32 sample_rate = 2; - - //bool skip_resample = 3; - bool skip_vocode = 4; - - // Debugging - //bool save_files = 5; - - // How big we let the buffer grow before running 'convert'. - int32 buffer_size_minimum = 6; - - // Requested output rate - //int32 output_rate = 7; - - // Discard the vocoded audio and return the original - bool discard_vocoded_audio = 8; - - // Rate param for the model - //int32 model_sampling_rate = 9; -} - -message VocodeAudioResponse { - repeated float float_audio = 1; - - // A sidecar-side autoincrement sent with each request. - int64 response_batch_number = 2; -} diff --git a/voice_converter_sidecar/src/audio_hardware.rs b/voice_converter_sidecar/src/audio_hardware.rs deleted file mode 100644 index 32f31fc866..0000000000 --- a/voice_converter_sidecar/src/audio_hardware.rs +++ /dev/null @@ -1,84 +0,0 @@ -use cpal::traits::{DeviceTrait, EventLoopTrait, HostTrait}; -use cpal; -use audio_queue::AudioQueue; -use std::sync::Arc; - -/// CPAL Audio Device -/// Access audio input and output streams. -pub struct AudioHardware { - host: cpal::Host, - event_loop: cpal::EventLoop, - microphone_queue: Arc, - speaker_queue: Arc, -} - -impl AudioHardware { - pub fn new(microphone_queue: Arc, speaker_queue: Arc) -> Result { - let host = cpal::default_host(); - let event_loop = host.event_loop(); - - let input_device = host.default_input_device().expect("failed to get default input device"); - let output_device = host.default_output_device().expect("failed to get default output device"); - - println!("Using default input device: \"{}\"", input_device.name()?); - println!("Using default output device: \"{}\"", output_device.name()?); - - // We'll try and use the same format between streams to keep it simple - let mut format = input_device.default_input_format()?; - format.data_type = cpal::SampleFormat::F32; - - // Build streams. - println!("Attempting to build both streams with `{:?}`.", format); - let input_stream_id = event_loop.build_input_stream(&input_device, &format)?; - let output_stream_id = event_loop.build_output_stream(&output_device, &format)?; - println!("Successfully built streams."); - - Ok(AudioHardware { - host, - event_loop, - microphone_queue, - speaker_queue, - }) - } - - pub fn run(&mut self) { - self.event_loop.run(|id, result| { - let data = match result { - Ok(data) => data, - Err(err) => { - eprintln!("An error occurred on stream {:?}: {}", id, err); - return; - } - }; - - match data { - cpal::StreamData::Input { buffer: cpal::UnknownTypeInputBuffer::F32(buffer) } => { - //assert_eq!(id, input_stream_id); - let mut output_fell_behind = false; - for &sample in buffer.iter() { - self.microphone_queue.push_back(sample); - } - }, - cpal::StreamData::Output { buffer: cpal::UnknownTypeOutputBuffer::F32(mut buffer) } => { - //println!("Audio out buffer len: {}", self.speaker_queue.len()); - let request_size = buffer.len(); - let mut drained = self.speaker_queue.drain_size((request_size)); - match drained { - None => { - for sample in buffer.iter_mut() { - *sample = 0.0; - } - }, - Some(mut drained) => { - for (i, sample) in buffer.iter_mut().enumerate() { - *sample = drained.get(i).copied().unwrap(); - //*sample = 0.0; - } - }, - } - }, - _ => panic!("We're expecting f32 data."), - } - }) - } -} diff --git a/voice_converter_sidecar/src/audio_queue.rs b/voice_converter_sidecar/src/audio_queue.rs deleted file mode 100644 index f8314aa7c7..0000000000 --- a/voice_converter_sidecar/src/audio_queue.rs +++ /dev/null @@ -1,78 +0,0 @@ -use zmq; -use zmq::{Error, Socket}; -use std::collections::VecDeque; -use std::sync::{RwLock, PoisonError}; - -pub struct AudioQueue { - queue: RwLock>, -} - -impl AudioQueue { - pub fn new() -> Self { - Self { - queue: RwLock::new(VecDeque::new()), - } - } - - pub fn push_back(&self, val: f32) { - match self.queue.write() { - Ok(mut queue) => { - queue.push_back(val); - }, - Err(_) => { - unreachable!("This shouldn't happen (push_back)"); - }, - } - } - - pub fn extend(&self, buf: Vec) { - match self.queue.write() { - Ok(mut queue) => { - queue.extend(buf); - }, - Err(_) => { - unreachable!("This shouldn't happen (extend)"); - }, - } - } - - pub fn drain(&self) -> Vec { - match self.queue.write() { - Ok(mut queue) => { - return queue.drain(..) - .collect::>(); - }, - Err(_) => { - unreachable!("This shouldn't happen (drain)"); - }, - } - } - - pub fn drain_size(&self, size: usize) -> Option> { - match self.queue.write() { - Ok(mut queue) => { - if queue.len() < size { - return None; - } - let vec = queue.drain(0..size) - .collect::>(); - - return Some(vec); - }, - Err(_) => { - unreachable!("This shouldn't happen (drain_size)"); - }, - } - } - - pub fn len(&self) -> usize { - match self.queue.read() { - Ok(mut queue) => { - return queue.len(); - }, - Err(_) => { - unreachable!("This shouldn't happen (len)"); - }, - } - } -} diff --git a/voice_converter_sidecar/src/main.rs b/voice_converter_sidecar/src/main.rs deleted file mode 100644 index 80f840b0c5..0000000000 --- a/voice_converter_sidecar/src/main.rs +++ /dev/null @@ -1,72 +0,0 @@ -//! -//! This is a process that captures microphone input, ships proto-over-zeromq to a python -//! CycleGAN-VC (tensorflow) sidecar server, collects the results, then plays them over -//! the speaker. -//! - -extern crate bytes; -extern crate byteorder; -extern crate cpal; -extern crate failure; -extern crate prost; -extern crate prost_types; -extern crate wavy; -extern crate world_sys; -extern crate zmq; - -//include!(concat!(env!("OUT_DIR"), "/voder.audio.rs")); - -pub mod audio_hardware; -pub mod audio_queue; -//pub mod model; -pub mod protos; -pub mod sidecar; -pub mod synthesis; - -use audio_hardware::AudioHardware; -use protos::voder_audio::VocodeAudioRequest; -use protos::voder_audio::VocodeAudioResponse; -use sidecar::Sidecar; - -use wavy::*; - -use byteorder::{ByteOrder, BigEndian, LittleEndian, ReadBytesExt}; -use failure::_core::time::Duration; -use audio_queue::AudioQueue; -use prost::Message; -//use model::load_model; -//use model::print_version; -use std::collections::VecDeque; -use std::fs::File; -use std::io::{Read, Cursor}; -use std::path::Path; -use std::process::exit; -use std::sync::Arc; -use std::thread; -use zmq::{Error, Socket}; -use protos::voder_audio::vocode_audio_request::VocodeParams; - -fn main() { - //print_version(); - //load_model(); // TODO: This works. Temporarily commented out - run_audio().expect("Should work"); -} - -const LATENCY_MS: f32 = 50.0; - -fn run_audio() -> Result<(), failure::Error> { - let mut microphone_queue = Arc::new(AudioQueue::new()); - let mut microphone_queue_2 = microphone_queue.clone(); - - let mut post_process_queue = Arc::new(AudioQueue::new()); - let mut post_process_queue_2 = post_process_queue.clone(); - let mut sidecar = Sidecar::new("tcp://127.0.0.1:5555", microphone_queue_2, post_process_queue); - - thread::spawn(move || { - sidecar.run(); - }); - - let mut audio_hardware = AudioHardware::new(microphone_queue, post_process_queue_2).expect(""); - audio_hardware.run(); - Ok(()) -} diff --git a/voice_converter_sidecar/src/protos/mod.rs b/voice_converter_sidecar/src/protos/mod.rs deleted file mode 100644 index 5e3380f41f..0000000000 --- a/voice_converter_sidecar/src/protos/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod voder_audio; \ No newline at end of file diff --git a/voice_converter_sidecar/src/protos/voder_audio.rs b/voice_converter_sidecar/src/protos/voder_audio.rs deleted file mode 100644 index 4dde4f4b21..0000000000 --- a/voice_converter_sidecar/src/protos/voder_audio.rs +++ /dev/null @@ -1,70 +0,0 @@ -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct VocodeAudioRequest { - #[prost(float, repeated, tag="1")] - pub float_audio: ::std::vec::Vec, - /// An autoincrement sent with each request. - #[prost(int64, tag="2")] - pub request_batch_number: i64, - #[prost(message, optional, tag="10")] - pub vocode_params: ::std::option::Option, - // We'll resend these params for every batch, but will only use - // the last batch's settings. Kind of a dumb API, but it'll work. - //int32 sample_rate = 2; - - ///bool skip_resample = 3; - #[prost(bool, tag="4")] - pub skip_vocode: bool, - // Debugging - //bool save_files = 5; - - /// How big we let the buffer grow before running 'convert'. - #[prost(int32, tag="6")] - pub buffer_size_minimum: i32, - // Requested output rate - //int32 output_rate = 7; - - /// Discard the vocoded audio and return the original - #[prost(bool, tag="8")] - pub discard_vocoded_audio: bool, -} -pub mod vocode_audio_request { - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct VocodeParams { - /// The initial sample rate coming from the microphone. - #[prost(int32, tag="1")] - pub initial_sample_rate: i32, - /// Original sample - #[prost(int32, tag="9")] - pub original_source_rate: i32, - #[prost(bool, tag="10")] - pub original_source_save_file: bool, - /// Resample before passing to the algorithm? - #[prost(bool, tag="2")] - pub pre_convert_resample: bool, - #[prost(int32, tag="3")] - pub pre_convert_resample_rate: i32, - #[prost(bool, tag="4")] - pub pre_convert_resample_save_file: bool, - /// The hard-coded hyperparameter of the model. - /// Probably don't want to change from 16000. - #[prost(int32, tag="5")] - pub model_hyperparameter_sampling_rate: i32, - #[prost(bool, tag="11")] - pub model_save_file: bool, - /// Resample after passing to the algorithm? - #[prost(bool, tag="6")] - pub post_convert_resample: bool, - #[prost(int32, tag="7")] - pub post_convert_resample_rate: i32, - #[prost(bool, tag="8")] - pub post_convert_resample_save_file: bool, - } -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct VocodeAudioResponse { - #[prost(float, repeated, tag="1")] - pub float_audio: ::std::vec::Vec, - /// A sidecar-side autoincrement sent with each request. - #[prost(int64, tag="2")] - pub response_batch_number: i64, -} diff --git a/voice_converter_sidecar/src/sidecar.rs b/voice_converter_sidecar/src/sidecar.rs deleted file mode 100644 index 600ee00ba2..0000000000 --- a/voice_converter_sidecar/src/sidecar.rs +++ /dev/null @@ -1,217 +0,0 @@ -use audio_queue::AudioQueue; -use prost::Message; -use protos::voder_audio::VocodeAudioRequest; -use protos::voder_audio::VocodeAudioResponse; -use protos::voder_audio::vocode_audio_request::VocodeParams; -use std::collections::VecDeque; -use std::sync::Arc; -use zmq::{Error, Socket}; -use zmq; - -/// Talks a custom protobuf over ZeroMQ protocol to a Python TensorFlow sidecar process -/// that evaluates the model and ships back audio byte results. -pub struct Sidecar { - socket_endpoint: String, - microphone_queue: Arc, - processed_queue: Arc, -} - -impl Sidecar { - pub fn new(socket_endpoint: &str, - microphone_queue: Arc, - processed_queue: Arc) -> Self { - Self { - socket_endpoint: socket_endpoint.into(), - microphone_queue, - processed_queue, - } - } - - /// Heuristic to determine if a speaker is speaking. - /// Basically just checks audio loudness. - fn is_speaking(audio: &Vec) -> bool { - let mut avg_pos = 0.0f32; - let mut num_pos = 0; - - for x in audio { - if x > &0.0f32 { - avg_pos += x; - num_pos += 1; - } - } - - avg_pos = avg_pos / num_pos as f32; - avg_pos > 0.006f32 - } - - pub fn run(&mut self) { - let mut context = zmq::Context::new(); - let mut socket = context.socket(zmq::REQ).unwrap(); - - socket.connect(&self.socket_endpoint).unwrap(); - - let mut reconnect = false; - let mut fail_count = 0; - - const SEND_SIZE : usize = 5000; - - let mut request_batch_number = 0i64; - - let mut activated = false; - let mut frames_activated = 0; - let mut frames_deactivated = 0; - - let mut ring_buffer = VecDeque::with_capacity(5); - - loop { - let mut drained = match self.microphone_queue.drain_size(SEND_SIZE) { - None => { continue; }, - Some(d) => d, - }; - - /* - Heuristic for audio. Don't record when silent (using threshold). - - mic: act act act dec act act act act dec dec dec dec dec act dec - sent: | ok ok ok ok ok ok ok ok ok ok ok| - */ - - - // NB: We don't want to lose audio right at the activating edge. - // Save some bounded history to replay once activated. - ring_buffer.push_back(drained.clone()); - if ring_buffer.len() > 5 { - ring_buffer.pop_front(); - } - - if activated { - if !Self::is_speaking(&drained) { - frames_deactivated += 1; - } else { - frames_deactivated = 0; - } - - if frames_deactivated > 20 { - println!("Deactivating edge"); - activated = false; - frames_activated = 0; - frames_deactivated = 0; - } - - } else { - if Self::is_speaking(&drained) { - frames_activated += 1; - } else { - frames_activated = 0; - } - - if frames_activated > 3 { - println!("Activating edge"); - activated = true; - frames_activated = 0; - frames_deactivated = 0; - } - } - - if !activated { - continue; - } - - let drained = ring_buffer.drain(..) - .flat_map(|sample| sample) - .collect::>(); - - request_batch_number += 1; - - let mut vocode_request = VocodeAudioRequest::default(); - //vocode_request.sample_rate = 16000; - //vocode_request.output_rate = 16000; - //vocode_request.model_sampling_rate = 88000; // This is close! - //vocode_request.model_sampling_rate = 88000; - //vocode_request.skip_resample = false; - vocode_request.skip_vocode = false; - vocode_request.discard_vocoded_audio = false; - //vocode_request.buffer_size_minimum = 5000; // AWFUL. SO CHOPPY. - //vocode_request.buffer_size_minimum = 50000; // Practically real time, but lots more phase distortion. - //vocode_request.buffer_size_minimum = 30000; // Hm, hmm... not bad - vocode_request.buffer_size_minimum = 70000; // Sounds pretty good. - //vocode_request.buffer_size_minimum = 100000; // This sounds good! A bit slow ~3seconds. - //vocode_request.buffer_size_minimum = 200000; - vocode_request.float_audio = drained.clone(); - vocode_request.request_batch_number = request_batch_number; - - let mut vocode_params = VocodeParams::default(); - vocode_params.original_source_rate = 88000; // This is correct for saving - - vocode_params.pre_convert_resample = true; - vocode_params.pre_convert_resample_rate = 16000; - - vocode_params.model_hyperparameter_sampling_rate = 16000; - - vocode_params.post_convert_resample = true; - vocode_params.post_convert_resample_rate = 88000; - - vocode_params.original_source_save_file = false; - vocode_params.pre_convert_resample_save_file = false; - vocode_params.model_save_file = false; - vocode_params.post_convert_resample_save_file = false; - - vocode_request.vocode_params = Some(vocode_params); - - let mut encoded_bytes = Vec::with_capacity(vocode_request.encoded_len()); - vocode_request.encode(&mut encoded_bytes).unwrap(); - - if reconnect { - reconnect = false; - println!("RECONNECT"); - - //thread::sleep(Duration::from_millis(200)); - - socket = match context.socket(zmq::REQ) { - Ok(s) => s, - Err(e) => { - println!("Error creating socket: {:?}", e); - continue - }, - }; - - match socket.connect("tcp://127.0.0.1:5555") { - Ok(_) => {}, - Err(err) => { - println!("Err B: {:?}", err); - }, - } - } - - match socket.send(&encoded_bytes, 0) { - Ok(_) => { - //println!("Sent len: {}", bytes.len()); - }, - Err(e) => { - println!("send err {}: {:?}", e.to_raw(), e); - fail_count += 1; - }, - } - - match socket.recv_bytes(0) { - Ok(buf) => { - //println!("---> Buf len: {}", buf.len()); - if buf.len() > 2 { - // Receive data condition. - let vocode_response = VocodeAudioResponse::decode(buf).unwrap(); - self.processed_queue.extend(vocode_response.float_audio); - } - }, - Err(e) => { - fail_count += 1; - println!("recv err: {:?}", e); - }, - } - - if fail_count > 5 { - fail_count = 0; - reconnect = true; - } - } - } -} \ No newline at end of file diff --git a/voice_converter_sidecar/src/synthesis.rs b/voice_converter_sidecar/src/synthesis.rs deleted file mode 100644 index b7c926be21..0000000000 --- a/voice_converter_sidecar/src/synthesis.rs +++ /dev/null @@ -1,38 +0,0 @@ -use world_sys::core::synthesize::SynthesizeError; -use world_sys::core::synthesize::SynthesizeResult; -use world_sys::core::synthesize::synthesize; - -use world_sys::core::spectral::code_spectral_envelope; - -/* -TODO: ALGORITHM TO GET VOICE TRANSFORMATION: - -- [mono] -- [librosa.resample (downsample)] -- core convert() - - wav_padding() - - [maths] - - [np.pad] - - world_decompose() - - pyworld.harvest - - pyworld.cheaptrick - - pyworld.d4c - - world_encode_spectral_envelope() - - pyworld.code_spectral_envelope - - [matrix transpose] - - pitch_conversion() - - [maths] - - [maths : coded_sp_norm] - - << evaluate ML model >> - - [maths : coded_sp_converted] - - [matrix transpose] - - [np.ascontiguousarray] - - world_decode_spectral_envelop - - pyworld.get_cheaptrick_fft_size - - pyworld.decode_spectral_envelope - - world_speech_synthesis - - pyworld.synthesize - - [librosa.resample (upsample)] - - [wav things] -*/ -