Spaces:
Runtime error
Runtime error
waidhoferj
commited on
Commit
β’
ad4c4e2
1
Parent(s):
11664cf
multilabel training
Browse files- models/config/train_local.yaml +4 -4
- models/residual.py +8 -3
- models/{config/production.yaml β weights/ResidualDancer/multiclass/config.yaml} +1 -1
- models/weights/ResidualDancer/{weights.ckpt β multiclass/weights.ckpt} +0 -0
- models/weights/ResidualDancer/multilabel/config.yaml +20 -0
- models/weights/ResidualDancer/multilabel/weights.ckpt +3 -0
models/config/train_local.yaml
CHANGED
@@ -18,10 +18,10 @@ dance_ids: &dance_ids
|
|
18 |
- WCS
|
19 |
|
20 |
data_module:
|
21 |
-
batch_size:
|
22 |
-
num_workers:
|
23 |
# data_subset: 0.001
|
24 |
-
test_proportion: 0.
|
25 |
|
26 |
datasets:
|
27 |
preprocessing.dataset.BestBallroomDataset:
|
@@ -33,7 +33,7 @@ datasets:
|
|
33 |
song_data_path: data/songs_cleaned.csv
|
34 |
song_audio_path: data/samples # data/samples
|
35 |
class_list: *dance_ids
|
36 |
-
multi_label:
|
37 |
min_votes: 1
|
38 |
audio_window_jitter: 0.7
|
39 |
|
|
|
18 |
- WCS
|
19 |
|
20 |
data_module:
|
21 |
+
batch_size: 128
|
22 |
+
num_workers: 10
|
23 |
# data_subset: 0.001
|
24 |
+
test_proportion: 0.001
|
25 |
|
26 |
datasets:
|
27 |
preprocessing.dataset.BestBallroomDataset:
|
|
|
33 |
song_data_path: data/songs_cleaned.csv
|
34 |
song_audio_path: data/samples # data/samples
|
35 |
class_list: *dance_ids
|
36 |
+
multi_label: True
|
37 |
min_votes: 1
|
38 |
audio_window_jitter: 0.7
|
39 |
|
models/residual.py
CHANGED
@@ -9,6 +9,7 @@ import numpy as np
|
|
9 |
import torchaudio
|
10 |
import yaml
|
11 |
from models.training_environment import TrainingEnvironment
|
|
|
12 |
from preprocessing.dataset import DanceDataModule, get_datasets
|
13 |
from preprocessing.pipelines import (
|
14 |
SpectrogramTrainingPipeline,
|
@@ -118,7 +119,9 @@ def train_residual_dancer(config: dict):
|
|
118 |
data = DanceDataModule(dataset, **config["data_module"])
|
119 |
model = ResidualDancer(n_classes=len(TARGET_CLASSES), **config["model"])
|
120 |
label_weights = data.get_label_weights().to(DEVICE)
|
121 |
-
criterion =
|
|
|
|
|
122 |
|
123 |
train_env = TrainingEnvironment(model, criterion, config)
|
124 |
callbacks = [
|
@@ -126,8 +129,10 @@ def train_residual_dancer(config: dict):
|
|
126 |
cb.EarlyStopping("val/loss", patience=1),
|
127 |
cb.StochasticWeightAveraging(1e-2),
|
128 |
cb.RichProgressBar(),
|
129 |
-
cb.DeviceStatsMonitor(),
|
130 |
]
|
131 |
trainer = pl.Trainer(callbacks=callbacks, **config["trainer"])
|
132 |
trainer.fit(train_env, datamodule=data)
|
133 |
-
trainer.test(
|
|
|
|
|
|
|
|
9 |
import torchaudio
|
10 |
import yaml
|
11 |
from models.training_environment import TrainingEnvironment
|
12 |
+
from models.utils import LabelWeightedBCELoss
|
13 |
from preprocessing.dataset import DanceDataModule, get_datasets
|
14 |
from preprocessing.pipelines import (
|
15 |
SpectrogramTrainingPipeline,
|
|
|
119 |
data = DanceDataModule(dataset, **config["data_module"])
|
120 |
model = ResidualDancer(n_classes=len(TARGET_CLASSES), **config["model"])
|
121 |
label_weights = data.get_label_weights().to(DEVICE)
|
122 |
+
criterion = LabelWeightedBCELoss(
|
123 |
+
label_weights
|
124 |
+
) # nn.CrossEntropyLoss(label_weights)
|
125 |
|
126 |
train_env = TrainingEnvironment(model, criterion, config)
|
127 |
callbacks = [
|
|
|
129 |
cb.EarlyStopping("val/loss", patience=1),
|
130 |
cb.StochasticWeightAveraging(1e-2),
|
131 |
cb.RichProgressBar(),
|
|
|
132 |
]
|
133 |
trainer = pl.Trainer(callbacks=callbacks, **config["trainer"])
|
134 |
trainer.fit(train_env, datamodule=data)
|
135 |
+
trainer.test(
|
136 |
+
train_env,
|
137 |
+
datamodule=data,
|
138 |
+
)
|
models/{config/production.yaml β weights/ResidualDancer/multiclass/config.yaml}
RENAMED
@@ -1,4 +1,4 @@
|
|
1 |
-
checkpoint: models/weights/ResidualDancer/weights.ckpt
|
2 |
device: cpu
|
3 |
seed: 42
|
4 |
dance_ids: &dance_ids
|
|
|
1 |
+
checkpoint: models/weights/ResidualDancer/multiclass/weights.ckpt
|
2 |
device: cpu
|
3 |
seed: 42
|
4 |
dance_ids: &dance_ids
|
models/weights/ResidualDancer/{weights.ckpt β multiclass/weights.ckpt}
RENAMED
File without changes
|
models/weights/ResidualDancer/multilabel/config.yaml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
checkpoint: models/weights/ResidualDancer/multilabel/weights.ckpt
|
2 |
+
device: cpu
|
3 |
+
seed: 42
|
4 |
+
dance_ids: &dance_ids
|
5 |
+
- BCH
|
6 |
+
- CHA
|
7 |
+
- JIV
|
8 |
+
- ECS
|
9 |
+
- QST
|
10 |
+
- RMB
|
11 |
+
- SFT
|
12 |
+
- SLS
|
13 |
+
- SMB
|
14 |
+
- SWZ
|
15 |
+
- TGO
|
16 |
+
- VWZ
|
17 |
+
- WCS
|
18 |
+
|
19 |
+
model:
|
20 |
+
n_channels: 128
|
models/weights/ResidualDancer/multilabel/weights.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a3b87ae0e61bc10d720b7e5f35329db3ccb03b5cb47d120821a9ef314f8315c
|
3 |
+
size 193642705
|