From 96bd2a7668d9abcf94950188476bd7770de19f7e Mon Sep 17 00:00:00 2001 From: DoubleMathew Date: Thu, 18 Dec 2025 06:09:17 -0600 Subject: [PATCH 1/2] Fix Deepseek OCR Lora Model Load (#3738) * fix deepseek ocr lora_model load: trust_remote_code option check for import error in autoconfig/peftconfig from_pretrained error handle import * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Daniel Han Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- unsloth/models/loader.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index bfa94d86d7..6148b1783e 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -289,6 +289,8 @@ class FastLanguageModel(FastLlamaModel): trust_remote_code = trust_remote_code, ) is_model = True + except ImportError: + raise except Exception as error: autoconfig_error = str(error) if "architecture" in autoconfig_error: @@ -305,6 +307,8 @@ class FastLanguageModel(FastLlamaModel): trust_remote_code = trust_remote_code, ) is_peft = True + except ImportError: + raise except Exception as error: peft_error = str(error) if "architecture" in peft_error: @@ -326,7 +330,8 @@ class FastLanguageModel(FastLlamaModel): "Please separate the LoRA and base models to 2 repos." ) model_types = get_transformers_model_type( - peft_config if peft_config is not None else model_config + peft_config if peft_config is not None else model_config, + trust_remote_code = trust_remote_code, ) if len(model_types) == 1: model_type = model_types[0] @@ -826,6 +831,8 @@ class FastModel(FastBaseModel): trust_remote_code = trust_remote_code, ) is_model = True + except ImportError: + raise except Exception as error: autoconfig_error = str(error) if "architecture" in autoconfig_error: @@ -842,6 +849,8 @@ class FastModel(FastBaseModel): trust_remote_code = trust_remote_code, ) is_peft = True + except ImportError: + raise except Exception as error: peft_error = str(error) if "architecture" in peft_error: @@ -861,7 +870,8 @@ class FastModel(FastBaseModel): "Please separate the LoRA and base models to 2 repos." ) model_types = get_transformers_model_type( - peft_config if peft_config is not None else model_config + peft_config if peft_config is not None else model_config, + trust_remote_code = trust_remote_code, ) model_types_all = ",".join(model_types) + "," From a36eb9b9a17d3a6b782dbcbf10a9d9d44583eae0 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 18 Dec 2025 09:27:46 -0800 Subject: [PATCH 2/2] FunctionGemma --- pyproject.toml | 4 ++-- unsloth/models/_utils.py | 2 +- unsloth/models/mapper.py | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cb3f8f3fa4..84d6d86d93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ huggingfacenotorch = [ ] huggingface = [ "unsloth[huggingfacenotorch]", - "unsloth_zoo>=2025.12.5", + "unsloth_zoo>=2025.12.6", "torchvision", "unsloth[triton]", ] @@ -523,7 +523,7 @@ colab-ampere-torch220 = [ "flash-attn>=2.6.3 ; ('linux' in sys_platform)", ] colab-new = [ - "unsloth_zoo>=2025.12.5", + "unsloth_zoo>=2025.12.6", "packaging", "tyro", "transformers>=4.51.3,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0,!=4.54.0,!=4.55.0,!=4.55.1,!=4.57.0,<=4.57.3", diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 6f6d693b4f..17d0ab9631 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.12.6" +__version__ = "2025.12.7" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.py index 7a90c6b358..e7296291f1 100644 --- a/unsloth/models/mapper.py +++ b/unsloth/models/mapper.py @@ -1251,6 +1251,11 @@ __INT_TO_FLOAT_MAPPER = \ "unsloth/gpt-oss-safeguard-120b", "openai/gpt-oss-safeguard-120b", ), + "unsloth/functiongemma-270m-it-unsloth-bnb-4bit" : ( + "unsloth/functiongemma-270m-it", + "google/functiongemma-270m-it", + "unsloth/functiongemma-270m-it-unsloth-bnb-4bit", + ), } INT_TO_FLOAT_MAPPER = {}