Skip to content

Commit

Permalink
👽️ Add workaround to bug where trial data is saved twice.
Browse files Browse the repository at this point in the history
Bug: when storage_path passed to RunConfig, data is saved to storage path and to the default ray_results dir.
Workaround: set TUNE_RESULT_DIR environment variable to match the passed storage_dir.
  • Loading branch information
lukethehuman committed Mar 12, 2024
1 parent 473119e commit 345d075
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sledo/optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(c) Copyright UKAEA 2023-2024.
"""

import os
from pathlib import Path
import dill

Expand Down Expand Up @@ -88,6 +89,10 @@ def __init__(
if not self.data_dir.exists():
self.data_dir.mkdir()

# Workaround to a bug which causes ray to save to both the passed
# storage directory and the default (~/ray-results).
os.environ['TUNE_RESULT_DIR'] = str(self.data_dir)

# Instantiate ray tune Tuner object.
self.tuner = tune.Tuner(
self.trial,
Expand All @@ -100,6 +105,7 @@ def __init__(
run_config=train.RunConfig(
storage_path=self.data_dir,
name=self.name,
log_to_file=True,
),
param_space=search_space,
)
Expand Down

0 comments on commit 345d075

Please sign in to comment.