mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -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_)
|
inputs = force_list(input_)
|
||||||
# This script runs in the ray/rllib dir.
|
# This script runs in the ray/rllib dir.
|
||||||
rllib_dir = Path(__file__).parent
|
rllib_dir = Path(__file__).parent
|
||||||
abs_inputs = [
|
|
||||||
str(rllib_dir.absolute().joinpath(i))
|
def patch_path(path):
|
||||||
if not os.path.exists(i) else i for i in inputs
|
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):
|
if not isinstance(input_, list):
|
||||||
abs_inputs = abs_inputs[0]
|
abs_inputs = abs_inputs[0]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue