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
219fbff4
Commit
219fbff4
authored
6 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Making it easier to adapt (or not) a model
parent
edee9cd8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dnn/train_lpcnet.py
+17
-3
17 additions, 3 deletions
dnn/train_lpcnet.py
with
17 additions
and
3 deletions
dnn/train_lpcnet.py
+
17
−
3
View file @
219fbff4
...
...
@@ -105,6 +105,20 @@ del in_exc
# dump models to disk as we go
checkpoint
=
ModelCheckpoint
(
'
lpcnet24g_384_10_G16_{epoch:02d}.h5
'
)
model
.
load_weights
(
'
lpcnet24c_384_10_G16_120.h5
'
)
model
.
compile
(
optimizer
=
Adam
(
0.0001
,
amsgrad
=
True
),
loss
=
'
sparse_categorical_crossentropy
'
)
model
.
fit
([
in_data
,
features
,
periods
],
out_exc
,
batch_size
=
batch_size
,
epochs
=
nb_epochs
,
validation_split
=
0.0
,
callbacks
=
[
checkpoint
,
lpcnet
.
Sparsify
(
0
,
0
,
1
,
(
0.05
,
0.05
,
0.2
))])
#Set this to True to adapt an existing model (e.g. on new data)
adaptation
=
False
if
adaptation
:
#Adapting from an existing model
model
.
load_weights
(
'
lpcnet24c_384_10_G16_120.h5
'
)
sparsify
=
lpcnet
.
Sparsify
(
0
,
0
,
1
,
(
0.05
,
0.05
,
0.2
))
lr
=
0.0001
decay
=
0
else
:
#Training from scratch
sparsify
=
lpcnet
.
Sparsify
(
2000
,
40000
,
400
,
(
0.05
,
0.05
,
0.2
))
lr
=
0.001
decay
=
5e-5
model
.
compile
(
optimizer
=
Adam
(
lr
,
amsgrad
=
True
,
decay
=
decay
),
loss
=
'
sparse_categorical_crossentropy
'
)
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