From 674073dac11d41b6a876d7637bda4ef28b0e826e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 10 Apr 2026 10:20:48 +0800 Subject: [PATCH] fix: add missing return in load_model_with_fallback When mlx_lm.load() succeeds without raising a ValueError, the function falls through the try block without returning, implicitly returning None. This causes a TypeError in MLXLanguageModel.load() which tries to unpack the result: self.model, self.tokenizer = load_model_with_fallback(...) TypeError: cannot unpack non-iterable NoneType object Add the missing `return model, tokenizer` after the successful load. Fixes #252, #249 --- vllm_mlx/utils/tokenizer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vllm_mlx/utils/tokenizer.py b/vllm_mlx/utils/tokenizer.py index a50883951..aaaeae550 100644 --- a/vllm_mlx/utils/tokenizer.py +++ b/vllm_mlx/utils/tokenizer.py @@ -52,6 +52,7 @@ def load_model_with_fallback(model_name: str, tokenizer_config: dict = None): try: model, tokenizer = load(model_name, tokenizer_config=tokenizer_config) + return model, tokenizer except ValueError as e: # Fallback for models with non-standard tokenizers if "TokenizersBackend" in str(e) or "Tokenizer class" in str(e):