Skip to content

Commit

Permalink
Add core-script of xin-wang, test callback
Browse files Browse the repository at this point in the history
  • Loading branch information
hungdinhxuan committed Sep 27, 2024
1 parent 226eaf2 commit 825a16f
Show file tree
Hide file tree
Showing 57 changed files with 14,957 additions and 154 deletions.
22 changes: 22 additions & 0 deletions configs/callbacks/balance_minibatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defaults:
- model_checkpoint
- early_stopping
- model_summary
- rich_progress_bar
- _self_

model_checkpoint:
dirpath: ${paths.output_dir}/checkpoints
filename: "epoch_{epoch:03d}"
monitor: "val/acc"
mode: "max"
save_last: True
auto_insert_metric_name: False

early_stopping:
monitor: "val/acc"
patience: 100
mode: "max"

model_summary:
max_depth: -1
2 changes: 1 addition & 1 deletion configs/experiment/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ model:
compile: false

data:
batch_size: 64
batch_size: 16
num_workers: 4

logger:
Expand Down
46 changes: 46 additions & 0 deletions configs/experiment/test_aasist.yaml
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
- override /model: aasist
- override /callbacks: default
- 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", "aasist"]

seed: 12345

trainer:
min_epochs: 10
max_epochs: 10
gradient_clip_val: 0.5
accelerator: cuda

model:
optimizer:
lr: 0.000001
net:
d_args:
first_conv: 128
filts: [70, [1, 32], [32, 32], [32, 64], [64, 64]]
gat_dims: [64, 32]
pool_ratios: [0.5, 0.7, 0.5, 0.5]
temperatures: [2.0, 2.0, 100.0, 100.0]
compile: false

data:
batch_size: 64
num_workers: 4

logger:
wandb:
tags: ${tags}
group: "asvspoof"
aim:
experiment: "asvspoof"
2 changes: 1 addition & 1 deletion configs/model/aasist.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_target_: src.models.aasist_module.AASISTLitModule
_target_: src.models.asvspoof_aasistssl_reproduce_datamodule.AASISTLitModule

optimizer:
_target_: torch.optim.Adam
Expand Down
2 changes: 1 addition & 1 deletion configs/model/xlsr_aasist.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_target_: src.models.aasistssl_module.AASISTSSLLitModule
_target_: src.models.asvspoof_aasistssl_reproduce_datamodule.AASISTSSLLitModule

optimizer:
_target_: torch.optim.Adam
Expand Down
14 changes: 14 additions & 0 deletions src/callbacks/minibatch_callback.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from lightning.pytorch.callbacks import Callback


class BalanceMiniBatchCallback(Callback):
def on_train_start(self, trainer, pl_module):
print("Training is starting")

def on_train_end(self, trainer, pl_module):
print("Training is ending")
def on_train_batch_start(self, trainer, pl_module, batch, batch_idx) -> None:
print("Epoch is starting")
print(batch)
import sys
sys.exit()
Empty file added src/core_scripts/__init__.py
Empty file.
Empty file.
Loading

0 comments on commit 825a16f

Please sign in to comment.