Upload 2 files
Browse files
svc_cn_hubert_soft_finetune.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
|
2 |
+
|
3 |
+
from fish_diffusion.datasets.audio_folder import AudioFolderDataset
|
4 |
+
|
5 |
+
_base_ = [
|
6 |
+
"./_base_/archs/diff_svc_v2.py",
|
7 |
+
"./_base_/trainers/base.py",
|
8 |
+
"./_base_/schedulers/warmup_cosine_finetune.py",
|
9 |
+
"./_base_/datasets/audio_folder.py",
|
10 |
+
]
|
11 |
+
|
12 |
+
speaker_mapping = {
|
13 |
+
"Placeholder": 0,
|
14 |
+
}
|
15 |
+
|
16 |
+
dataset = dict(
|
17 |
+
train=dict(
|
18 |
+
_delete_=True, # Delete the default train dataset
|
19 |
+
type="ConcatDataset",
|
20 |
+
datasets=[
|
21 |
+
dict(
|
22 |
+
type="AudioFolderDataset",
|
23 |
+
path="dataset/train",
|
24 |
+
speaker_id=speaker_mapping["Placeholder"],
|
25 |
+
),
|
26 |
+
],
|
27 |
+
# Are there any other ways to do this?
|
28 |
+
collate_fn=AudioFolderDataset.collate_fn,
|
29 |
+
),
|
30 |
+
valid=dict(
|
31 |
+
_delete_=True, # Delete the default valid dataset
|
32 |
+
type="ConcatDataset",
|
33 |
+
datasets=[
|
34 |
+
dict(
|
35 |
+
type="AudioFolderDataset",
|
36 |
+
path="dataset/valid",
|
37 |
+
speaker_id=speaker_mapping["Placeholder"],
|
38 |
+
),
|
39 |
+
],
|
40 |
+
collate_fn=AudioFolderDataset.collate_fn,
|
41 |
+
),
|
42 |
+
)
|
43 |
+
|
44 |
+
model = dict(
|
45 |
+
speaker_encoder=dict(
|
46 |
+
input_size=len(speaker_mapping),
|
47 |
+
),
|
48 |
+
text_encoder=dict(
|
49 |
+
type="NaiveProjectionEncoder",
|
50 |
+
input_size=256,
|
51 |
+
output_size=256,
|
52 |
+
),
|
53 |
+
)
|
54 |
+
|
55 |
+
preprocessing = dict(
|
56 |
+
text_features_extractor=dict(
|
57 |
+
type="ChineseHubertSoft",
|
58 |
+
pretrained=True,
|
59 |
+
gate_size=25,
|
60 |
+
),
|
61 |
+
pitch_extractor=dict(
|
62 |
+
type="ParselMouthPitchExtractor",
|
63 |
+
),
|
64 |
+
)
|
65 |
+
|
66 |
+
# The following trainer val and save checkpoints every 1000 steps
|
67 |
+
trainer = dict(
|
68 |
+
val_check_interval=1000,
|
69 |
+
callbacks=[
|
70 |
+
ModelCheckpoint(
|
71 |
+
filename="{epoch}-{step}-{valid_loss:.2f}",
|
72 |
+
every_n_train_steps=5000,
|
73 |
+
save_top_k=-1,
|
74 |
+
),
|
75 |
+
LearningRateMonitor(logging_interval="step"),
|
76 |
+
],
|
77 |
+
)
|
svc_cn_hubert_soft_finetune_crepe.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
|
2 |
+
|
3 |
+
from fish_diffusion.datasets.audio_folder import AudioFolderDataset
|
4 |
+
|
5 |
+
_base_ = [
|
6 |
+
"./_base_/archs/diff_svc_v2.py",
|
7 |
+
"./_base_/trainers/base.py",
|
8 |
+
"./_base_/schedulers/warmup_cosine_finetune.py",
|
9 |
+
"./_base_/datasets/audio_folder.py",
|
10 |
+
]
|
11 |
+
|
12 |
+
speaker_mapping = {
|
13 |
+
"Placeholder": 0,
|
14 |
+
}
|
15 |
+
|
16 |
+
dataset = dict(
|
17 |
+
train=dict(
|
18 |
+
_delete_=True, # Delete the default train dataset
|
19 |
+
type="ConcatDataset",
|
20 |
+
datasets=[
|
21 |
+
dict(
|
22 |
+
type="AudioFolderDataset",
|
23 |
+
path="dataset/train",
|
24 |
+
speaker_id=speaker_mapping["Placeholder"],
|
25 |
+
),
|
26 |
+
],
|
27 |
+
# Are there any other ways to do this?
|
28 |
+
collate_fn=AudioFolderDataset.collate_fn,
|
29 |
+
),
|
30 |
+
valid=dict(
|
31 |
+
_delete_=True, # Delete the default valid dataset
|
32 |
+
type="ConcatDataset",
|
33 |
+
datasets=[
|
34 |
+
dict(
|
35 |
+
type="AudioFolderDataset",
|
36 |
+
path="dataset/valid",
|
37 |
+
speaker_id=speaker_mapping["Placeholder"],
|
38 |
+
),
|
39 |
+
],
|
40 |
+
collate_fn=AudioFolderDataset.collate_fn,
|
41 |
+
),
|
42 |
+
)
|
43 |
+
|
44 |
+
model = dict(
|
45 |
+
speaker_encoder=dict(
|
46 |
+
input_size=len(speaker_mapping),
|
47 |
+
),
|
48 |
+
text_encoder=dict(
|
49 |
+
type="NaiveProjectionEncoder",
|
50 |
+
input_size=256,
|
51 |
+
output_size=256,
|
52 |
+
),
|
53 |
+
)
|
54 |
+
|
55 |
+
preprocessing = dict(
|
56 |
+
text_features_extractor=dict(
|
57 |
+
type="ChineseHubertSoft",
|
58 |
+
pretrained=True,
|
59 |
+
gate_size=25,
|
60 |
+
),
|
61 |
+
pitch_extractor=dict(
|
62 |
+
type="CrepePitchExtractor",
|
63 |
+
),
|
64 |
+
)
|
65 |
+
|
66 |
+
# The following trainer val and save checkpoints every 1000 steps
|
67 |
+
trainer = dict(
|
68 |
+
val_check_interval=1000,
|
69 |
+
callbacks=[
|
70 |
+
ModelCheckpoint(
|
71 |
+
filename="{epoch}-{step}-{valid_loss:.2f}",
|
72 |
+
every_n_train_steps=5000,
|
73 |
+
save_top_k=-1,
|
74 |
+
),
|
75 |
+
LearningRateMonitor(logging_interval="step"),
|
76 |
+
],
|
77 |
+
)
|