[Frontend] Customizable RoPE theta (#5197)
This commit is contained in:
@@ -23,7 +23,8 @@ def get_config(model: str,
|
||||
trust_remote_code: bool,
|
||||
revision: Optional[str] = None,
|
||||
code_revision: Optional[str] = None,
|
||||
rope_scaling: Optional[dict] = None) -> PretrainedConfig:
|
||||
rope_scaling: Optional[dict] = None,
|
||||
rope_theta: Optional[float] = None) -> PretrainedConfig:
|
||||
try:
|
||||
if VLLM_USE_MODELSCOPE:
|
||||
from modelscope import AutoConfig
|
||||
@@ -50,10 +51,12 @@ def get_config(model: str,
|
||||
config = config_class.from_pretrained(model,
|
||||
revision=revision,
|
||||
code_revision=code_revision)
|
||||
if rope_scaling is not None:
|
||||
logger.info("Updating rope_scaling from %r to %r",
|
||||
getattr(config, "rope_scaling", None), rope_scaling)
|
||||
config.update({"rope_scaling": rope_scaling})
|
||||
for key, value in [("rope_scaling", rope_scaling),
|
||||
("rope_theta", rope_theta)]:
|
||||
if value is not None:
|
||||
logger.info("Updating %s from %r to %r", key,
|
||||
getattr(config, key, None), value)
|
||||
config.update({key: value})
|
||||
return config
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user