diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index ae76c573d0..fbe3c832c2 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -709,6 +709,9 @@ class FastBaseModel: model.config.update({"unsloth_version" : __version__}) pass patch_saving_functions(model, vision = True) + if tokenizer is None: + del model + raise RuntimeError("Unsloth: The tokenizer is weirdly not loaded? Please check if there is one.") patch_saving_functions(tokenizer, vision = True) # Fix gradient accumulation