Do not impose instruct mode while loading models

This commit is contained in:
oobabooga 2023-09-02 11:29:12 -07:00
parent 0576691538
commit 4affa08821
3 changed files with 11 additions and 77 deletions

View File

@ -49,200 +49,142 @@ llama-65b-gptq-3bit:
.*(gr1024|1024g|groupsize1024):
groupsize: 1024
.*(oasst|openassistant-|stablelm-7b-sft-v7-epoch-3):
mode: 'instruct'
instruction_template: 'Open Assistant'
skip_special_tokens: false
(?!.*galactica)(?!.*reward).*openassistant:
mode: 'instruct'
instruction_template: 'Open Assistant'
skip_special_tokens: false
(?!.*v0)(?!.*1.1)(?!.*1_1)(?!.*stable)(?!.*chinese).*vicuna:
mode: 'instruct'
instruction_template: 'Vicuna-v0'
.*vicuna.*v0:
mode: 'instruct'
instruction_template: 'Vicuna-v0'
.*vicuna.*(1.1|1_1|1.3|1_3):
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
.*vicuna.*(1.5|1_5):
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
truncation_length: 4096
rms_norm_eps: 5.0e-6
.*stable.*vicuna:
mode: 'instruct'
instruction_template: 'StableVicuna'
(?!.*chat).*chinese-vicuna:
mode: 'instruct'
instruction_template: 'Alpaca'
.*chinese-vicuna.*chat:
mode: 'instruct'
instruction_template: 'Chinese-Vicuna-Chat'
.*alpaca:
mode: 'instruct'
instruction_template: 'Alpaca'
.*alpaca-native-4bit:
mode: 'instruct'
instruction_template: 'Alpaca'
wbits: 4
groupsize: 128
.*galactica:
skip_special_tokens: false
.*dolly-v[0-9]-[0-9]*b:
mode: 'instruct'
instruction_template: 'Alpaca'
skip_special_tokens: false
custom_stopping_strings: '"### End"'
.*koala:
mode: 'instruct'
instruction_template: 'Koala'
.*chatglm:
mode: 'instruct'
instruction_template: 'ChatGLM'
.*metharme:
mode: 'instruct'
instruction_template: 'Metharme'
.*llava:
mode: 'instruct'
model_type: 'llama'
instruction_template: 'LLaVA'
custom_stopping_strings: '"\n###"'
.*raven:
mode: 'instruct'
instruction_template: 'RWKV-Raven'
.*ctx8192:
truncation_length: 8192
.*moss-moon.*sft:
mode: 'instruct'
instruction_template: 'MOSS'
.*stablelm-tuned:
mode: 'instruct'
instruction_template: 'StableLM'
truncation_length: 4096
.*stablelm-base:
truncation_length: 4096
.*galactica.*finetuned:
mode: 'instruct'
instruction_template: 'Galactica Finetuned'
.*galactica.*-v2:
mode: 'instruct'
instruction_template: 'Galactica v2'
(?!.*finetuned)(?!.*-v2).*galactica:
mode: 'instruct'
instruction_template: 'Galactica'
.*guanaco:
mode: 'instruct'
instruction_template: 'Guanaco non-chat'
.*baize:
mode: 'instruct'
instruction_template: 'Baize'
.*mpt-.*instruct:
mode: 'instruct'
instruction_template: 'Alpaca'
.*mpt-.*chat:
mode: 'instruct'
instruction_template: 'MPT-Chat'
(?!.*-flan-)(?!.*-t5-).*lamini-:
mode: 'instruct'
instruction_template: 'Alpaca'
.*incite.*chat:
mode: 'instruct'
instruction_template: 'INCITE-Chat'
.*incite.*instruct:
mode: 'instruct'
instruction_template: 'INCITE-Instruct'
.*wizard.*mega:
mode: 'instruct'
instruction_template: 'Wizard-Mega'
custom_stopping_strings: '"</s>"'
.*ziya-:
mode: 'instruct'
instruction_template: 'Ziya'
.*koalpaca:
mode: 'instruct'
instruction_template: 'KoAlpaca'
.*openbuddy:
mode: 'instruct'
instruction_template: 'OpenBuddy'
(?!.*chat).*vigogne:
mode: 'instruct'
instruction_template: 'Vigogne-Instruct'
.*vigogne.*chat:
mode: 'instruct'
instruction_template: 'Vigogne-Chat'
.*(llama-deus|supercot|llama-natural-instructions|open-llama-0.3t-7b-instruct-dolly-hhrlhf|open-llama-0.3t-7b-open-instruct):
mode: 'instruct'
instruction_template: 'Alpaca'
.*bactrian:
mode: 'instruct'
instruction_template: 'Bactrian'
.*(h2ogpt-oig-|h2ogpt-oasst1-|h2ogpt-research-oasst1-):
mode: 'instruct'
instruction_template: 'H2O-human_bot'
.*h2ogpt-gm-:
mode: 'instruct'
instruction_template: 'H2O-prompt_answer'
.*manticore:
mode: 'instruct'
instruction_template: 'Manticore Chat'
.*bluemoonrp-(30|13)b:
mode: 'instruct'
instruction_template: 'Bluemoon'
truncation_length: 4096
.*Nous-Hermes-13b:
mode: 'instruct'
instruction_template: 'Alpaca'
.*airoboros:
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
.*airoboros.*1.2:
mode: 'instruct'
instruction_template: 'Airoboros-v1.2'
.*alpa(cino|sta):
mode: 'instruct'
instruction_template: 'Alpaca'
.*hippogriff:
mode: 'instruct'
instruction_template: 'Hippogriff'
.*lazarus:
mode: 'instruct'
instruction_template: 'Alpaca'
.*guanaco-.*(7|13|33|65)b:
mode: 'instruct'
instruction_template: 'Guanaco'
.*hypermantis:
mode: 'instruct'
instruction_template: 'Alpaca'
.*open-llama-.*-open-instruct:
mode: 'instruct'
instruction_template: 'Alpaca'
.*starcoder-gpteacher-code-instruct:
mode: 'instruct'
instruction_template: 'Alpaca'
.*tulu:
mode: 'instruct'
instruction_template: 'Tulu'
.*chronos:
mode: 'instruct'
instruction_template: 'Alpaca'
.*samantha:
mode: 'instruct'
instruction_template: 'Samantha'
.*wizardcoder:
mode: 'instruct'
instruction_template: 'Alpaca'
.*starchat-beta:
mode: 'instruct'
instruction_template: 'Starchat-Beta'
custom_stopping_strings: '"<|end|>"'
.*minotaur:
mode: 'instruct'
instruction_template: 'Minotaur'
.*minotaur-15b:
truncation_length: 8192
.*orca_mini:
mode: 'instruct'
instruction_template: 'Orca Mini'
.*landmark:
truncation_length: 8192
@ -252,56 +194,42 @@ llama-65b-gptq-3bit:
truncation_length: 8192
instruction_template: 'Vicuna-v0'
.*(platypus|gplatty|superplatty):
mode: 'instruct'
instruction_template: 'Alpaca'
.*longchat:
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
.*vicuna-33b:
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
.*redmond-hermes-coder:
mode: 'instruct'
instruction_template: 'Alpaca'
truncation_length: 8192
.*wizardcoder-15b:
mode: 'instruct'
instruction_template: 'Alpaca'
truncation_length: 8192
.*wizardlm:
mode: 'instruct'
instruction_template: 'Vicuna-v1.1'
.*godzilla:
mode: 'instruct'
instruction_template: 'Alpaca'
.*llama-(2|v2):
truncation_length: 4096
rms_norm_eps: 5.0e-6
.*llama-(2|v2).*chat:
mode: 'instruct'
instruction_template: 'Llama-v2'
.*70b.*ggml.*\.bin:
n_gqa: 8
.*newhope:
mode: 'instruct'
instruction_template: 'NewHope'
.*stablebeluga2:
mode: 'instruct'
instruction_template: 'StableBeluga2'
truncation_length: 4096
rms_norm_eps: 5.0e-6
.*openchat:
mode: 'instruct'
instruction_template: 'OpenChat'
.*falcon.*-instruct:
mode: 'instruct'
.*(openorca-platypus2):
mode: 'instruct'
instruction_template: 'OpenOrca-Platypus2'
custom_stopping_strings: '"### Instruction:", "### Response:"'
rms_norm_eps: 5.0e-6
.*codellama:
rope_freq_base: 1000000
.*codellama.*instruct:
mode: 'instruct'
instruction_template: 'Llama-v2'

