Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix rope_theta -> rope_parameters['rope_theta'] (#3651)

DoubleMathew8953a06764a0
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 6ca128bd83d..cd4eeefb699 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -562,6 +562,12 @@ for model_name in model_architectures:
config = inspect.getsource(eval(config_filename))
except:
continue
+ if "RopeParameters" in config:
+ try:
+ exec(f"from {config_filepath} import RopeParameters", globals())
+ except:
+ continue
+
if "rope_scaling" in config:
continue
config = re.sub(
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index b1b8a8fb78d..f6a0fff1172 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -1551,7 +1551,11 @@ class LlamaRotaryEmbedding(torch.nn.Module):
super().__init__()
if config is not None:
# [TODO] Hack to pass in config - need to remove later
- base = config.rope_theta
+ try:
+ base = config.rope_theta
+ except:
+ base = getattr(config, "rope_parameters", {})
+ base = base["rope_theta"]
partial_rotary_factor = (
config.partial_rotary_factor
if hasattr(config, "partial_rotary_factor")