Add OpenChat prompt format

This commit is contained in:
turboderp
2024-02-16 23:29:28 +01:00
parent b2454b2231
commit 9d9702e5f4
3 changed files with 37 additions and 1 deletions

View File

@@ -121,6 +121,7 @@ def prepare_draft_model(model):
if model["draft_enabled"]:
prep_draft_config = ExLlamaV2Config()
prep_draft_config.fasttensors = False
prep_draft_config.model_dir = expanduser(model.get("draft_model_directory", ""))
try:
prep_draft_config.prepare()
@@ -149,6 +150,7 @@ def prepare_draft_model(model):
def prepare_model(model):
prep_config = ExLlamaV2Config()
prep_config.fasttensors = False
prep_config.model_dir = expanduser(model["model_directory"])
try:

View File

@@ -236,6 +236,39 @@ class PromptFormat_deepseek_instruct(PromptFormat):
return text
class PromptFormat_openchat(PromptFormat):
description = "OpenChat"
def __init__(self):
super().__init__()
pass
def is_instruct(self):
return True
def stop_conditions(self, tokenizer, settings):
return \
[tokenizer.eos_token_id,
"<|end_of_turn|>",
"<|endoftext|>",
"GPT4 Correct User:"
]
def format(self, prompt, response, system_prompt, settings):
text = ""
if system_prompt and system_prompt.strip() != "":
text += system_prompt
text += "<|end_of_turn|>"
text += "GPT4 Correct User:"
text += prompt
text += "<|end_of_turn|>"
text += "GPT4 Correct Assistant:"
if response:
text += response
text += "<|end_of_turn|>"
return text
prompt_formats = \
{
@@ -247,6 +280,7 @@ prompt_formats = \
"Phind-CodeLlama": PromptFormat_phind_codellama,
"Deepseek-chat": PromptFormat_deepseek_chat,
"Deepseek-instruct": PromptFormat_deepseek_instruct,
"OpenChat": PromptFormat_openchat,
}
def list_prompt_formats():

View File

@@ -62,7 +62,7 @@ export class SessionSettings {
// Sampling
this.sss_i_temperature = new controls.SettingsSlider("sss-item-left", "Temperature", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 3, null, this.settings, "temperature", () => { this.updateView(true); });
this.sss_i_temperature = new controls.SettingsSlider("sss-item-left", "Temperature", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 5, null, this.settings, "temperature", () => { this.updateView(true); });
this.sss_i_topK = new controls.SettingsSlider("sss-item-left", "Top K", "sss-item-mid", "sss-item-right sss-item-textbox-r", 0, 0, 1000, { "0": "off" }, this.settings, "top_k", () => { this.updateView(true); });
this.sss_i_topP = new controls.SettingsSlider("sss-item-left", "Top P", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "top_p", () => { this.updateView(true); });
this.sss_i_minP = new controls.SettingsSlider("sss-item-left", "Min P", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "min_p", () => { this.updateView(true); });