def main():
    train_dataloader, validation_dataloader = get_dataloaders()
    model = Model()
    logger = NeptuneLogger(project='OpenClimateFix/predict-pv-yield')
    logger.log_hyperparams(params)
    _LOG.info(f'logger.version = {logger.version}')
    trainer = pl.Trainer(gpus=0, max_epochs=1, logger=logger)
    trainer.fit(model, train_dataloader)
예제 #2
0
def main():
    train_dataloader, validation_dataloader = get_dataloaders(n_validation_data=1000, cloud='aws')
    model = Model()
    # logger = NeptuneLogger(project="OpenClimateFix/predict-pv-yield")
    # _LOG.info(f"logger.version = {logger.version}")
    trainer = pl.Trainer(gpus=0, max_epochs=10)

    # dont need to train baseline model
    # trainer.fit(model, train_dataloaders=train_dataloader, val_dataloaders=validation_dataloader)

    trainer.validate(model, validation_dataloader)
def main():
    train_dataloader, validation_dataloader = get_dataloaders(
        n_train_data=10, n_validation_data=10)
    model = Model()
    logger = NeptuneLogger(project='OpenClimateFix/predict-pv-yield')
    logger.log_hyperparams(model_configuration_default)
    _LOG.info(f'logger.version = {logger.version}')
    trainer = pl.Trainer(gpus=1, max_epochs=10, logger=logger)
    trainer.fit(model,
                train_dataloaders=train_dataloader,
                val_dataloaders=validation_dataloader)

    # run validation
    trainer.validate(model, validation_dataloader)
def main():
    train_dataloader, validation_dataloader = get_dataloaders(
        n_train_data=24900,
        n_validation_data=1000,
        data_path="gs://solar-pv-nowcasting-data/prepared_ML_training_data/v4/",
        cloud="gcp",
    )
    model = Model()

    logger = NeptuneLogger(project="OpenClimateFix/predict-pv-yield")
    logger.log_hyperparams(model_configuration_default)
    _LOG.info(f"logger.version = {logger.version}")
    trainer = pl.Trainer(gpus=1, max_epochs=10, logger=logger)
    trainer.fit(model,
                train_dataloaders=train_dataloader,
                val_dataloaders=validation_dataloader)

    # run validation
    trainer.validate(model, validation_dataloader)
예제 #5
0
from predict_pv_yield.models.conv3d.model import Model

from predict_pv_yield.data.dataloader import get_dataloaders
from pytorch_lightning.utilities.cloud_io import load as pl_load
import torch

weights = './weights/conv3d/last.ckpt'
checkpoint = pl_load(weights, map_location=torch.device('cpu'))

model = Model(conv3d_channels=32,
              fc1_output_features=32,
              fc2_output_features=16,
              fc3_output_features=16,
              include_time=False,
              number_of_conv3d_layers=4)
model.load_from_checkpoint(weights)

train_dataset, validation_dataset = get_dataloaders()
예제 #6
0
checkpoint = pl_load(weights, map_location=torch.device("cpu"))

model = Model(
    conv3d_channels=32,
    fc1_output_features=128,
    fc2_output_features=128,
    fc3_output_features=64,
    include_time=True,
    forecast_len=12,
    history_len=6,
    number_of_conv3d_layers=6,
)
model.load_state_dict(checkpoint["state_dict"])

train_dataset, validation_dataset = get_dataloaders(
    cloud="gcp",
    data_path="gs://solar-pv-nowcasting-data/prepared_ML_training_data/v4/")
validation_dataset = iter(validation_dataset)
x = next(validation_dataset)

y_hat_all = model(x)

# plot one
batch_index = 0
y = x["pv_yield"][batch_index][7:, 0].detach().numpy()
y_hat = y_hat_all[batch_index].detach().numpy()
time = pd.to_datetime(
    x["sat_datetime_index"][batch_index][7:].detach().numpy(), unit="s")

fig = plot_one_result(x=time, y=y, y_hat=y_hat)
fig.show(renderer="browser")