From 1a66ffa6b97aaadd36d27be9f29b8adc9dd81ee7 Mon Sep 17 00:00:00 2001 From: Wei <21039366+Mai0313@users.noreply.github.com> Date: Mon, 2 Sep 2024 07:23:15 +0000 Subject: [PATCH] chore: Refactor code to simplify directory creation in rapidapi.py --- toolbench/inference/Downstream_tasks/rapidapi.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/toolbench/inference/Downstream_tasks/rapidapi.py b/toolbench/inference/Downstream_tasks/rapidapi.py index fcd05a9..78b8eee 100644 --- a/toolbench/inference/Downstream_tasks/rapidapi.py +++ b/toolbench/inference/Downstream_tasks/rapidapi.py @@ -487,9 +487,7 @@ def run_single_task(self, method, backbone_model, query_id, data_dict, args, out if callbacks is None: if server: print("Warning: no callbacks are defined for server mode") callbacks = [] - splits = output_dir_path.split("/") - os.makedirs("/".join(splits[:-1]),exist_ok=True) - os.makedirs("/".join(splits),exist_ok=True) + os.makedirs(output_dir_path ,exist_ok=True) output_file_path = os.path.join(output_dir_path,f"{query_id}_{method}.json") if (not server) and os.path.exists(output_file_path): return