Skip to content

Commit

Permalink
Fix Lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Sonawane <[email protected]>
  • Loading branch information
apsonawane committed Feb 3, 2025
1 parent efebc2d commit 3536a37
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lemonade/tools/ort_genai/oga.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ def generate(
if hasattr(self.model, "type"):
model_type = self.model.type
else:
with open(os.path.join(self.model_path, "genai_config.json"), "r") as f:
with open(
os.path.join(self.model_path, "genai_config.json"),
"r",
encoding="utf-8",
) as f:
genai_config = json.load(f)
model_type = genai_config["model"]["type"]

Expand All @@ -150,7 +154,8 @@ def generate(
if model_type.startswith("phi2") or model_type.startswith("phi3"):
chat_template = "<|user|>\n{input} <|end|>\n<|assistant|>"
elif model_type.startswith("phi4"):
chat_template = "<|im_start|>user<|im_sep|>\n{input}<|im_end|>\n<|im_start|>assistant<|im_sep|>"
chat_template = "<|im_start|>user<|im_sep|>\n{input} \
<|im_end|>\n<|im_start|>assistant<|im_sep|>"
elif model_type.startswith("llama3"):
chat_template = "<|start_header_id|>user<|end_header_id|>\n{input}<|eot_id|> \
<|start_header_id|>assistant<|end_header_id|>"
Expand Down

0 comments on commit 3536a37

Please sign in to comment.