def get_lightning_module()

in torchrecipes/vision/image_classification/train_app.py [0:0]


    def get_lightning_module(self) -> LightningModule:
        """
        Instantiate a LightningModule.
        """
        module = hydra.utils.instantiate(
            self.module_conf,
            _recursive_=False,
        )
        if self.pretrained_checkpoint_path:
            return ImageClassificationModule.load_from_checkpoint(
                checkpoint_path=none_throws(self.pretrained_checkpoint_path),
                strict=self.load_checkpoint_strict,
                model=module.model,
                loss=module.loss,
                optim_fn=module.optim_fn,
                metrics=module.metrics,
                lr_scheduler_fn=module.lr_scheduler_fn,
                apply_softmax=module.apply_softmax,
                process_weighted_labels=module.process_weighted_labels,
                norm_weight_decay=module.norm_weight_decay,
                lr_scheduler_interval=module.lr_scheduler_interval,
            )
        return module