Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shreyan Chowdhury
moodwalk
Commits
2b7b9351
Commit
2b7b9351
authored
Sep 06, 2019
by
Verena Praher
Browse files
add utility function to save models
parent
e85bb786
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils.py
View file @
2b7b9351
...
...
@@ -240,6 +240,13 @@ def preprocess_specs(source_root, destination_root, frame_length=256, hop=1.0):
np
.
save
(
destination
,
framed_spec
)
def
save
(
model
,
path
):
try
:
torch
.
save
(
model
.
module
.
state_dict
(),
path
)
except
AttributeError
:
torch
.
save
(
model
.
state_dict
(),
path
)
if
__name__
==
'__main__'
:
# TESTS
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment