Skip to content

Commit

Permalink
fix: allow None as graph save_path setting. (ecmwf#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
fprill authored Dec 6, 2024
1 parent 891405e commit e002b8c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/anemoi/training/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ def graph_data(self) -> HeteroData:
Creates the graph in all workers.
"""
graph_filename = Path(
self.config.hardware.paths.graph,
self.config.hardware.files.graph,
)
if self.config.hardware.files.graph is not None:
graph_filename = Path(
self.config.hardware.paths.graph,
self.config.hardware.files.graph,
)

if graph_filename.exists() and not self.config.graph.overwrite:
LOGGER.info("Loading graph data from %s", graph_filename)
return torch.load(graph_filename)

if graph_filename.exists() and not self.config.graph.overwrite:
LOGGER.info("Loading graph data from %s", graph_filename)
return torch.load(graph_filename)
else:
graph_filename = None

from anemoi.graphs.create import GraphCreator

Expand Down

0 comments on commit e002b8c

Please sign in to comment.