]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
scripts: corrected encoding when getting chat template (#11866) (#11907)
authorMoonRide303 <redacted>
Tue, 18 Feb 2025 09:30:16 +0000 (10:30 +0100)
committerGitHub <redacted>
Tue, 18 Feb 2025 09:30:16 +0000 (10:30 +0100)
Signed-off-by: MoonRide303 <redacted>
scripts/get_chat_template.py

index d8143e4005dec8cad43b84a743cc45753324ee05..b4827b317e1c934b359388a578b534f114bdc282 100755 (executable)
@@ -21,7 +21,7 @@ def get_chat_template(model_id, variant=None):
         # Use huggingface_hub library if available.
         # Allows access to gated models if the user has access and ran `huggingface-cli login`.
         from huggingface_hub import hf_hub_download
-        with open(hf_hub_download(repo_id=model_id, filename="tokenizer_config.json")) as f:
+        with open(hf_hub_download(repo_id=model_id, filename="tokenizer_config.json"), encoding="utf-8") as f:
             config_str = f.read()
     except ImportError:
         import requests