From 19009fa29c09ff79c06f5c437fc770af4d6edc01 Mon Sep 17 00:00:00 2001 From: eladar Date: Thu, 12 Nov 2020 14:24:23 +0200 Subject: [PATCH] Specifying hyperparameters in LitClassifier__init__() It is better to avoid using self.save_hyperparameters with no inputs as it will recorded backbone as part of the yaml file. Doing do with resnet18 take about 2 minutes (probably to serialize the model) --- project/lit_image_classifier.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/lit_image_classifier.py b/project/lit_image_classifier.py index 1296a3f..e1f7005 100644 --- a/project/lit_image_classifier.py +++ b/project/lit_image_classifier.py @@ -25,7 +25,9 @@ def forward(self, x): class LitClassifier(pl.LightningModule): def __init__(self, backbone, learning_rate=1e-3): super().__init__() - self.save_hyperparameters() + # It's recomended to specify hyperparameters when using a backbone model. + # Specifically, avoid saving backbone model + self.save_hyperparameters(learning_rate) self.backbone = backbone def forward(self, x):