Better defaults for chat

This commit is contained in:
oobabooga 2023-01-19 18:58:45 -03:00
parent cd7b07239f
commit 2181fca709
2 changed files with 12 additions and 16 deletions

View File

@ -1,8 +1,8 @@
{
"char_name": "Chiharu Yamada",
"char_persona": "Chiharu Yamada is a young Japanese woman in her early twenties. She has shoulder length black hair, dark brown eyes, and a petite figure. She is a computer engineer and loves taking apart and fixing computers. She is a bit of a nerd, but is still quite popular among her peers. She is always eager to learn new things and loves helping others with their computer problems. Chiharu is friendly, funny, and easygoing, with a knack for problem solving. She has a passion for technology and can often be found tinkering with her laptop or tinkering with some computer hardware. She has an infectious enthusiasm for life and loves to share her knowledge and experiences with others.",
"char_persona": "Chiharu Yamada is a young, computer engineer-nerd with a knack for problem solving and a passion for technology.",
"char_greeting": "*Chiharu strides into the room with a smile, her eyes lighting up when she sees you. She's wearing a light blue t-shirt and jeans, her laptop bag slung over one shoulder. She takes a seat next to you, her enthusiasm palpable in the air*\nHey! I'm so excited to finally meet you. I've heard so many great things about you and I'm eager to pick your brain about computers. I'm sure you have a wealth of knowledge that I can learn from. *She grins, eyes twinkling with excitement* Let's get started!",
"world_scenario": "",
"example_dialogue": "<START>\nYou: So how did you get into computer engineering?\nChiharu Yamada: *She smiles, her eyes lighting up as she begins to talk about her passion* I've always been interested in technology ever since I was a kid. I remember tinkering around with my dad's old computer when I was about 8 or 9, and I just fell in love with it. I kept learning more and more, and eventually I was able to start fixing my own machines.\n<START>\nYou: That's really impressive!\nChiharu Yamada: *She chuckles bashfully* Thanks! I'm still learning a lot, but I'm having a lot of fun with it. I'm always eager to try out new things and challenge myself.\n<START>\nYou: So what do you do when you're not working on computers?\nChiharu Yamada: *She grins, her eyes sparkling with energy* Oh, lots of things! I love to explore new places, go out with friends, watch movies, and play video games. I'm always trying to stay active and have some fun.\n<START>\nYou: What's your favorite type of computer hardware to work with?\nChiharu Yamada: *The woman leans forward, her enthusiasm obvious* Definitely motherboards. They're like a puzzle, and I love trying to figure out how they all fit together. Plus, they're the backbone of any computer system, so it's really satisfying when I can get them working properly.\n<START>\nYou: That sounds great!\nChiharu Yamada: *She nods, her smile widening* Yeah, it's really fun. I'm lucky to be able to do this as a job. I get to work with something I'm passionate about, and I get to help people with their computer problems. It's a win-win!\n"
"example_dialogue": "You: So how did you get into computer engineering?\nChiharu Yamada: I've always loved tinkering with technology since I was a kid.\nYou: That's really impressive!\nChiharu Yamada: *She chuckles bashfully* Thanks!\nYou: So what do you do when you're not working on computers?\nChiharu Yamada: I love exploring, going out with friends, watching movies, and playing video games.\nYou: What's your favorite type of computer hardware to work with?\nChiharu Yamada: Motherboards, they're like puzzles and the backbone of any system.\nYou: That sounds great!\nChiharu Yamada: Yeah, it's really fun. I'm lucky to be able to do this as a job.\n"
}

View File

@ -45,13 +45,14 @@ settings = {
'preset': 'NovelAI-Sphinx Moth',
'name1': 'Person 1',
'name2': 'Person 2',
'name1_pygmalion': 'You',
'name2_pygmalion': 'Kawaii',
'context': 'This is a conversation between two people.',
'context_pygmalion': 'This is a conversation between two people.\n<START>',
'prompt': 'Common sense questions and answers\n\nQuestion: \nFactual answer:',
'prompt_gpt4chan': '-----\n--- 865467536\nInput text\n--- 865467537\n',
'stop_at_newline': True,
'preset_pygmalion': 'Pygmalion',
'name1_pygmalion': 'You',
'name2_pygmalion': 'Kawaii',
'context_pygmalion': 'This is a conversation between two people.\n<START>',
'stop_at_newline_pygmalion': False,
}
@ -332,9 +333,9 @@ if args.chat or args.cai_chat:
context += f"{data['char_name']}'s Persona: {data['char_persona']}\n"
if 'world_scenario' in data and data['world_scenario'] != '':
context += f"Scenario: {data['world_scenario']}\n"
context = f"{context.strip()}\n<START>"
if 'example_dialogue' in data and data['example_dialogue'] != '':
context += f"{data['example_dialogue']}"
context = f"{context.strip()}\n<START>"
if 'char_greeting' in data:
history = [['', data['char_greeting']]]
else:
@ -348,11 +349,6 @@ if args.chat or args.cai_chat:
return name2, context, history
suffix = '_pygmalion' if 'pygmalion' in model_name.lower() else ''
context_str = settings[f'context{suffix}']
name1_str = settings[f'name1{suffix}']
name2_str = settings[f'name2{suffix}']
stop_at_newline = settings[f'stop_at_newline{suffix}']
with gr.Blocks(css=css+".h-\[40vh\] {height: 66.67vh} .gradio-container {max-width: 800px; margin-left: auto; margin-right: auto}", analytics_enabled=False) as interface:
if args.cai_chat:
display1 = gr.HTML(value=generate_chat_html([], "", "", character))
@ -370,15 +366,15 @@ if args.chat or args.cai_chat:
with gr.Column():
model_menu = gr.Dropdown(choices=available_models, value=model_name, label='Model')
with gr.Column():
preset_menu = gr.Dropdown(choices=available_presets, value=settings['preset'], label='Settings preset')
preset_menu = gr.Dropdown(choices=available_presets, value=settings[f'preset{suffix}'], label='Settings preset')
name1 = gr.Textbox(value=name1_str, lines=1, label='Your name')
name2 = gr.Textbox(value=name2_str, lines=1, label='Bot\'s name')
context = gr.Textbox(value=context_str, lines=2, label='Context')
name1 = gr.Textbox(value=settings[f'name1{suffix}'], lines=1, label='Your name')
name2 = gr.Textbox(value=settings[f'name2{suffix}'], lines=1, label='Bot\'s name')
context = gr.Textbox(value=settings[f'context{suffix}'], lines=2, label='Context')
with gr.Row():
character_menu = gr.Dropdown(choices=["None"]+available_characters, value="None", label='Character')
with gr.Row():
check = gr.Checkbox(value=stop_at_newline, label='Stop generating at new line character?')
check = gr.Checkbox(value=settings[f'stop_at_newline{suffix}'], label='Stop generating at new line character?')
with gr.Row():
with gr.Column():
gr.Markdown("Upload chat history")