Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/qai_hub_models/models/_shared/llm/llm_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def create_genie_config(
"rope-theta": int(get_rope_theta(llm_config)),
"rope-scaling": {
"rope-type": rope_scaling["rope_type"],
"factor": 8.0,
"factor": rope_scaling.get("factor", 8.0),
"low-freq-factor": rope_scaling["low_freq_factor"],
"high-freq-factor": rope_scaling["high_freq_factor"],
"original-max-position-embeddings": rope_scaling[
Expand Down
39 changes: 39 additions & 0 deletions src/qai_hub_models/models/_shared/llm/test_llm_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ---------------------------------------------------------------------
# Copyright (c) 2026 Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause
# ---------------------------------------------------------------------
from types import SimpleNamespace

from qai_hub_models.models._shared.llm.llm_helpers import create_genie_config


def test_create_genie_config_preserves_rope_scaling_factor() -> None:
rope_scaling = {
"rope_type": "llama3",
"factor": 32.0,
"low_freq_factor": 1.0,
"high_freq_factor": 4.0,
"original_max_position_embeddings": 8192,
}
llm_config = SimpleNamespace(
hidden_size=2048,
num_attention_heads=32,
vocab_size=128256,
bos_token_id=128000,
eos_token_id=[128001, 128008, 128009],
rope_theta=500000,
rope_scaling=rope_scaling,
)

genie_config = create_genie_config(
context_length=1024,
llm_config=llm_config,
embedding_type="rope",
model_list=["part1.bin", "part2.bin", "part3.bin"],
)

output_factor = genie_config["dialog"]["engine"]["model"]["positional-encoding"][
"rope-scaling"
]["factor"]

assert output_factor == rope_scaling["factor"]