Fix MacOS web execution flow (#1899)

* fix metal device path for chatbot

* single device remove indexing

* lint fix
This commit is contained in:
Phaneesh Barwaria
2023-11-09 22:29:29 +05:30
committed by GitHub
parent 2754e2e257
commit db89b1bdc1
3 changed files with 17 additions and 3 deletions

View File

@@ -153,6 +153,7 @@ def chat(
device_id = None
model_name, model_path = list(map(str.strip, model.split("=>")))
device = device if "=>" not in device else device.split("=>")[1].strip()
if "cuda" in device:
device = "cuda"
elif "sync" in device:
@@ -164,6 +165,8 @@ def chat(
device = "vulkan"
elif "rocm" in device:
device = "rocm"
elif "metal" in device:
device = "metal"
else:
print("unrecognized device")
@@ -331,6 +334,8 @@ def llm_chat_api(InputData: dict):
elif "vulkan" in device:
device_id = int(device.split("://")[1])
device = "vulkan"
elif "metal" in device:
device = "metal"
else:
print("unrecognized device")