Download base.py from AMLab-UvA/mosaic: direct link, hf CLI and curl.
- Browser
- Download file 730 Bytes
-
https://huggingface.co/AMLab-UvA/mosaic/resolve/refs%2Fpr%2F1/base.py
- Command line
-
hf download hf://AMLab-UvA/mosaic@refs/pr/1/base.py
-
curl -L -o base.py https://huggingface.co/AMLab-UvA/mosaic/resolve/refs%2Fpr%2F1/base.py
730 Bytes
| import torch | |
| from torch import nn | |
| from dataset import WeatherMetadata | |
| class WeatherModel(nn.Module): | |
| """Weather forecasting model wrapper.""" | |
| def __init__(self, model: nn.Module, weather_metadata: WeatherMetadata): | |
| super().__init__() | |
| self.model = model | |
| self.model.initialize_static_vars(weather_metadata.static_data, weather_metadata.longitude, weather_metadata.latitude) | |
| self.model.initialize_interpolation(weather_metadata.longitude, weather_metadata.latitude) | |
| self.weather_metadata = weather_metadata | |
| def forward(self, norm_state: torch.Tensor, day_year_time: torch.Tensor, num_noise_samples: int): | |
| return self.model(norm_state, day_year_time, num_noise_samples) | |