From d8dc7ae7d0a5c24379adf8d62c97dc86d1b90481 Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Mon, 16 Dec 2024 12:21:22 -0800 Subject: [PATCH] fix chinese --- llms/mlx_lm/generate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llms/mlx_lm/generate.py b/llms/mlx_lm/generate.py index a90cfd7b..afb1394e 100644 --- a/llms/mlx_lm/generate.py +++ b/llms/mlx_lm/generate.py @@ -1,7 +1,6 @@ # Copyright © 2023-2024 Apple Inc. import argparse -import codecs import json import sys @@ -189,7 +188,7 @@ def main(): elif using_cache: tokenizer.chat_template = metadata["chat_template"] - prompt = codecs.decode(args.prompt, "unicode_escape") + prompt = args.prompt.replace("\\n", "\n").replace("\\t", "\t") prompt = sys.stdin.read() if prompt == "-" else prompt if not args.ignore_chat_template and ( hasattr(tokenizer, "apply_chat_template")