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
Merge requests
!3
Inference
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Inference
inference
into
main
Overview
0
Commits
4
Pipelines
0
Changes
1
Merged
Maria Guaranda-Cabezas
requested to merge
inference
into
main
1 year ago
Overview
0
Commits
4
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
66e8fdbf
Prev
Next
Show latest version
1 file
+
3
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
66e8fdbf
saves last checkpoint
· 66e8fdbf
Maria Guaranda-Cabezas
authored
1 year ago
src/diffwave/learner.py
+
4
−
2
Options
@@ -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
)
writer
.
add_audio
(
'
feature/audio
'
,
features
[
'
audio
'
][
0
],
step
,
sample_rate
=
self
.
params
.
sample_rate
)
# 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
Loading