Skip to content

Commit

Permalink
[rllib] Fix to allow input strings that are not file paths (ray-proje…
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusfrost authored Jul 3, 2021
1 parent 4bb3883 commit 7842bda
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions rllib/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,15 @@ def run(args, parser):
inputs = force_list(input_)
# This script runs in the ray/rllib dir.
rllib_dir = Path(__file__).parent
abs_inputs = [
str(rllib_dir.absolute().joinpath(i))
if not os.path.exists(i) else i for i in inputs
]

def patch_path(path):
if os.path.exists(path):
return path
else:
abs_path = str(rllib_dir.absolute().joinpath(path))
return abs_path if os.path.exists(abs_path) else path

abs_inputs = list(map(patch_path, inputs))
if not isinstance(input_, list):
abs_inputs = abs_inputs[0]

Expand Down

0 comments on commit 7842bda

Please sign in to comment.