From 06099fb23c598b36d41da94dd6a7b875ae6220c9 Mon Sep 17 00:00:00 2001 From: Florian Prill <63-m300196@users.noreply.gitlab.dkrz.de> Date: Wed, 4 Dec 2024 15:29:56 +0100 Subject: [PATCH] fix: allow None as graph save_path setting. --- src/anemoi/training/train/train.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/anemoi/training/train/train.py b/src/anemoi/training/train/train.py index a18ed4dc..83d83eb6 100644 --- a/src/anemoi/training/train/train.py +++ b/src/anemoi/training/train/train.py @@ -118,14 +118,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