mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 16:17:57 +01:00
Fix settings.json being ignored because of config.yaml
This commit is contained in:
parent
a77965e801
commit
5eaa914e1b
@ -1,11 +1,3 @@
|
|||||||
.*:
|
|
||||||
wbits: 'None'
|
|
||||||
model_type: 'None'
|
|
||||||
groupsize: 'None'
|
|
||||||
pre_layer: 0
|
|
||||||
mode: 'chat'
|
|
||||||
skip_special_tokens: true
|
|
||||||
custom_stopping_strings: ''
|
|
||||||
.*(llama|alpac|vicuna|guanaco|koala|llava|wizardlm|metharme|pygmalion-7b):
|
.*(llama|alpac|vicuna|guanaco|koala|llava|wizardlm|metharme|pygmalion-7b):
|
||||||
model_type: 'llama'
|
model_type: 'llama'
|
||||||
.*(opt-|opt_|opt1|opt3|optfor|galactica|galpaca|pygmalion-350m):
|
.*(opt-|opt_|opt1|opt3|optfor|galactica|galpaca|pygmalion-350m):
|
||||||
@ -28,7 +20,7 @@
|
|||||||
wbits: 6
|
wbits: 6
|
||||||
.*(-5bit|_5bit|int5-):
|
.*(-5bit|_5bit|int5-):
|
||||||
wbits: 5
|
wbits: 5
|
||||||
.*(-gr32-|-32g-|groupsize32):
|
.*(-gr32-|-32g-|groupsize32|-32g$):
|
||||||
groupsize: 32
|
groupsize: 32
|
||||||
.*(-gr64-|-64g-|groupsize64):
|
.*(-gr64-|-64g-|groupsize64):
|
||||||
groupsize: 64
|
groupsize: 64
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
from collections import OrderedDict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
@ -200,7 +201,7 @@ def is_chat():
|
|||||||
return args.chat
|
return args.chat
|
||||||
|
|
||||||
|
|
||||||
# Loading model-specific settings (default)
|
# Loading model-specific settings
|
||||||
with Path(f'{args.model_dir}/config.yaml') as p:
|
with Path(f'{args.model_dir}/config.yaml') as p:
|
||||||
if p.exists():
|
if p.exists():
|
||||||
model_config = yaml.safe_load(open(p, 'r').read())
|
model_config = yaml.safe_load(open(p, 'r').read())
|
||||||
@ -216,3 +217,5 @@ with Path(f'{args.model_dir}/config-user.yaml') as p:
|
|||||||
model_config[k].update(user_config[k])
|
model_config[k].update(user_config[k])
|
||||||
else:
|
else:
|
||||||
model_config[k] = user_config[k]
|
model_config[k] = user_config[k]
|
||||||
|
|
||||||
|
model_config = OrderedDict(model_config)
|
||||||
|
14
server.py
14
server.py
@ -878,12 +878,26 @@ if __name__ == "__main__":
|
|||||||
settings_file = Path(shared.args.settings)
|
settings_file = Path(shared.args.settings)
|
||||||
elif Path('settings.json').exists():
|
elif Path('settings.json').exists():
|
||||||
settings_file = Path('settings.json')
|
settings_file = Path('settings.json')
|
||||||
|
|
||||||
if settings_file is not None:
|
if settings_file is not None:
|
||||||
logging.info(f"Loading settings from {settings_file}...")
|
logging.info(f"Loading settings from {settings_file}...")
|
||||||
new_settings = json.loads(open(settings_file, 'r').read())
|
new_settings = json.loads(open(settings_file, 'r').read())
|
||||||
for item in new_settings:
|
for item in new_settings:
|
||||||
shared.settings[item] = new_settings[item]
|
shared.settings[item] = new_settings[item]
|
||||||
|
|
||||||
|
# Set default model settings based on settings.json
|
||||||
|
shared.model_config['.*'] = {
|
||||||
|
'wbits': 'None',
|
||||||
|
'model_type': 'None',
|
||||||
|
'groupsize': 'None',
|
||||||
|
'pre_layer': 0,
|
||||||
|
'mode': shared.settings['mode'],
|
||||||
|
'skip_special_tokens': shared.settings['skip_special_tokens'],
|
||||||
|
'custom_stopping_strings': shared.settings['custom_stopping_strings'],
|
||||||
|
}
|
||||||
|
|
||||||
|
shared.model_config.move_to_end('.*', last=False) # Move to the beginning
|
||||||
|
|
||||||
# Default extensions
|
# Default extensions
|
||||||
extensions_module.available_extensions = utils.get_available_extensions()
|
extensions_module.available_extensions = utils.get_available_extensions()
|
||||||
if shared.is_chat():
|
if shared.is_chat():
|
||||||
|
Loading…
Reference in New Issue
Block a user