shithub: opus

Download patch

ref: fd1fc693aa0fc7c4f0d7e0d8868541a4bc16ee4a
parent: 2a7a9fa08535a6493f5b743776610c2b46ea7523
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Mon Apr 1 11:22:00 EDT 2019

adaptation flag to avoid training the sample rate network

--- a/dnn/lpcnet.py
+++ b/dnn/lpcnet.py
@@ -113,7 +113,7 @@
             'seed': self.seed
         }
 
-def new_lpcnet_model(rnn_units1=384, rnn_units2=16, nb_used_features = 38, training=False, use_gpu=True):
+def new_lpcnet_model(rnn_units1=384, rnn_units2=16, nb_used_features = 38, training=False, use_gpu=True, adaptation=False):
     pcm = Input(shape=(None, 3))
     feat = Input(shape=(None, nb_used_features))
     pitch = Input(shape=(None, 1))
@@ -153,10 +153,11 @@
     gru_out2, _ = rnn2(Concatenate()([gru_out1, rep(cfeat)]))
     ulaw_prob = md(gru_out2)
     
-    rnn.trainable=False
-    rnn2.trainable=False
-    md.trainable=False
-    embed.Trainable=False
+    if adaptation:
+        rnn.trainable=False
+        rnn2.trainable=False
+        md.trainable=False
+        embed.Trainable=False
     
     model = Model([pcm, feat, pitch], ulaw_prob)
     model.rnn_units1 = rnn_units1
--