Troubleshooting
CUDA out of memory (OOM)
Symptoms: torch.cuda.OutOfMemoryError during training or data generation.
Fixes (try in order):
Reduce
batch_sizeinRunCFG(halving it roughly halves peak VRAM usage).Disable
torch.backends.cudnn.benchmark = True— it allocates extra workspace.Set
autocast = TrueinRunCFGto use float16 during the forward pass, which cuts activation memory roughly in half.Reduce
prefetchinMemmapNoiseSampler(each prefetch slot holds a full batch on the GPU).If using ResNet-101 or ResNet-152, switch to ResNet-50 (
backend_resnet_size=50).
torch.compile / Dynamo errors
Symptoms: Errors containing torch._dynamo, graph break, or
TorchDynamoException at the start of training.
Fixes:
Set
torch._dynamo.config.verbose = Truetemporarily to identify the break point.Ensure the model is moved to device before calling
torch.compile.Use
dynamic=Truein the compile call if batch size varies between training and validation.As a last resort, remove
torch.compilefor debugging — the uncompiled model is functionally identical.
lalsuite or pycbc import errors
Symptoms: ModuleNotFoundError: No module named 'lal' or similar at import.
Fix: LALSuite and PyCBC are optional dependencies not installed by default. Install them via conda (strongly recommended over pip):
conda install -c conda-forge lalsuite pycbc
Or via pip (may fail on some systems):
pip install sage-gw[lal]
These are only required for waveform validation against LALSuite and for PyCBC benchmarking. Core training does not need them.
Data download timeouts or failures
Symptoms: TimeoutError, ConnectionError, or partial downloads from GWOSC.
Fixes:
Increase
max_download_retriesandretry_delayinDataReleaseDownloader.Run from a cluster node with a stable network connection — GWOSC data is large (O3b is ~several TB).
Check GWOSC status at gwosc.org for service outages.
If a segment fails repeatedly, use
auto_clean_empty_timelines=TrueinTimelineQueryto skip it.
NaN losses during training
Symptoms: Loss becomes nan after a few batches.
Fixes (try in order):
Lower the learning rate (e.g.
lr=1e-4instead of2e-4).Verify gradient clipping is active —
cfg.clip_normshould be1.0.Check that
autocastandGradScalerare both enabled or both disabled — mixing states can cause scale underflow.Temporarily set
torch.autograd.set_detect_anomaly(True)to find which operation produces the NaN.Inspect the noise data: a corrupt
.binfile can produce all-zero or all-inf frames. Re-run the download step for affected segments.
Low GPU utilisation during training
Symptoms: nvidia-smi shows GPU at < 50% utilisation.
Fixes:
Increase
prefetchinMemmapNoiseSampler(default 8 is usually sufficient, but disk-bound machines may need more).Ensure
num_workersis set inDataReleaseDownloaderfor parallel downloads.Compile the model with
torch.compile(mode="max-autotune")— the first epoch will be slow during kernel tuning, but steady-state throughput improves significantly afterwards.Move the
.bindata files to a fast local SSD rather than a network filesystem.
Checkpoint fails to load
Symptoms: KeyError or RuntimeError when restoring from a checkpoint.
Common causes and fixes:
Model architecture mismatch — the checkpoint was saved with a different
backend_resnet_sizeornorm_type. Rebuild the model with the same parameters before loading.Compiled vs. uncompiled state dict —
torch.compilewraps the model in a_orig_modprefix. Load withstrict=Falseor unwrap withmodel._orig_modif mixing compiled and uncompiled saves.Scaler state missing — checkpoints saved before the scaler fix (see changelog v0.1.0) will not have a
scalerkey. Passstrict=Falseor setscaler=Noneand reinitialise.