-
Notifications
You must be signed in to change notification settings - Fork 0
/
train_ganime.py
33 lines (26 loc) · 917 Bytes
/
train_ganime.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pytorch_lightning.cli import LightningCLI
from torchganime.models.ganime import GANime
from torchganime.data.dataloader.video import VideoData
from pytorch_lightning.callbacks import ModelCheckpoint, LearningRateMonitor
from pytorch_lightning.strategies import DeepSpeedStrategy
import torch
def cli_main():
checkpoint_callback = ModelCheckpoint(
save_top_k=1, monitor="val/loss", save_last=True
)
lr_monitor = LearningRateMonitor(logging_interval="step")
torch.set_float32_matmul_precision("medium")
cli = LightningCLI(
GANime,
VideoData,
trainer_defaults={
"callbacks": [checkpoint_callback, lr_monitor],
# "strategy": DeepSpeedStrategy(
# stage=2,
# offload_optimizer=True,
# offload_parameters=False,
# ),
},
)
if __name__ == "__main__":
cli_main()