Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diffwave
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maria Guaranda-Cabezas
diffwave
Commits
66e8fdbf
Commit
66e8fdbf
authored
1 year ago
by
Maria Guaranda-Cabezas
Browse files
Options
Downloads
Patches
Plain Diff
saves last checkpoint
parent
46d5fedd
No related branches found
No related tags found
1 merge request
!3
Inference
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/diffwave/learner.py
+3
-1
3 additions, 1 deletion
src/diffwave/learner.py
with
3 additions
and
1 deletion
src/diffwave/learner.py
+
3
−
1
View file @
66e8fdbf
...
...
@@ -103,6 +103,8 @@ class DiffWaveLearner:
while
True
:
for
features
in
tqdm
(
self
.
dataset
,
desc
=
f
'
Epoch
{
self
.
step
//
len
(
self
.
dataset
)
}
'
)
if
self
.
is_master
else
self
.
dataset
:
if
max_steps
is
not
None
and
self
.
step
>=
max_steps
:
# Save final checkpoint.
self
.
save_to_checkpoint
()
return
features
=
_nested_map
(
features
,
lambda
x
:
x
.
to
(
device
)
if
isinstance
(
x
,
torch
.
Tensor
)
else
x
)
loss
=
self
.
train_step
(
features
)
...
...
@@ -145,11 +147,11 @@ class DiffWaveLearner:
def
_write_summary
(
self
,
step
,
features
,
loss
):
writer
=
self
.
summary_writer
or
SummaryWriter
(
self
.
model_dir
,
purge_step
=
step
)
# the following line will print a warning if the audio amplitude is out of range
writer
.
add_audio
(
'
feature/audio
'
,
features
[
'
audio
'
][
0
],
step
,
sample_rate
=
self
.
params
.
sample_rate
)
if
not
self
.
params
.
unconditional
:
writer
.
add_image
(
'
feature/spectrogram
'
,
torch
.
flip
(
features
[
'
spectrogram
'
][:
1
],
[
1
]),
step
)
writer
.
add_scalar
(
'
train/loss
'
,
loss
,
step
)
# the following line will print a warning if the audio amplitude is out of range
writer
.
add_scalar
(
'
train/grad_norm
'
,
self
.
grad_norm
,
step
)
writer
.
flush
()
self
.
summary_writer
=
writer
...
...
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