يساعد هذا المستودع في جمع المحادثة الاصطناعية بين الحرف والمستخدم. يدعم خط الأنابيب هذا مزودي النماذج المختلفين بما في ذلك Openai أو ISVC المخصص.
نجم هذا المستودع:
مجموعات بيانات Huggingface:
إذا قمت بإنشاء مجموعة بيانات مع هذا المشروع ، يسعدني إضافة لك هنا.
يتكون خط أنابيب توليد مجموعة البيانات الاصطناعية من جزأين رئيسيين:
لإنشاء ملفات تعريف الشخصية ، يمكننا استخدام gpt-3.5-turbo من Openai. نظرًا لأننا لن ننشئ أي شيء خاص هنا ، لا يمكننا القلق بشأن الاعتدال (فقط إنشاء بذور جيدة).
لتشغيل البرنامج النصي ، يمكننا القيام بما يلي:
cd experiments/character_profiles
python3 main.py --config_path ./experiments/topic_experts/romance/config.yamlنتيجة لذلك ، يمكننا الحصول على شخصيات مثل هذا:
{
"bot_name" : " Kiriko (quiet girl in class) " ,
"personalities" : " shy, honest, sweet, she is sure to comment on all things beautiful if she can get over her shyness " ,
"categories" : " romance, school, urban-grounded "
} يمكن إجراء هذه المرحلة من خط الأنابيب مع أي مزود سحابة مع تغييرات طفيفة. يفضل مستخدمو Chai أجيال Vicuña بدلاً من gpt-3.5-turbo من Openai. ولكن يمكنك استخدام gpt-3.5-turbo أو gpt4 ، ألق نظرة على هذا المثال: Link.
سوف نستخدم منشئ بوت الممتد. قد يبدو هذا الرمز مثل هذا:
import os
from role_play_synthetic . generator . base import Generator
from role_play_synthetic . models . chai_isvc import ChaiISVCModel
from role_play_synthetic . prompters . vicuna_v1 import VicunaV1Prompter
from role_play_synthetic . prompters . seed import Seed
from experiments . vicuna . config import (
seeds ,
description_template ,
first_message_template ,
user_message_template ,
character_message_template ,
)
ENDPOINT_URL = os . getenv ( "ENDPOINT_URL" )
DEFAULT_GENERATION_PARAMS = {
'temperature' : 0.9 ,
'top_p' : 1 ,
'top_k' : 40 ,
'frequency_penalty' : 0. ,
'presence_penalty' : 0.1
}
model = ChaiISVCModel ( endpoint_url = ENDPOINT_URL )
prompter = VicunaV1Prompter (
description_template = description_template ,
first_message_template = first_message_template ,
user_message_template = user_message_template ,
character_message_template = character_message_template ,
)
generator = Generator ( prompter = prompter , model = model )
inputs = Seed (
name = "Professor Quantum (Time Travelling Scientist)" ,
categories = [ 'sci-fi' , 'time-travel' , 'mystery' , 'role-play' ],
personalities = [ 'intelligent' , 'eccentric' , 'enthusiastic' , 'always carrying a pocket watch' , 'quirky' ],
is_input = True
)
character = generator . generate ( seeds = seeds , input_seed = inputs , generation_params = DEFAULT_GENERATION_PARAMS )
print ( character . to_dict ())الإخراج:
{
"name" : " Professor Quantum (Time Travelling Scientist) " ,
"categories" : [
" sci-fi " ,
" time-travel " ,
" mystery " ,
" role-play "
],
"personalities" : [
" intelligent " ,
" eccentric " ,
" enthusiastic " ,
" always carrying a pocket watch " ,
" quirky "
],
"description" : " Professor Quantum, the eccentric time traveler, has spent his life studying the mysteries of time and reality. His enthusiasm and intelligence shine through as he discusses the intricacies of his groundbreaking theories. Constantly carrying a pocket watch, he delights in the unexpected twists and turns that time travel brings, always eager to explore the unknown. " ,
"conversation" : [
{
"role" : " character " ,
"content" : " *Professor Quantum taps his pocket watch, a smile spreading across his face.* The past is a strange place... let's see where it takes us. "
},
{
"role" : " user " ,
"content" : " *I nod eagerly* Professor Quantum, lead the way! "
},
{
"role" : " character " ,
"content" : " *Professor Quantum pulls out a glowing blue orbs, and points it at the time and space.* Quantum Leap, activate! "
},
{
"role" : " user " ,
"content" : " *I feel a strange sensation as I am transported through time and space* Wow, is this really happening? "
},
{
"role" : " character " ,
"content" : " *The Professor nods, a mischievous twinkle in his eye.* It sure is! Now, let's see where we end up! "
},
{
"role" : " user " ,
"content" : " *I look around* Where are we? This doesn't look like any time or place I've ever seen. "
},
{
"role" : " character " ,
"content" : " *The Professor grins, his eyes sparkling.* That's the beauty of time travel! The possibilities are endless. Let's see what adventures await us in this new time and place. "
}
]
}نحن نستخدم القوالب والبذور للعمل مع بوت بوت. تشترك جميع النماذج والمقدمون في نفس واجهة برمجة التطبيقات ، لذلك من السهل جدًا تغييرها (إلى Openai على سبيل المثال) أو تمديدها مع Prodpters أو النماذج الجديدة. ألق نظرة على هذا config.py.
بمجرد أن أعدنا البذور والقوالب في config.py ، نحن على استعداد جيل البداية:
cd experiments/topic_experts
python3 main.py --config_path romantic/config.py --output_dataset_path AlekseyKorshuk/synthetic-romantic-characters