Skip to content

Commit

Permalink
[vulkan] Update vmfb naming
Browse files Browse the repository at this point in the history
Update vmfb naming for vulkan devices in order to resolve naming
conflicts in the presence of multiple vulkan devices.

Signed-Off-by: Gaurav Shukla <gaurav@nod-labs.com>
  • Loading branch information
Shukla-Gaurav committed Sep 27, 2023
1 parent ad1a0f3 commit 832318a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/language_models/scripts/vicuna.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,7 @@ def __init__(
hf_auth_token: str = None,
max_num_tokens=512,
device="cpu",
vulkan_target_triple="",
precision="int8",
vicuna_mlir_path=None,
vicuna_vmfb_path=None,
Expand Down Expand Up @@ -1248,6 +1249,7 @@ def __init__(
print(f"[DEBUG] hf model name: {self.hf_model_path}")
self.max_sequence_length = 256
self.device = device
self.vulkan_target_triple = vulkan_target_triple
self.device_id = device_id
self.precision = precision
self.download_vmfb = download_vmfb
Expand All @@ -1269,8 +1271,9 @@ def get_model_path(self, suffix="mlir"):
safe_device = self.device.split("-")[0]
if suffix in ["mlirbc", "mlir"]:
return Path(f"{self.model_name}_{self.precision}.{suffix}")
target_triple = self.vulkan_target_triple=="" ? "" : f"_{self.vulkan_target_triple}"
return Path(
f"{self.model_name}_{self.precision}_{safe_device}.{suffix}"
f"{self.model_name}_{self.precision}_{safe_device}{target_triple}.{suffix}"
)

def get_tokenizer(self):
Expand Down
1 change: 1 addition & 0 deletions apps/stable_diffusion/web/ui/stablelm_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def chat(
hf_model_path=model_path,
hf_auth_token=args.hf_auth_token,
device=device,
vulkan_target_triple=vulkan_target_triple,
precision=precision,
max_num_tokens=max_toks,
download_vmfb=download_vmfb,
Expand Down

0 comments on commit 832318a

Please sign in to comment.