mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-23 21:18:00 +01:00
Clearer syntax for instruction-following characters
This commit is contained in:
parent
9c77ab4fc2
commit
0e6d17304a
@ -1,4 +1,4 @@
|
||||
name: "### Response:"
|
||||
your_name: "### Instruction:"
|
||||
context: "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n"
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n"
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "答:"
|
||||
your_name: "[Round <|round|>]\n问:"
|
||||
context: ""
|
||||
user: "[Round <|round|>]\n问:"
|
||||
bot: "答:"
|
||||
turn_template: "<|user|><|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "GPT:"
|
||||
your_name: "USER:"
|
||||
context: "BEGINNING OF CONVERSATION: "
|
||||
user: "USER:"
|
||||
bot: "GPT:"
|
||||
turn_template: "<|user|> <|user-message|> <|bot|><|bot-message|></s>"
|
||||
context: "BEGINNING OF CONVERSATION: "
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "### Assistant"
|
||||
your_name: "### Human"
|
||||
context: "You are LLaVA, a large language and vision assistant trained by UW Madison WAIV Lab. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language. Follow the instructions carefully and explain your answers in detail.\n### Human: \nHi!\n### Assistant: \nHi there! How can I help you today?\n"
|
||||
turn_template: "<|user|>\n<|user-message|>\n<|bot|>\n<|bot-message|>\n"
|
||||
user: "### Human"
|
||||
bot: "### Assistant"
|
||||
turn_template: "<|user|>\n<|user-message|>\n<|bot|>\n<|bot-message|>\n"
|
||||
context: "You are LLaVA, a large language and vision assistant trained by UW Madison WAIV Lab. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language. Follow the instructions carefully and explain your answers in detail.\n### Human: \nHi!\n### Assistant: \nHi there! How can I help you today?\n"
|
@ -1,3 +1,3 @@
|
||||
name: "<|assistant|>"
|
||||
your_name: "<|prompter|>"
|
||||
user: "<|prompter|>"
|
||||
bot: "<|assistant|>"
|
||||
turn_template: "<|user|><|user-message|><|endoftext|><|bot|><|bot-message|><|endoftext|>"
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: "Alice:"
|
||||
your_name: "Bob:"
|
||||
user: "Bob:"
|
||||
bot: "Alice:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "### Assistant:"
|
||||
your_name: "### Human:"
|
||||
context: "A chat between a human and an assistant.\n\n"
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n"
|
||||
context: "A chat between a human and an assistant.\n\n"
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "ASSISTANT:"
|
||||
your_name: "USER:"
|
||||
context: "A chat between a user and an assistant.\n\n"
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "A chat between a user and an assistant.\n\n"
|
||||
|
@ -4,11 +4,12 @@ The following fields may be defined:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `name` | The character's name. |
|
||||
| `name` or `bot` | The character's name. |
|
||||
| `your_name` or `user` (optional) | Your name. This overwrites what you had previously written in the `Your name` field in the interface. |
|
||||
| `context` | A string that appears at the top of the prompt. It usually contains a description of the character's personality. |
|
||||
| `greeting` (optional) | The character's opening message when a new conversation is started. |
|
||||
| `example_dialogue` (optional) | A few example messages to guide the model. |
|
||||
| `your_name` (optional) | Your name. This overwrites what you had previously written in the `Your name` field in the interface. |
|
||||
| `turn_template` (optional) | Used to define where the spaces and new line characters should be in Instruct mode. See the characters in `characters/instruction-following` for examples. |
|
||||
|
||||
#### Special tokens
|
||||
|
||||
|
@ -455,9 +455,18 @@ def load_character(character, name1, name2, mode):
|
||||
|
||||
file_contents = open(filepath, 'r', encoding='utf-8').read()
|
||||
data = json.loads(file_contents) if extension == "json" else yaml.safe_load(file_contents)
|
||||
name2 = data['name'] if 'name' in data else data['char_name']
|
||||
if 'your_name' in data and data['your_name'] != '':
|
||||
name1 = data['your_name']
|
||||
|
||||
# Finding the bot's name
|
||||
for k in ['name', 'bot', '<|bot|>', 'char_name']:
|
||||
if k in data and data[k] != '':
|
||||
name2 = data[k]
|
||||
break
|
||||
|
||||
# Find the user name (if any)
|
||||
for k in ['your_name', 'user', '<|user|>']:
|
||||
if k in data and data[k] != '':
|
||||
name1 = data[k]
|
||||
break
|
||||
else:
|
||||
name1 = shared.settings['name1']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user