mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
Config: Use an explicit "auto" value for rope_alpha
Using "auto" for rope alpha removes ambiguity on how to explicitly enable automatic rope calculation. The same behavior of None -> auto calculate still exists, but can be overwritten if a model's tabby_config.yml includes `rope_alpha`. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -13,6 +13,24 @@ def str_to_bool(value):
|
||||
raise ValueError(f"{value} is not a valid boolean value")
|
||||
|
||||
|
||||
def argument_with_auto(value):
|
||||
"""
|
||||
Argparse type wrapper for any argument that has an automatic option.
|
||||
|
||||
Ex. rope_alpha
|
||||
"""
|
||||
|
||||
if value == "auto":
|
||||
return "auto"
|
||||
|
||||
try:
|
||||
return float(value)
|
||||
except ValueError as ex:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'This argument only takes a type of float or "auto"'
|
||||
) from ex
|
||||
|
||||
|
||||
def init_argparser():
|
||||
"""Creates an argument parser that any function can use"""
|
||||
|
||||
@@ -133,7 +151,11 @@ def add_model_args(parser: argparse.ArgumentParser):
|
||||
model_group.add_argument(
|
||||
"--rope-scale", type=float, help="Sets rope_scale or compress_pos_emb"
|
||||
)
|
||||
model_group.add_argument("--rope-alpha", type=float, help="Sets rope_alpha for NTK")
|
||||
model_group.add_argument(
|
||||
"--rope-alpha",
|
||||
type=argument_with_auto,
|
||||
help="Sets rope_alpha for NTK",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--cache-mode",
|
||||
type=str,
|
||||
|
||||
Reference in New Issue
Block a user