generated from ashleve/lightning-hydra-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
293f057
commit 8194db6
Showing
20 changed files
with
995 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
weighted_views: | ||
'1': 0.4 | ||
'2': 0.3 | ||
'3': 0.2 | ||
'4': 0.1 | ||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
weighted_views: | ||
'1': 0.1 | ||
'2': 0.2 | ||
'3': 0.3 | ||
'4': 0.4 | ||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
adaptive_weights: true | ||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
weighted_views: | ||
'1': 1 | ||
'2': 1 | ||
'3': 1 | ||
'4': 1 | ||
'5': 1 | ||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
views: [1, 2, 3, 4, 5] | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: asvspoof_multiview | ||
- override /model: xlsr_aasist_multiview | ||
- override /callbacks: default_loss | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["asvspoof_multiview", "xlsr_aasist_multiview"] | ||
|
||
seed: 1234 | ||
|
||
trainer: | ||
max_epochs: 100 | ||
gradient_clip_val: 0.0 | ||
accelerator: cuda | ||
|
||
model: | ||
optimizer: | ||
lr: 0.000001 | ||
weight_decay: 0.0001 | ||
net: null | ||
scheduler: null | ||
compile: true | ||
weighted_views: | ||
'0.5': 1 | ||
'1': 1 | ||
'2': 1 | ||
'3': 1 | ||
'4': 1 | ||
|
||
|
||
data: | ||
batch_size: 14 | ||
num_workers: 8 | ||
pin_memory: true | ||
args: | ||
padding_type: repeat | ||
random_start: False | ||
views: [0.5, 1, 2, 3, 4] | ||
|
||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "asvspoof_multiview" | ||
aim: | ||
experiment: "asvspoof_multiview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from lightning.pytorch.callbacks import BaseFinetuning | ||
|
||
class FeatureExtractorFreezeUnfreeze(BaseFinetuning): | ||
def __init__(self, unfreeze_at_epoch=10, module_names=["feature_extractor"]): | ||
super().__init__() | ||
self._unfreeze_at_epoch = unfreeze_at_epoch | ||
self._module_names = module_names | ||
|
||
def freeze_before_training(self, pl_module): | ||
|
||
# Freeze all modules in module_names | ||
for module_name in self._module_names: | ||
self.freeze(getattr(pl_module, module_name)) | ||
|
||
def finetune_function(self, pl_module, current_epoch, optimizer): | ||
# When `current_epoch` is 10, feature_extractor will start training. | ||
if current_epoch == self._unfreeze_at_epoch: | ||
|
||
# Unfreeze all modules in module_names | ||
for module_name in self._module_names: | ||
self.unfreeze_and_add_param_group( | ||
modules=getattr(pl_module, module_name), | ||
optimizer=optimizer, | ||
train_bn=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.