(self, positional_encoding_name, neural_network_name, hparams)
| 71 | # define the LightningModule |
| 72 | class LocationEncoder(pl.LightningModule): |
| 73 | def __init__(self, positional_encoding_name, neural_network_name, hparams): |
| 74 | super().__init__() |
| 75 | |
| 76 | self.learning_rate = hparams["optimizer"]["lr"] |
| 77 | self.weight_decay = hparams["optimizer"]["wd"] |
| 78 | self.regression = get_param(hparams, "regression") |
| 79 | |
| 80 | self.loss_fn = get_loss_fn(presence_only=get_param(hparams, "presence_only_loss"), |
| 81 | loss_weight=get_param(hparams, "loss_weight"), |
| 82 | regression=self.regression) |
| 83 | |
| 84 | self.positional_encoder = get_positional_encoding( |
| 85 | positional_encoding_name, hparams |
| 86 | ) |
| 87 | self.neural_network = get_neural_network( |
| 88 | neural_network_name, |
| 89 | input_dim=self.positional_encoder.embedding_dim, |
| 90 | hparams=hparams |
| 91 | ) |
| 92 | |
| 93 | # this enables LocationEncoder.load_from_checkpoint(path) |
| 94 | self.save_hyperparameters() |
| 95 | |
| 96 | def common_step(self, batch, batch_idx): |
| 97 | lonlats, label = batch |
nothing calls this directly
no test coverage detected