From 7842bda50abe0cea3490acb9363ac94d07148e54 Mon Sep 17 00:00:00 2001 From: Julius Frost <33183774+juliusfrost@users.noreply.github.com> Date: Sat, 3 Jul 2021 04:12:47 -0400 Subject: [PATCH] [rllib] Fix to allow input strings that are not file paths (#16830) --- rllib/train.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rllib/train.py b/rllib/train.py index ef6f23039..fa492cfed 100755 --- a/rllib/train.py +++ b/rllib/train.py @@ -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]