fix chatml & add llama3 format

This commit is contained in:
Yazan Agha-Schrader 2024-05-29 11:26:34 +02:00
parent 5fa255edfb
commit 9fa0aa53f5
2 changed files with 346 additions and 329 deletions

View file

@ -660,6 +660,7 @@ const BoolField = ({ label, title, name, value }) => {
<option value="alpaca">Alpaca</option>
<option value="chatml">ChatML</option>
<option value="llama2">Llama 2</option>
<option value="llama3">Llama 3</option>
<option value="phi3">Phi-3</option>
<option value="vicuna">Vicuna</option>
<option value=""></option>
@ -733,11 +734,11 @@ const BoolField = ({ label, title, name, value }) => {
${PromptControlFieldSet()}
<fieldset class="names">
<div>
<label for="user" id="id_user-name">User Name</label>
<label for="user" id="id_user-name">User ID Token</label>
<input type="text" id="user" name="user" value="${session.value.user}" oninput=${updateSession} />
</div>
<div>
<label for="bot" id="id_bot-name">AI Name</label>
<label for="bot" id="id_bot-name">AI ID Token</label>
<input type="text" id="bot" name="char" value="${session.value.char}" oninput=${updateSession} />
</div>
</fieldset>

View file

@ -1,14 +1,5 @@
// extended list
export const promptFormats = {
"airoborosl2": {
template: `{{prompt}} {{history}} {{char}}`,
historyTemplate: `{{name}}: {{message}}`,
char: "ASSISTANT",
user: "USER"
},
"alpaca": {
template: `{{prompt}}
@ -23,25 +14,76 @@ export const promptFormats = {
"bakllava": {
template: `{{history}}{{char}}:`,
historyTemplate: `{{name}}: {{message}}
"chatml": {
template: `<|im_start|>system
{{prompt}}<|im_end|>
{{history}}
{{char}}`,
historyTemplate: `{{name}}
{{message}}`,
char: "<|im_start|>assistant",
user: "<|im_start|>user",
userMsgSuffix: "<|im_end|>"
},
"llama2": {
template: `<s>[INST] <<SYS>>
{{prompt}}
<</SYS>>
{{history}} [/INST] {{char}} </s><s>[INST] `,
historyTemplate: `{{name}}: {{message}} [/INST]`,
char: "llama",
user: "user",
userMsgSuffix: ""
},
"llama3": {
template: `<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{{prompt}}<|eot_id|>{{history}}{{char}}`,
historyTemplate: `<|start_header_id|>{{name}}<|end_header_id|>
{{message}}`,
char: "assistant",
user: "user",
userMsgSuffix: "<|eot_id|>"
},
"phi3": {
template: `{{history}}
{{char}}
`,
historyTemplate: `{{name}}
{{message}}`,
char: "<|assistant|>",
user: "<|user|>",
userMsgSuffix: "<|end|>"
},
"airoborosl2": {
template: `{{prompt}} {{history}} {{char}}`,
historyTemplate: `{{name}}: {{message}}`,
char: "ASSISTANT",
user: "USER"
},
"chatml": {
template: `<|im_start|>system
{{prompt}}<|im_end|>
{{history}}
<|im_start|>{{char}}`,
historyTemplate: `<|im_start|>{{user}}
{{message}}<|im_end|>`,
char: "assistant",
user: "user"
"bakllava": {
template: `{{history}}{{char}}:`,
historyTemplate: `{{name}}: {{message}}
`,
char: "ASSISTANT",
user: "USER"
},
@ -122,19 +164,6 @@ export const promptFormats = {
"llama2": {
template: `<s>[INST] <<SYS>>
{{prompt}}
<</SYS>>
{{history}} [/INST] {{char}} </s><s>[INST] `,
historyTemplate: `{{name}}: {{message}} [/INST]`,
char: "llama",
user: "user"
},
"llava": {
template: `{{history}}{{char}}:`,
historyTemplate: `{{name}}: {{message}}
@ -310,19 +339,6 @@ export const promptFormats = {
"phi3": {
template: `{{history}}
{{char}}
`,
historyTemplate: `{{name}}
{{message}}`,
char: "<|assistant|>",
user: "<|user|>",
userMsgSuffix: "<|end|>"
},
"sauerkraut": {
template: `{{prompt}}
{{history}}