Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions unsloth/models/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ def from_pretrained(
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:
Expand All @@ -305,6 +307,8 @@ def from_pretrained(
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:
Expand All @@ -326,7 +330,8 @@ def from_pretrained(
"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,
)
Comment on lines 332 to 335
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard new trust_remote_code kwarg with matching unsloth_zoo version

The new call to get_transformers_model_type now forwards trust_remote_code, but the imported helper comes from unsloth_zoo.compiler and the repo still requires unsloth_zoo>=2025.12.5 without bumping to a release that accepts that keyword. With the currently published helper (no trust_remote_code parameter), this line will raise TypeError: get_transformers_model_type() got an unexpected keyword argument 'trust_remote_code' before any model can load, even when trust_remote_code is left at its default. Please gate this call on a dependency bump or add a compatibility fallback.

Useful? React with 👍 / 👎.

if len(model_types) == 1:
model_type = model_types[0]
Expand Down Expand Up @@ -826,6 +831,8 @@ def from_pretrained(
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:
Expand All @@ -842,6 +849,8 @@ def from_pretrained(
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:
Expand All @@ -861,7 +870,8 @@ def from_pretrained(
"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) + ","

Expand Down