Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Issue/86 remove torch #329

Merged
merged 3 commits into from
Nov 3, 2021
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: 0 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ dependencies:
- boto3
- moto

# Machine learning
- pytorch::pytorch # explicitly specify pytorch channel to prevent conda from using conda-forge for pytorch, and hence installing the CPU-only version.

# PV & Geospatial
- pvlib
- pyproj
Expand Down
3 changes: 1 addition & 2 deletions nowcasting_dataset/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Union

import numpy as np
import torch
import xarray as xr

# DEFAULT PATHS
Expand All @@ -24,7 +23,7 @@
NWP_FILENAME = "gs://" + str(BUCKET / "NWP/UK_Met_Office/UKV_zarr")

# Typing
Array = Union[xr.DataArray, np.ndarray, torch.Tensor]
Array = Union[xr.DataArray, np.ndarray]
PV_SYSTEM_ID: str = "pv_system_id"
PV_SYSTEM_ROW_NUMBER = "pv_system_row_number"
PV_SYSTEM_X_COORDS = "pv_system_x_coords"
Expand Down
4 changes: 1 addition & 3 deletions nowcasting_dataset/data_sources/gsp/gsp_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import numpy as np
import pandas as pd
import torch
import xarray as xr

import nowcasting_dataset.filesystem.utils as nd_fs_utils
Expand Down Expand Up @@ -62,8 +61,7 @@ def __post_init__(self, image_size_pixels: int, meters_per_pixel: int):
Set random seed and load data
"""
super().__post_init__(image_size_pixels, meters_per_pixel)
seed = torch.initial_seed()
self.rng = np.random.default_rng(seed=seed)
self.rng = np.random.default_rng()
self.load()

def check_input_paths_exist(self) -> None:
Expand Down
4 changes: 1 addition & 3 deletions nowcasting_dataset/data_sources/pv/pv_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import fsspec
import numpy as np
import pandas as pd
import torch
import xarray as xr

import nowcasting_dataset.filesystem.utils as nd_fs_utils
Expand Down Expand Up @@ -49,8 +48,7 @@ class PVDataSource(ImageDataSource):
def __post_init__(self, image_size_pixels: int, meters_per_pixel: int):
""" Post Init """
super().__post_init__(image_size_pixels, meters_per_pixel)
seed = torch.initial_seed()
self.rng = np.random.default_rng(seed=seed)
self.rng = np.random.default_rng()
self.load()

def check_input_paths_exist(self) -> None:
Expand Down
3 changes: 0 additions & 3 deletions nowcasting_dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import gcsfs
import numpy as np
import pandas as pd
import torch
import xarray as xr

import nowcasting_dataset
Expand Down Expand Up @@ -117,8 +116,6 @@ def to_numpy(value):
value = np.int32(value.timestamp())
elif isinstance(value, np.ndarray) and np.issubdtype(value.dtype, np.datetime64):
value = value.astype("datetime64[s]").astype(np.int32)
elif isinstance(value, torch.Tensor):
value = value.numpy()

return value

Expand Down