Skip to content

Commit 4db5e52

Browse files
committed
Update consistency training smoke test for new masker signature
1 parent 7ef9309 commit 4db5e52

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/test_consistency_training.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ def _run():
3333
sys.modules.pop(m, None)
3434
import config
3535
import train_consistency as tc
36+
config.O3bCFG.p_non_astrophysical = 0.3 # exercise the 4-class path
3637
config.set_configs()
3738

38-
from sage.core.config import get_cfg
39+
from sage.core.config import get_cfg, get_data_cfg
3940
from sage.architecture.network import MSCNN1D_2DResNetCBAM_Consistency, ConsistencyOutput
4041
from sage.architecture.custom_losses import BCEWithPEsigmaLoss, ConsistencyNLLLoss
4142
from sage.factory import SageConsistencyTraining
4243
from sage.data.non_astrophysical import NonAstrophysicalMasker
4344
import torch.optim as optim
4445
from torch.optim.lr_scheduler import CosineAnnealingWarmRestarts
4546

46-
cfg = get_cfg()
47+
cfg, data_cfg = get_cfg(), get_data_cfg()
4748
signal_sampler, noise_sampler, bounds = tc.make_training_graph()
4849
processor, t_grid = tc.make_processor(bounds)
4950

@@ -57,7 +58,12 @@ def _run():
5758
sched = CosineAnnealingWarmRestarts(opt, T_0=5, T_mult=2, eta_min=1e-6)
5859
scaler = torch.amp.GradScaler(cfg.device, enabled=cfg.autocast)
5960

60-
masker = NonAstrophysicalMasker(p_non_astro=0.3, seed=1) # exercise the 4-class path
61+
masker = NonAstrophysicalMasker(
62+
freqs=signal_sampler.f[0],
63+
tc_bounds=bounds["tc"],
64+
analysis_length_s=data_cfg.sample_length_in_s,
65+
seed=1,
66+
)
6167
train_sage = SageConsistencyTraining(
6268
signal_sampler, noise_sampler, processor, model, merged, cons,
6369
opt, sched, scaler, num_iterations=N_ITERS, num_epochs=1,

0 commit comments

Comments
 (0)