Unverified Commit 8d8855fd authored by Yuanheng Zhao's avatar Yuanheng Zhao Committed by GitHub
Browse files

[Bugfix] Add safety check and fallback for null scaling factor (#36106)


Signed-off-by: default avatarYuanheng Zhao <jonathan.zhaoyh@gmail.com>
Signed-off-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent e855d380
......@@ -2021,6 +2021,15 @@ def _get_and_verify_max_len(
if rope_type == "yarn":
derived_max_model_len = rp["original_max_position_embeddings"]
if scaling_factor is None:
# Fallback the factor to 1.0 if a user assigned `null`
logger.warning_once(
"The model's RoPE configuration has a null scaling "
"factor which is unexpected. This likely indicates a bug "
"in the model's HuggingFace config.json. Please notify the "
"model vendor. Falling back the value to 1.0. "
)
scaling_factor = 1.0
# Do this outside loop since all layer types should have the same scaling
derived_max_model_len *= scaling_factor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment