fix: save_hyperparameters ignore did not work

This commit is contained in:
Alexander Engelsberger 2022-06-12 12:48:58 +02:00
parent ed83138e1f
commit 07dab5a5ca

View File

@ -5,7 +5,7 @@ Network architecture for Component based Learning.
""" """
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import asdict, dataclass
from typing import Any, Callable from typing import Any, Callable
import pytorch_lightning as pl import pytorch_lightning as pl
@ -33,10 +33,9 @@ class BaseYArchitecture(pl.LightningModule):
del hparams["initialized_proto_shape"] del hparams["initialized_proto_shape"]
hparams = self.HyperParameters(**hparams) hparams = self.HyperParameters(**hparams)
else: else:
self.save_hyperparameters( hparam_dict = asdict(hparams)
hparams.__dict__, hparam_dict["component_initializer"] = None
ignore=["component_initializer"], self.save_hyperparameters(hparam_dict, )
)
super().__init__() super().__init__()