Skip to content

Commit

Permalink
Merge pull request PromtEngineer#181 from gdxz123/develop
Browse files Browse the repository at this point in the history
fix: add device_type param when run ingest command in cpu type
  • Loading branch information
PromtEngineer authored Jun 26, 2023
2 parents 91372a9 + 9938aa3 commit 171455f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions run_localGPT_API.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 171455f

Please sign in to comment.