mirror of
https://github.com/vale981/ray
synced 2025-03-05 10:01:43 -05:00
[rllib] Fix to allow input strings that are not file paths (#16830)
This commit is contained in:
parent
4bb3883a73
commit
7842bda50a
1 changed files with 9 additions and 4 deletions
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue