mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
Sampling: Add additive param to overrides
Additive is used to add collections together. Currently, it's used for lists, but it can be used for dictionaries in the future. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -325,6 +325,16 @@ def apply_forced_sampler_overrides(params: BaseSamplerRequest):
|
||||
|
||||
for var, value in overrides.items():
|
||||
override = value.get("override")
|
||||
force = unwrap(value.get("force"), False)
|
||||
if force and override:
|
||||
setattr(params, var, override)
|
||||
original_value = getattr(params, var, None)
|
||||
|
||||
# Force takes precedence over additive
|
||||
# Additive only works on lists and doesn't remove duplicates
|
||||
if override:
|
||||
if unwrap(value.get("force"), False):
|
||||
setattr(params, var, override)
|
||||
elif (
|
||||
unwrap(value.get("additive"), False)
|
||||
and isinstance(override, list)
|
||||
and isinstance(original_value, list)
|
||||
):
|
||||
setattr(params, var, override + original_value)
|
||||
|
||||
Reference in New Issue
Block a user