This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove future satellite imagery to save GPU RAM. #136
- Loading branch information
Showing
5 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
power_perceiver/np_batch_processor/delete_forecast_satellite_imagery.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from dataclasses import dataclass | ||
|
||
from power_perceiver.consts import BatchKey | ||
from power_perceiver.load_prepared_batches.data_sources.prepared_data_source import NumpyBatch | ||
|
||
|
||
@dataclass | ||
class DeleteForecastSatelliteImagery: | ||
"""Delete imagery of the future. | ||
Useful when not training the U-Net, and we want to save GPU RAM. | ||
But we do want hrvsatellite_time_utc to continue out to 2 hours because | ||
downstream code relies on hrvsatellite_time_utc. | ||
""" | ||
|
||
num_hist_sat_images: int | ||
|
||
def __call__(self, np_batch: NumpyBatch) -> NumpyBatch: | ||
# Shape: time, channels, y, x | ||
np_batch[BatchKey.hrvsatellite] = np_batch[BatchKey.hrvsatellite][ | ||
: self.num_hist_sat_images | ||
] | ||
return np_batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters