mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 10:11:31 +00:00
add random sampling
This commit is contained in:
1 parent
f07a628469
commit
3de3a3770c
4 files changed
+12
-1
No files matched your search
Generated
+1
@@ -1153,6 +1153,7 @@ 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)",
|
||||
"tch 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
||||
@@ -10,4 +10,5 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
hound = "3.4.0" # wav codec
|
||||
rand = "0.7.2" # random sampling for testing (TODO: temp)
|
||||
tch = "0.1.3" # libtorch bindings (pytorch)
|
||||
@@ -1,5 +1,6 @@
|
||||
extern crate tch;
|
||||
extern crate hound;
|
||||
extern crate rand;
|
||||
extern crate tch;
|
||||
|
||||
use tch::vision::imagenet;
|
||||
use tch::vision::resnet;
|
||||
|
||||
@@ -3,6 +3,8 @@ use tch::CModule;
|
||||
use tch;
|
||||
use tch::nn::Module;
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
//const TACOTRON_MODEL_PATH : &'static str = "/home/bt/models/tacotron2-nvidia/tacotron2_statedict.pt";
|
||||
//const MELGAN_MODEL_PATH : &'static str = "/home/bt/models/melgan-swpark/firstgo_a7c2351_1100.pt";
|
||||
const WRAPPED_MODEL_PATH : &'static str = "/home/bt/dev/voder/tacotron_melgan/container.pt";
|
||||
@@ -118,6 +120,12 @@ pub fn run_melgan() {
|
||||
println!("Data: {:?}", data.get(5000));
|
||||
println!("Data: {:?}", data.get(10000));
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
for _ in 0..30 {
|
||||
let ri = rng.gen_range(0, length);
|
||||
println!("data[{}]: {:?}", ri, data.get(ri as usize));
|
||||
}
|
||||
|
||||
let spec = hound::WavSpec {
|
||||
channels: 1,
|
||||
sample_rate: 16000,
|
||||
|
||||
Reference in new issue
Block a user