diff --git a/CHANGELOG.md b/CHANGELOG.md index 530bf2bf07..0b6c097585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- fix(server): close tokenizer config files after reading by @cloudgpuapp in #2422 - fix(cache): preserve disk cache entries on lookup and evict least-recently-used states by @remote-controlled-man in #2423 - fix: size Python buffers to the actual context by @remote-controlled-man in #2436 - feat: update llama.cpp to ggml-org/llama.cpp@afe77e18f diff --git a/llama_cpp/server/model.py b/llama_cpp/server/model.py index 8aa929202c..c50d90bd67 100644 --- a/llama_cpp/server/model.py +++ b/llama_cpp/server/model.py @@ -215,8 +215,10 @@ def load_llama_from_model_settings(settings: ModelSettings) -> llama_cpp.Llama: assert settings.hf_tokenizer_config_path is not None, ( "hf_tokenizer_config_path must be set for hf-tokenizer-config" ) + with open(settings.hf_tokenizer_config_path, "r") as config_file: + tokenizer_config = json.load(config_file) chat_handler = llama_cpp.llama_chat_format.hf_tokenizer_config_to_chat_completion_handler( - json.load(open(settings.hf_tokenizer_config_path)) + tokenizer_config ) tokenizer: Optional[llama_cpp.BaseLlamaTokenizer] = None