From 9f3f4f7d60944f19f6f06b6d64633dc1eff101aa Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 17 Sep 2019 01:50:47 -0400 Subject: [PATCH] model loads! --- Cargo.lock | 25 +++++++++++++++++++------ Cargo.toml | 8 +++++++- src/main.rs | 9 +++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b750c32a38..4fa04ee38a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,6 +297,11 @@ name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "half" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hound" version = "3.4.0" @@ -668,20 +673,29 @@ dependencies = [ [[package]] name = "tensorflow" version = "0.13.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.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tensorflow-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tensorflow-macros 0.0.1", + "tensorflow-sys 0.16.0", +] + +[[package]] +name = "tensorflow-macros" +version = "0.0.1" +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.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -746,7 +760,7 @@ dependencies = [ "hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "sample 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "sonogram 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tensorflow 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tensorflow 0.13.0", "wavy 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -837,6 +851,7 @@ dependencies = [ "checksum filetime 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd7380b54ced79dda72ecc35cc4fbbd1da6bba54afaa37e96fd1c2a308cd469" "checksum flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaffba6388640136149e18ed080b77a78611c1e1d6de75aedcdf78df5d4682" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum half 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9353c2a89d550b58fa0061d8ed8d002a7d8cdf2494eb0e432859bd3a9e543836" "checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" "checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -882,8 +897,6 @@ dependencies = [ "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" -"checksum tensorflow 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e798f185e00736e185ee1f4a15e0cc788ff01222913a4060d62ffeafde442d7e" -"checksum tensorflow-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f45e5e974e61ac7efaeb52f63d5a596cce8f2197ddde9788fcc35aca40f2ccc5" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" diff --git a/Cargo.toml b/Cargo.toml index d3ae7d3136..bdaff1661a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,15 @@ failure = "0.1.5" # required by cpal hound = "3.4.0" # wav encoder/decoder sample = "0.10.0" # DSP toolkit sonogram = "0.3.0" # badass spectrograms -tensorflow = "0.13.0" # tensorflow bindings wavy = "0.1.2" # real time audio capture and playback + +# NB: Manually upgraded 'tensorflow-sys' library from 1.13.1 to 1.14.0 +# The downloaded tensorflow libs in target/ must be moved to /lib +# (I couldn't figure out the Rust linker flags) +tensorflow = { path = "/home/bt/dev/3rd/tensorflow.rs" } +#tensorflow = "0.13.0" # tensorflow bindings + #chrono #clap #log diff --git a/src/main.rs b/src/main.rs index 6886db5199..1fac5311e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,14 +20,23 @@ use tensorflow::SessionOptions; use tensorflow::SessionRunArgs; use tensorflow::Status; use tensorflow::Tensor; +use tensorflow::version; fn main() { + print_version(); load_model(); //load_model_2(); run_audio().expect("should work"); run_audio().expect("should work"); } +fn print_version() { + // Python TensorFlow version: 1.14.0 + // Rust TensorFlow version: 1.13.1 + let version = version().expect("version"); + println!("Tensorflow version: {}", version); +} + fn load_model() { let export_dir = "/home/bt/dev/voder/saved_model";