From 9938aa3ae0cd56713ce3b5e4df9fb5e0230395c2 Mon Sep 17 00:00:00 2001 From: kenwong91 <815570979@qq.com> Date: Sun, 25 Jun 2023 18:14:38 +0800 Subject: [PATCH] fix: add device_type param when run ingest command in cpu type --- run_localGPT_API.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/run_localGPT_API.py b/run_localGPT_API.py index d51c65e4..52118b20 100644 --- a/run_localGPT_API.py +++ b/run_localGPT_API.py @@ -43,7 +43,12 @@ else: print("The directory does not exist") -result = subprocess.run(["python", "ingest.py"], capture_output=True) +run_langest_commands = ["python", "ingest.py"] +if DEVICE_TYPE == "cpu": + run_langest_commands.append("--device_type") + run_langest_commands.append(DEVICE_TYPE) + +result = subprocess.run(run_langest_commands, capture_output=True) if result.returncode != 0: raise FileNotFoundError( "No files were found inside SOURCE_DOCUMENTS, please put a starter file inside before starting the API!" @@ -212,7 +217,12 @@ def run_ingest_route(): else: print("The directory does not exist") - result = subprocess.run(["python", "ingest.py"], capture_output=True) + run_langest_commands = ["python", "ingest.py"] + if DEVICE_TYPE == "cpu": + run_langest_commands.append("--device_type") + run_langest_commands.append(DEVICE_TYPE) + + result = subprocess.run(run_langest_commands, capture_output=True) if result.returncode != 0: return "Script execution failed: {}".format(result.stderr.decode("utf-8")), 500 # load the vectorstore