ref: a02d9c85e5bf8d3daccafa175d23ad237a958d82
parent: 2facc08bb4b5d5d2ec4d9a33318c0f57e35099df
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sun Dec 9 16:21:30 EST 2018
reduce memory use of training code
--- a/dnn/train_lpcnet.py
+++ b/dnn/train_lpcnet.py
@@ -86,7 +86,9 @@
in_data = np.concatenate([data[0:1], data[:-1]]);
noise = np.concatenate([np.zeros((len(data)*1//5)), np.random.randint(-3, 3, len(data)*1//5), np.random.randint(-2, 2, len(data)*1//5), np.random.randint(-1, 1, len(data)*2//5)])
#noise = np.round(np.concatenate([np.zeros((len(data)*1//5)), np.random.laplace(0, 1.2, len(data)*1//5), np.random.laplace(0, .77, len(data)*1//5), np.random.laplace(0, .33, len(data)*1//5), np.random.randint(-1, 1, len(data)*1//5)]))
+del data
in_data = in_data + noise
+del noise
in_data = np.clip(in_data, 0, 255)
features = np.reshape(features, (nb_frames*feature_chunk_size, nb_features))
@@ -105,6 +107,7 @@
for k in range(16):
upred[i*frame_size:(i+1)*frame_size] = upred[i*frame_size:(i+1)*frame_size] - \
pred_in[i*frame_size-k:(i+1)*frame_size-k]*features[i, nb_features-16+k]
+del pred_in
pred = lin2ulaw(upred)
@@ -116,6 +119,8 @@
# ideal excitation in_exc
out_data = lin2ulaw(udata-upred)
+del upred
+del udata
in_exc = np.concatenate([out_data[0:1], out_data[:-1]]);
out_data = np.reshape(out_data, (nb_frames, pcm_chunk_size, 1))
@@ -134,6 +139,8 @@
periods = (50*features[:,:,36:37]+100).astype('int16')
in_data = np.concatenate([in_data, pred], axis=-1)
+
+del pred
# dump models to disk as we go
checkpoint = ModelCheckpoint('lpcnet14_384_10_G16_{epoch:02d}.h5')
--
⑨