init first
This commit is contained in:
1 parent
a4b5299c26
commit
c4ed7854e7
74 files changed
+9565
-89
No files matched your search
@@ -1,5 +1,5 @@
|
||||
from typing import Any, List
|
||||
|
||||
from omegaconf import DictConfig
|
||||
import torch
|
||||
from pytorch_lightning import LightningModule
|
||||
from torchmetrics import MaxMetric
|
||||
@@ -25,12 +25,16 @@ class MNISTLitModule(LightningModule):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
opt: DictConfig,
|
||||
net: torch.nn.Module,
|
||||
lr: float = 0.001,
|
||||
weight_decay: float = 0.0005,
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
|
||||
self.opt = opt
|
||||
print(f"\n\n >>>>>> {opt}")
|
||||
# this line allows to access init params with 'self.hparams' attribute
|
||||
# it also ensures init params will be stored in ckpt
|
||||
self.save_hyperparameters(logger=False)
|
||||
@@ -120,3 +124,4 @@ class MNISTLitModule(LightningModule):
|
||||
return torch.optim.Adam(
|
||||
params=self.parameters(), lr=self.hparams.lr, weight_decay=self.hparams.weight_decay
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user