이 저장소는 캐릭터와 사용자 간의 합성 대화를 수집하는 데 도움이됩니다. 이 파이프 라인은 OpenAI 또는 Custom ISVC를 포함한 다양한 모델 제공 업체를 지원합니다.
이 저장소를 별표 :
포옹 페이스 데이터 세트 :
이 프로젝트로 데이터 세트를 만들었다면 여기에 귀하의 것을 추가하게되어 기쁩니다.
합성 데이터 세트 생성 파이프 라인은 두 가지 주요 부분으로 구성됩니다.
문자 프로파일을 생성하기 위해 OpenAI의 gpt-3.5-turbo 사용할 수 있습니다. 우리는 여기서 특별한 것을 생성하지 않기 때문에 중재에 대해 걱정할 수 없습니다 (좋은 씨앗을 만들면).
스크립트를 실행하려면 다음을 수행 할 수 있습니다.
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 사용자는 Openai의 gpt-3.5-turbo 대신 Vicuña의 세대를 선호합니다. 그러나 gpt-3.5-turbo 또는 gpt4 를 사용할 수 있습니다. 링크를 살펴보십시오.
확장 봇 빌더를 사용할 것입니다. 샘플 코드는 다음과 같습니다.
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. "
}
]
}봇 빌더와 함께 템플릿과 씨앗을 사용합니다. 모든 모델과 프롬프터는 동일한 API를 공유하므로 (예를 들어 OpenAI로) 변경하거나 새로운 프롬프터 또는 모델로 확장하기가 매우 쉽습니다. 이 config.py를 살펴보십시오.
config.py에서 씨앗과 템플릿을 준비하자마자 준비가 준비되었습니다.
cd experiments/topic_experts
python3 main.py --config_path romantic/config.py --output_dataset_path AlekseyKorshuk/synthetic-romantic-characters