52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
"""Experiment tracking + diagnostics.
|
|
|
|
Independent axis: changing these flags does not affect training results,
|
|
only what is observed/recorded.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import gin
|
|
|
|
|
|
@gin.configurable
|
|
class TrackingConfig:
|
|
"""Wandb / TensorBoard / Grad-CAM / profiler / gradient norms."""
|
|
|
|
def __init__(
|
|
self,
|
|
use_wandb: bool = False,
|
|
use_tb: bool = True,
|
|
wandb_project: str = "caption-test-gtauav",
|
|
wandb_run_name: str | None = None,
|
|
wandb_entity: str | None = None,
|
|
log_grad_norms: bool = True,
|
|
use_gradcam: bool = False,
|
|
gradcam_every: int = 5,
|
|
gradcam_samples: int = 8,
|
|
use_profiler: bool = False,
|
|
profiler_warmup: int = 3,
|
|
profiler_active: int = 5,
|
|
) -> None:
|
|
self.use_wandb = use_wandb
|
|
self.use_tb = use_tb
|
|
self.wandb_project = wandb_project
|
|
self.wandb_run_name = wandb_run_name
|
|
self.wandb_entity = wandb_entity
|
|
self.log_grad_norms = log_grad_norms
|
|
self.use_gradcam = use_gradcam
|
|
self.gradcam_every = gradcam_every
|
|
self.gradcam_samples = gradcam_samples
|
|
self.use_profiler = use_profiler
|
|
self.profiler_warmup = profiler_warmup
|
|
self.profiler_active = profiler_active
|
|
|
|
|
|
def get_tracking_cfg(path2cfg: str) -> TrackingConfig:
|
|
"""Load ONLY tracking config (TESTING ONLY — production uses load_all_configs)."""
|
|
gin.clear_config()
|
|
gin.parse_config_file(f"{path2cfg}tracking.gin")
|
|
return TrackingConfig()
|
|
|
|
|