Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
79980b20
Commit
79980b20
authored
4 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Minor update to training scripts
parent
20fea538
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dnn/training_tf2/train_lpcnet.py
+10
-11
10 additions, 11 deletions
dnn/training_tf2/train_lpcnet.py
with
10 additions
and
11 deletions
dnn/training_tf2/train_lpcnet.py
+
10
−
11
View file @
79980b20
...
...
@@ -37,17 +37,17 @@ import tensorflow.keras.backend as K
import
h5py
import
tensorflow
as
tf
gpus
=
tf
.
config
.
experimental
.
list_physical_devices
(
'
GPU
'
)
if
gpus
:
try
:
tf
.
config
.
experimental
.
set_virtual_device_configuration
(
gpus
[
0
],
[
tf
.
config
.
experimental
.
VirtualDeviceConfiguration
(
memory_limit
=
5120
)])
except
RuntimeError
as
e
:
print
(
e
)
#
gpus = tf.config.experimental.list_physical_devices('GPU')
#
if gpus:
#
try:
#
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=5120)])
#
except RuntimeError as e:
#
print(e)
nb_epochs
=
120
# Try reducing batch_size if you run out of memory on your GPU
batch_size
=
64
batch_size
=
128
model
,
_
,
_
=
lpcnet
.
new_lpcnet_model
(
training
=
True
)
...
...
@@ -102,15 +102,14 @@ del pred
del
in_exc
# dump models to disk as we go
checkpoint
=
ModelCheckpoint
(
'
lpcnet3
2y
_384_
10_G16_
{epoch:02d}.h5
'
)
checkpoint
=
ModelCheckpoint
(
'
lpcnet3
3
_384_{epoch:02d}.h5
'
)
#Set this to True to adapt an existing model (e.g. on new data)
adaptation
=
False
model
.
load_weights
(
'
lpcnet32v_384_10_G16_00.h5
'
)
if
adaptation
:
#Adapting from an existing model
model
.
load_weights
(
'
lpcnet32v_384_
10_G16_
100.h5
'
)
model
.
load_weights
(
'
lpcnet32v_384_100.h5
'
)
sparsify
=
lpcnet
.
Sparsify
(
0
,
0
,
1
,
(
0.05
,
0.05
,
0.2
))
lr
=
0.0001
decay
=
0
...
...
@@ -121,5 +120,5 @@ else:
decay
=
5e-5
model
.
compile
(
optimizer
=
Adam
(
lr
,
decay
=
decay
,
beta_2
=
0.99
),
loss
=
'
sparse_categorical_crossentropy
'
)
model
.
save_weights
(
'
lpcnet3
2y
_384_
10_G16_
00.h5
'
);
model
.
save_weights
(
'
lpcnet3
3
_384_00.h5
'
);
model
.
fit
([
in_data
,
features
,
periods
],
out_exc
,
batch_size
=
batch_size
,
epochs
=
nb_epochs
,
validation_split
=
0.0
,
callbacks
=
[
checkpoint
,
sparsify
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment