dynatemp_low, dynatemp_high, dynatemp_exponent parameters (#5209)

This commit is contained in:
oobabooga 2024-01-08 23:28:35 -03:00 committed by GitHub
parent dc1df22a2b
commit 29c2693ea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 27 deletions

View file

@ -6,6 +6,7 @@ import yaml
from modules import shared
from modules.loaders import loaders_samplers
from modules.logging_colors import logger
def default_preset():
@ -13,7 +14,9 @@ def default_preset():
'temperature': 1,
'temperature_last': False,
'dynamic_temperature': False,
'dynamic_temperature_low': 0.1,
'dynatemp_low': 1,
'dynatemp_high': 1,
'dynatemp_exponent': 1,
'top_p': 1,
'min_p': 0,
'top_k': 0,
@ -48,11 +51,15 @@ def presets_params():
def load_preset(name):
generate_params = default_preset()
if name not in ['None', None, '']:
with open(Path(f'presets/{name}.yaml'), 'r') as infile:
preset = yaml.safe_load(infile)
path = Path(f'presets/{name}.yaml')
if path.exists():
with open(path, 'r') as infile:
preset = yaml.safe_load(infile)
for k in preset:
generate_params[k] = preset[k]
for k in preset:
generate_params[k] = preset[k]
else:
logger.error(f"The preset \"{name}\" does not exist under \"{path}\". Using the default parameters.")
return generate_params