Skip to content
Closed
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
3 changes: 2 additions & 1 deletion convert_hf_to_gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9612,11 +9612,12 @@
self.gguf_writer.add_sliding_window(self.hparams["sliding_window"])
self.gguf_writer.add_expert_feed_forward_length(self.hparams["intermediate_size"])

rope_scaling = self.hparams.get("rope_scaling") or {}
rope_scaling = self.hparams.get("rope_scaling") or self.hparams.get("rope_parameters") or {}
rope_type = rope_scaling.get("rope_type", rope_scaling.get("type"))
assert rope_type == "yarn", f"GPT-OSS only supports yarn rope scaling, got {rope_type}"
self.gguf_writer.add_rope_scaling_type(gguf.RopeScalingType.YARN)
self.gguf_writer.add_rope_scaling_factor(rope_scaling["factor"])
self.gguf_writer.add_rope_freq_base(rope_scaling.get("rope_theta"))

Check failure on line 9620 in convert_hf_to_gguf.py

View workflow job for this annotation

GitHub Actions / pyright type-check

Argument of type "Unknown | Any | None" cannot be assigned to parameter "value" of type "float" in function "add_rope_freq_base"   Type "Unknown | Any | None" is not assignable to type "float"     "None" is not assignable to "float" (reportArgumentType)

Check failure on line 9620 in convert_hf_to_gguf.py

View workflow job for this annotation

GitHub Actions / pyright type-check

Argument of type "Unknown | Any | None" cannot be assigned to parameter "value" of type "float" in function "add_rope_freq_base"   Type "Unknown | Any | None" is not assignable to type "float"     "None" is not assignable to "float" (reportArgumentType)
Copy link
Collaborator

@CISC CISC Dec 13, 2025

Choose a reason for hiding this comment

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

Suggested change
self.gguf_writer.add_rope_freq_base(rope_scaling.get("rope_theta"))
self.gguf_writer.add_rope_freq_base(rope_scaling.get("rope_theta", hparams.get("rope_theta")))

So, they moved this in v5, we need to check both places.

self.gguf_writer.add_rope_scaling_orig_ctx_len(rope_scaling.get("original_max_position_embeddings", 4096))


Expand Down
Loading