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

This commit is contained in:
DoubleMathew 2025-11-29 08:44:26 -06:00 committed by GitHub
commit f3803cdee0
2 changed files with 11 additions and 1 deletions

View file

@ -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(

View file

@ -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")