MCPcopy Create free account
hub / github.com/PolymathicAI/AstroCLIP / on_validation_batch_start

Method on_validation_batch_start

astroclip/callbacks.py:86–103  ·  view source on GitHub ↗
(
        self,
        trainer: Trainer,
        pl_module: LightningModule,
        batch: Any,
        batch_idx: int,
        dataloader_idx: int = 0,
    )

Source from the content-addressed store, hash-verified

84 return fig
85
86 def on_validation_batch_start(
87 self,
88 trainer: Trainer,
89 pl_module: LightningModule,
90 batch: Any,
91 batch_idx: int,
92 dataloader_idx: int = 0,
93 ) -> None:
94 if batch_idx == 0:
95 output = trainer.model(batch["input"])
96 fig = self.plot_spectrum(batch, output)
97 for logger in trainer.loggers:
98 # Check WandbLogger and Enabled
99 if issubclass(type(logger), WandbLogger) and not issubclass(
100 type(logger.experiment), wandb.sdk.lib.disabled.RunDisabled
101 ):
102 logger: WandbLogger = logger
103 logger.experiment.log({f"plot/{pl_module.current_epoch:03d}": fig})

Callers

nothing calls this directly

Calls 1

plot_spectrumMethod · 0.95

Tested by

no test coverage detected