Skip to content

Commit

Permalink
Allow strategy in configs
Browse files Browse the repository at this point in the history
  • Loading branch information
DomInvivo committed Aug 16, 2023
1 parent 4d472d7 commit 81d1d9d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion graphium/config/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def load_trainer(
cfg_trainer = deepcopy(config["trainer"])

# Define the IPU plugin if required
strategy = "auto"
strategy = config["trainer"]["trainer"].get("strategy", "auto")
if accelerator_type == "ipu":
ipu_opts, ipu_inference_opts = _get_ipu_opts(config)

Expand All @@ -385,6 +385,9 @@ def load_trainer(
precision=config["trainer"]["trainer"].get("precision"),
)

if strategy != "auto":
raise ValueError("IPUs selected, but strategy is not set to 'auto'")

from lightning_graphcore import IPUStrategy

strategy = IPUStrategy(training_opts=training_opts, inference_opts=inference_opts)
Expand Down

0 comments on commit 81d1d9d

Please sign in to comment.