Download callbacks/data.py from procgne/Plonk: direct link, hf CLI and curl.
- Browser
- Download file 379 Bytes
-
https://huggingface.co/spaces/procgne/Plonk/resolve/main/callbacks/data.py
- Command line
-
hf download hf://spaces/procgne/Plonk/callbacks/data.py
-
curl -L -o data.py https://huggingface.co/spaces/procgne/Plonk/resolve/main/callbacks/data.py
379 Bytes
| from pytorch_lightning.callbacks import Callback | |
| class IncreaseDataEpoch(Callback): | |
| def __init__(self): | |
| super().__init__() | |
| def on_train_epoch_start(self, trainer, pl_module): | |
| epoch = pl_module.current_epoch | |
| if hasattr(trainer.datamodule.train_dataset, "shared_epoch"): | |
| trainer.datamodule.train_dataset.shared_epoch.set_value(epoch) | |