fix: convert_hf_to_gguf - map new mistral-common valid_tokenizer_files output to avoid crash with --mistral-format#17712
Conversation
…istral-common versions.
|
I think the correct fix is to try to import and use |
… fallback to old logic otherwise.
|
Yeah makes sense. Checking for What about this? also so there's another (kind of redundant) Tested on |
|
Thank you for taking the time to fix this, will merge once CI gets its act together. :) |
Mistral never provided chat templates before, but it would make sense to use |
…l-format) (ggml-org#17712) * fix convert_hf_to_gguf.py failing with --mistral-format using later mistral-common versions. * use get_one_valid_tokenizer_file from mistral-common if available and fallback to old logic otherwise. * use file name instead of file path for get_one_valid_tokenizer_file. * fix --mistral-format tokenizer file failing for tokenizers in subdirectories. * move get_one_valid_tokenizer_file import to avoid nested try-except.
* origin/master: server: strip content-length header on proxy (ggml-org#17734) server: move msg diffs tracking to HTTP thread (ggml-org#17740) examples : add missing code block end marker [no ci] (ggml-org#17756) common : skip model validation when --help is requested (ggml-org#17755) ggml-cpu : remove asserts always evaluating to false (ggml-org#17728) convert: use existing local chat_template if mistral-format model has one. (ggml-org#17749) cmake : simplify build info detection using standard variables (ggml-org#17423) ci : disable ggml-ci-x64-amd-* (ggml-org#17753) common: use native MultiByteToWideChar (ggml-org#17738) metal : use params per pipeline instance (ggml-org#17739) llama : fix sanity checks during quantization (ggml-org#17721) build : move _WIN32_WINNT definition to headers (ggml-org#17736) build: enable parallel builds in msbuild using MTT (ggml-org#17708) ggml-cpu: remove duplicate conditional check 'iid' (ggml-org#17650) Add a couple of file types to the text section (ggml-org#17670) convert : support latest mistral-common (fix conversion with --mistral-format) (ggml-org#17712) Use OpenAI-compatible `/v1/models` endpoint by default (ggml-org#17689) webui: Fix zero pasteLongTextToFileLen to disable conversion being overridden (ggml-org#17445)
…l-format) (ggml-org#17712) * fix convert_hf_to_gguf.py failing with --mistral-format using later mistral-common versions. * use get_one_valid_tokenizer_file from mistral-common if available and fallback to old logic otherwise. * use file name instead of file path for get_one_valid_tokenizer_file. * fix --mistral-format tokenizer file failing for tokenizers in subdirectories. * move get_one_valid_tokenizer_file import to avoid nested try-except.
…l-format) (ggml-org#17712) * fix convert_hf_to_gguf.py failing with --mistral-format using later mistral-common versions. * use get_one_valid_tokenizer_file from mistral-common if available and fallback to old logic otherwise. * use file name instead of file path for get_one_valid_tokenizer_file. * fix --mistral-format tokenizer file failing for tokenizers in subdirectories. * move get_one_valid_tokenizer_file import to avoid nested try-except.
…l-format) (#17712) * fix convert_hf_to_gguf.py failing with --mistral-format using later mistral-common versions. * use get_one_valid_tokenizer_file from mistral-common if available and fallback to old logic otherwise. * use file name instead of file path for get_one_valid_tokenizer_file. * fix --mistral-format tokenizer file failing for tokenizers in subdirectories. * move get_one_valid_tokenizer_file import to avoid nested try-except.
Fixes #17691
mistral-commonupdated_filter_valid_tokenizer_filesto return additional data we don't need or expect, causing the conversion to crash when--mistral-formatis used.This change just maps the output back into the format originally expected.
Tested on
mistral-common==1.8.3andmistral-common==1.8.6... that said, there's a different issue with the new Ministral models, which is partially related to how
--mistral-formatworks:get_community_chat_templates()is invoked with--mistral-format, and the logic there results in the model getting the"unsloth-mistral-Devstral-Small-2507.jinja"template - not Ministral's localchat_template.jinja- that's only used forSpecialVocabmodels (notMistralVocab).To avoid this, users currently need to manually specify the chat template when running the model on e.g: llama-server with
--jinja --chat-template-file "./chat_template.jinja"This issue is the case regardless of this PR - as long as
--mistral-formatis used I think.