📙 How-to Guide · task-oriented
Troubleshooting Guide¶
Common issues and solutions when working with DynVision.
Training Issues¶
Training Runs on CPU Instead of GPU¶
Symptoms:
GPU available: True (cuda), used: False
TPU available: False, using: 0 TPU cores
All parameters on device: cpu
Causes:
acceleratorset to"auto"in single-device mode without explicit GPU configuration- CUDA not properly installed
- PyTorch built without CUDA support
Solutions:
-
Explicit GPU configuration (recommended):
-
Command-line override:
-
Verify CUDA installation:
-
Check PyTorch CUDA support:
Loss is NaN or Infinite¶
Symptoms:
- Training loss suddenly becomes
nan - Loss values explode (> 1e10)
- Gradients are
nanorinf
Causes:
- Learning rate too high
- Numerical instability in loss computation
- Division by zero in custom operations
- Gradient explosion in recurrent connections
Solutions:
-
Reduce learning rate:
-
Add gradient clipping:
-
Use warmup scheduler:
-
Check for NaN in data:
-
Enable anomaly detection (for debugging):
Out of Memory (OOM) Errors¶
Symptoms:
Solutions:
-
Reduce batch size:
-
Enable gradient accumulation:
-
Reduce number of timesteps:
-
Disable response storage during training:
-
Use mixed precision training:
-
Clear CUDA cache periodically:
Training is Very Slow¶
Symptoms:
- Epochs take much longer than expected
- GPU utilization is low (< 50%)
- CPU bottleneck
Solutions:
- Use FFCV for data loading:
First convert dataset to FFCV format:
-
Increase num_workers:
-
Enable pin_memory:
-
Use channels_last memory format:
-
Disable progress bar on cluster:
-
Check validation frequency:
Model Issues¶
Model Parameters Not Loading¶
Symptoms:
RuntimeError: Error(s) in loading state_dict for DyRCNNx4:
Missing key(s) in state_dict: "V1_conv.weight", ...
Causes:
- Model architecture changed since checkpoint was saved
- Loading checkpoint from different model variant
- Mismatch in parameter names
Solutions:
-
Check model variant matches:
-
Use strict=False for partial loading:
-
Inspect checkpoint:
Recurrent Connections Not Working¶
Symptoms:
- Model behaves like feedforward CNN
- No temporal dynamics observed
- Responses identical across timesteps
Causes:
n_timesteps = 1(no temporal processing)- Recurrent weights initialized to zero
- Time constant too large (tau >> dt * n_timesteps)
Solutions:
-
Ensure adequate timesteps:
-
Check temporal parameters:
-
Verify recurrence type:
-
Check delays:
Data Issues¶
Dataset Not Found¶
Symptoms:
Solutions:
-
Download dataset first:
-
Create dataset links:
-
Verify dataset path:
FFCV Conversion Fails¶
Symptoms:
ImportError: cannot import name 'ffcv' from 'ffcv'
AttributeError: module 'ffcv' has no attribute 'Writer'
Causes:
- FFCV not installed
- Incompatible FFCV version
- Missing dataset
Solutions:
-
Install FFCV:
-
Check FFCV version:
-
Verify dataset exists before conversion:
Double Temporal Expansion¶
Symptoms:
- Output shape is
(batch, n_timesteps, n_timesteps, channels, H, W) - Memory usage much higher than expected
- Unexpected tensor dimensions
Cause:
Both data_timesteps and model n_timesteps are > 1, causing double expansion.
Solution: Choose one expansion method:
# Option 1: DataLoader expansion (for testing)
data_timesteps: 20
n_timesteps: 1 # In model config
# Option 2: Model expansion (for training with patterns)
data_timesteps: 1
n_timesteps: 20 # In model config
Configuration Issues¶
Configuration Not Taking Effect¶
Symptoms:
- Changed config values but model still uses old values
- Parameters don't match what's in YAML
Causes:
- Config file load order (later files override earlier)
- Command-line args override config files
- Model defaults override
Nonevalues - Config frozen at workflow start (cluster execution only)
Solutions:
-
Check config load order:
-
Use explicit values:
-
Check the frozen workflow config snapshot:
-
Understanding config freezing (cluster execution):
When using snakecharm.sh for cluster execution, the configuration is frozen at workflow start for reproducibility. This means:
- ✅ Config changes do not affect running workflows (this is intentional!)
- ✅ All jobs in a workflow run see identical configuration
- ✅ To use updated configs, start a new workflow run
- ✅ The frozen snapshot is saved in
logs/configs/workflow_config_<timestamp>.yaml
Example scenario:
# Start workflow
./dynvision/cluster/snakecharm.sh train_model
# While workflow running, you edit config_defaults.yaml
vim dynvision/configs/config_defaults.yaml # Change learning_rate: 0.001 → 0.0001
# Jobs submitted AFTER the edit still use learning_rate: 0.001
# The workflow uses the frozen config from workflow start
To apply config changes:
# Option 1: Stop current workflow and start new one with updated config
# (Ctrl+C to stop, then restart)
# Option 2: Use CLI override instead (works immediately)
./dynvision/cluster/snakecharm.sh train_model --config learning_rate=0.0001
Why freezing is necessary: Without freezing, changing config files mid-workflow would cause:
- Jobs submitted early vs. late to have different parameters
- Inconsistent results within a single experiment
- Irreproducible workflows
See Parameter Processing Guide for technical details.
Model Naming Conflicts¶
Symptoms:
Cause: Model name doesn't uniquely identify the configuration.
Solution:
Include all varying parameters in model_args:
This creates unique filename:
PyTorch Lightning Issues¶
Validation Metrics Not Found¶
Symptoms:
Cause:
Validation doesn't run on first epoch when check_val_every_n_epoch > 1.
Solution:
Automatically handled - trainer switches to train_loss monitoring until validation runs. You can also:
check_val_every_n_epoch: 1 # Validate every epoch
# or
monitor: "train_loss" # Monitor training loss instead
Hook Signature Mismatches¶
Symptoms:
Cause: PyTorch Lightning updated hook signatures.
Solution: This should be fixed in the current version. If you still see this:
- Update DynVision to latest version
- Check PyTorch Lightning version compatibility:
Snakemake Issues¶
Rule Not Found¶
Symptoms:
Causes:
- Missing wildcards in target specification
- Incorrect path format
- Rule doesn't exist
Solutions:
-
Use complete path with wildcards:
-
Use rule names for expansion:
-
Check available rules:
Cluster Job Failures¶
Symptoms:
- Jobs fail silently on cluster
- No output in log files
- SLURM job status shows FAILED
Solutions:
-
Check cluster logs:
-
Verify resource requests:
-
Test locally first:
-
Check environment:
Cluster Not Detected (ModuleNotFoundError)¶
Symptoms:
Cause: Cluster execution not detected, so Python runs without singularity/conda wrapper.
Diagnosis:
Check workflow logs for detection message:
# Should see this on cluster:
[INFO] Cluster execution detected via: SLURM_JOB_ID
# If you see this instead:
[DEBUG] Local execution detected (no cluster scheduler variables)
# Then detection failed
Solutions:
- Verify scheduler environment variables:
If these are not set, you're not running in a scheduler job context.
-
Check executor wrapper configuration:
-
Supported schedulers: DynVision detects:
-
SLURM (via
SLURM_JOB_IDorSLURM_JOBID) - PBS/Torque (via
PBS_JOBID) - LSF (via
LSB_JOBID) - SGE/UGE (via
SGE_TASK_ID)
If using a different scheduler, add its environment variable to is_cluster_execution() in dynvision/workflow/snake_utils.smk.
- Running outside scheduler:
If running Snakemake directly (not via
snakecharm.sh), ensure you're submitting via scheduler:
See: Cluster Integration Guide for proper setup.
Performance Debugging¶
Identify Bottlenecks¶
Tools:
-
PyTorch profiler:
-
Time individual operations:
-
Monitor GPU usage:
-
Profile data loading:
Getting Help¶
If you can't find a solution here:
-
Check logs:
- Training logs:
logs/training/ - Cluster logs:
logs/slurm/ - Runtime config:
logs/config_runtime.yaml
- Training logs:
-
Enable debug mode:
-
Search GitHub Issues: Check if others have encountered the same problem
-
Create detailed bug report with:
- Complete error message and stack trace
- Configuration files used
- DynVision version
- PyTorch and CUDA versions
- Steps to reproduce
-
Contact: robin.gutzen@nyu.edu
Related Documentation¶
- Installation Guide - Setup and dependencies
- Configuration Reference - Config system details
- Optimizers and Schedulers - Training optimization
- Temporal Data Presentation - Temporal expansion details