Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datapipes update #108

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pvnet/data/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Utils common between Wind and PV datamodules"""
import numpy as np
import torch
from ocf_datapipes.batch import unstack_np_batch_into_examples
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey, unstack_np_batch_into_examples
from torch.utils.data import IterDataPipe, functional_datapipe


Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from huggingface_hub.file_download import hf_hub_download
from huggingface_hub.hf_api import HfApi
from huggingface_hub.utils._deprecation import _deprecate_positional_args
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from ocf_ml_metrics.evaluation.evaluation import evaluation
from ocf_ml_metrics.metrics.errors import common_metrics

Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/baseline/last_value.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Persistence model"""

from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey

import pvnet
from pvnet.models.base_model import BaseModel
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/baseline/single_value.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Average value model"""
import torch
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/multimodal/deep_supervision.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import torch
import torch.nn.functional as F
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/multimodal/multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import torch
from ocf_datapipes.utils.consts import BatchKey, NWPBatchKey
from ocf_datapipes.batch import BatchKey, NWPBatchKey
from torch import nn

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/multimodal/nwp_weighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional

import torch
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/multimodal/site_encoders/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import torch
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

from pvnet.models.multimodal.linear_networks.networks import ResFCNet2
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/multimodal/weather_residual.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import torch
import torch.nn.functional as F
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion pvnet/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
import torch
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion pvnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import yaml
from lightning.pytorch.loggers import Logger
from lightning.pytorch.utilities import rank_zero_only
from ocf_datapipes.utils.consts import BatchKey, Location
from ocf_datapipes.batch import BatchKey
from ocf_datapipes.utils import Location
from ocf_datapipes.utils.geospatial import osgb_to_lon_lat
from omegaconf import DictConfig, OmegaConf

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ocf_datapipes>=2.3.0
ocf_datapipes>=3.0.0
ocf_ml_metrics
numpy
pandas
Expand Down
2 changes: 1 addition & 1 deletion scripts/hindcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import pandas as pd
import torch
import xarray as xr
from ocf_datapipes.batch import BatchKey
from ocf_datapipes.load import OpenGSP
from ocf_datapipes.training.pvnet import construct_sliced_data_pipeline
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.utils.utils import stack_np_examples_into_batch
from torchdata.dataloader2 import DataLoader2, MultiProcessingReadingService
from torchdata.datapipes.iter import IterableWrapper
Expand Down
3 changes: 1 addition & 2 deletions scripts/save_concurrent_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
import hydra
import numpy as np
import torch
from ocf_datapipes.batch import stack_np_examples_into_batch
from ocf_datapipes.batch import BatchKey, stack_np_examples_into_batch
from ocf_datapipes.training.common import (
open_and_return_datapipes,
)
from ocf_datapipes.training.pvnet import construct_loctime_pipelines, construct_sliced_data_pipeline
from ocf_datapipes.utils.consts import BatchKey
from omegaconf import DictConfig, OmegaConf
from sqlalchemy import exc as sa_exc
from torch.utils.data import DataLoader
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
import hydra

from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from datetime import timedelta

import pvnet
Expand Down
2 changes: 1 addition & 1 deletion tests/models/multimodal/site_encoders/test_encoders.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import torch
from ocf_datapipes.utils.consts import BatchKey
from ocf_datapipes.batch import BatchKey
from torch import nn

from pvnet.models.multimodal.site_encoders.encoders import (
Expand Down
Binary file modified tests/test_data/sample_batches/train/000000.pt
Binary file not shown.
Binary file modified tests/test_data/sample_batches/train/000001.pt
Binary file not shown.
Loading