View File

@ -15,6 +15,7 @@ from modules.LoRA import add_lora_to_model
from modules.models import load_model, unload_model
from modules.models_settings import (
apply_model_settings_to_state,
get_model_settings_from_yamls,
save_model_settings,
update_model_parameters
)
@ -181,23 +182,29 @@ def create_event_handlers():
def load_model_wrapper(selected_model, loader, autoload=False):
if not autoload:
yield f"The settings for {selected_model} have been updated.\nClick on \"Load\" to load it."
yield f"The settings for `{selected_model}` have been updated.\n\nClick on \"Load\" to load it."
return
if selected_model == 'None':
yield "No model selected"
else:
try:
yield f"Loading {selected_model}..."
yield f"Loading `{selected_model}`..."
shared.model_name = selected_model
unload_model()
if selected_model != '':
shared.model, shared.tokenizer = load_model(shared.model_name, loader)
if shared.model is not None:
yield f"Successfully loaded {selected_model}"
output = f"Successfully loaded `{selected_model}`."
settings = get_model_settings_from_yamls(selected_model)
if 'instruction_template' in settings:
output += '\n\nIt seems to be an instruction-following model with template "{}". In the chat tab, instruct or chat-instruct modes should be used.'.format(settings['instruction_template'])
yield output
else:
yield f"Failed to load {selected_model}."
yield f"Failed to load `{selected_model}`."
except:
exc = traceback.format_exc()
logger.error('Failed to load the model.')

View File

@ -174,7 +174,6 @@ if __name__ == "__main__":
'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'],
'truncation_length': shared.settings['truncation_length'],