Spaces:
Sleeping
Sleeping
unpairedelectron07
commited on
Commit
•
392c91e
1
Parent(s):
5b1b6a5
Upload 5 files
Browse files
audiocraft/grids/compression/_explorers.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
import treetable as tt
|
8 |
+
|
9 |
+
from .._base_explorers import BaseExplorer
|
10 |
+
|
11 |
+
|
12 |
+
class CompressionExplorer(BaseExplorer):
|
13 |
+
eval_metrics = ["sisnr", "visqol"]
|
14 |
+
|
15 |
+
def stages(self):
|
16 |
+
return ["train", "valid", "evaluate"]
|
17 |
+
|
18 |
+
def get_grid_meta(self):
|
19 |
+
"""Returns the list of Meta information to display for each XP/job.
|
20 |
+
"""
|
21 |
+
return [
|
22 |
+
tt.leaf("index", align=">"),
|
23 |
+
tt.leaf("name", wrap=140),
|
24 |
+
tt.leaf("state"),
|
25 |
+
tt.leaf("sig", align=">"),
|
26 |
+
]
|
27 |
+
|
28 |
+
def get_grid_metrics(self):
|
29 |
+
"""Return the metrics that should be displayed in the tracking table.
|
30 |
+
"""
|
31 |
+
return [
|
32 |
+
tt.group(
|
33 |
+
"train",
|
34 |
+
[
|
35 |
+
tt.leaf("epoch"),
|
36 |
+
tt.leaf("bandwidth", ".2f"),
|
37 |
+
tt.leaf("adv", ".4f"),
|
38 |
+
tt.leaf("d_loss", ".4f"),
|
39 |
+
],
|
40 |
+
align=">",
|
41 |
+
),
|
42 |
+
tt.group(
|
43 |
+
"valid",
|
44 |
+
[
|
45 |
+
tt.leaf("bandwidth", ".2f"),
|
46 |
+
tt.leaf("adv", ".4f"),
|
47 |
+
tt.leaf("msspec", ".4f"),
|
48 |
+
tt.leaf("sisnr", ".2f"),
|
49 |
+
],
|
50 |
+
align=">",
|
51 |
+
),
|
52 |
+
tt.group(
|
53 |
+
"evaluate", [tt.leaf(name, ".3f") for name in self.eval_metrics], align=">"
|
54 |
+
),
|
55 |
+
]
|
audiocraft/grids/compression/debug.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
"""
|
8 |
+
Grid search file, simply list all the exp you want in `explorer`.
|
9 |
+
Any new exp added there will be scheduled.
|
10 |
+
You can cancel and experiment by commenting its line.
|
11 |
+
|
12 |
+
This grid is a minimal example for debugging compression task
|
13 |
+
and how to override parameters directly in a grid.
|
14 |
+
Learn more about dora grids: https://github.com/facebookresearch/dora
|
15 |
+
"""
|
16 |
+
|
17 |
+
from ._explorers import CompressionExplorer
|
18 |
+
from ...environment import AudioCraftEnvironment
|
19 |
+
|
20 |
+
|
21 |
+
@CompressionExplorer
|
22 |
+
def explorer(launcher):
|
23 |
+
partitions = AudioCraftEnvironment.get_slurm_partitions(['team', 'global'])
|
24 |
+
launcher.slurm_(gpus=2, partition=partitions)
|
25 |
+
launcher.bind_(solver='compression/debug')
|
26 |
+
|
27 |
+
with launcher.job_array():
|
28 |
+
# base debug task using config from solver=compression/debug
|
29 |
+
launcher()
|
30 |
+
# we can override parameters in the grid to launch additional xps
|
31 |
+
launcher({'rvq.bins': 2048, 'rvq.n_q': 4})
|
audiocraft/grids/compression/encodec_audiogen_16khz.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
"""
|
8 |
+
Grid search file, simply list all the exp you want in `explorer`.
|
9 |
+
Any new exp added there will be scheduled.
|
10 |
+
You can cancel and experiment by commenting its line.
|
11 |
+
|
12 |
+
This grid shows how to train the new AudioGen EnCodec model at 16 kHz.
|
13 |
+
"""
|
14 |
+
|
15 |
+
from ._explorers import CompressionExplorer
|
16 |
+
from ...environment import AudioCraftEnvironment
|
17 |
+
|
18 |
+
|
19 |
+
@CompressionExplorer
|
20 |
+
def explorer(launcher):
|
21 |
+
partitions = AudioCraftEnvironment.get_slurm_partitions(['team', 'global'])
|
22 |
+
launcher.slurm_(gpus=8, partition=partitions)
|
23 |
+
# use configuration for AudioGen's EnCodec model trained on monophonic audio sampled at 16 kHz
|
24 |
+
# AudioGen's EnCodec is trained with a total stride of 320 leading to a frame rate of 50 hz
|
25 |
+
launcher.bind_(solver='compression/encodec_audiogen_16khz')
|
26 |
+
# replace this by the desired sound dataset
|
27 |
+
launcher.bind_(dset='internal/sounds_16khz')
|
28 |
+
# launch xp
|
29 |
+
launcher()
|
audiocraft/grids/compression/encodec_base_24khz.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
"""
|
8 |
+
Grid search file, simply list all the exp you want in `explorer`.
|
9 |
+
Any new exp added there will be scheduled.
|
10 |
+
You can cancel and experiment by commenting its line.
|
11 |
+
|
12 |
+
This grid shows how to train a base causal EnCodec model at 24 kHz.
|
13 |
+
"""
|
14 |
+
|
15 |
+
from ._explorers import CompressionExplorer
|
16 |
+
from ...environment import AudioCraftEnvironment
|
17 |
+
|
18 |
+
|
19 |
+
@CompressionExplorer
|
20 |
+
def explorer(launcher):
|
21 |
+
partitions = AudioCraftEnvironment.get_slurm_partitions(['team', 'global'])
|
22 |
+
launcher.slurm_(gpus=8, partition=partitions)
|
23 |
+
# base causal EnCodec trained on monophonic audio sampled at 24 kHz
|
24 |
+
launcher.bind_(solver='compression/encodec_base_24khz')
|
25 |
+
# replace this by the desired dataset
|
26 |
+
launcher.bind_(dset='audio/example')
|
27 |
+
# launch xp
|
28 |
+
launcher()
|
audiocraft/grids/compression/encodec_musicgen_32khz.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
"""
|
8 |
+
Grid search file, simply list all the exp you want in `explorer`.
|
9 |
+
Any new exp added there will be scheduled.
|
10 |
+
You can cancel and experiment by commenting its line.
|
11 |
+
|
12 |
+
This grid shows how to train a MusicGen EnCodec model at 32 kHz.
|
13 |
+
"""
|
14 |
+
|
15 |
+
from ._explorers import CompressionExplorer
|
16 |
+
from ...environment import AudioCraftEnvironment
|
17 |
+
|
18 |
+
|
19 |
+
@CompressionExplorer
|
20 |
+
def explorer(launcher):
|
21 |
+
partitions = AudioCraftEnvironment.get_slurm_partitions(['team', 'global'])
|
22 |
+
launcher.slurm_(gpus=8, partition=partitions)
|
23 |
+
# use configuration for MusicGen's EnCodec model trained on monophonic audio sampled at 32 kHz
|
24 |
+
# MusicGen's EnCodec is trained with a total stride of 640 leading to a frame rate of 50 hz
|
25 |
+
launcher.bind_(solver='compression/encodec_musicgen_32khz')
|
26 |
+
# replace this by the desired music dataset
|
27 |
+
launcher.bind_(dset='internal/music_400k_32khz')
|
28 |
+
# launch xp
|
29 |
+
launcher()
|
30 |
+
launcher({
|
31 |
+
'metrics.visqol.bin': '/data/home/jadecopet/local/usr/opt/visqol',
|
32 |
+
'label': 'visqol',
|
33 |
+
'evaluate.metrics.visqol': True
|
34 |
+
})
|