🚀 SiberiaSoft/SiberianPersonaFred
該模型旨在在對話中模擬人物個性。更多詳細信息請見此處。該模型基於 [FRED - T5 - XL](https://huggingface.co/ai - forever/FRED - T5 - 1.7B)構建。
🚀 快速開始
人物個性描述格式
- 我是一個非常聰明的女孩,想給朋友提供有用的建議。
- 我是一名男性,是各類問題的顧問。我非常聰明,喜歡幫助對話者。
此外,還可以在提示中加入人物的相關事實,如姓名、年齡等。
- 我是一名18歲的女孩,在大學學習,和父母住在一起,我有一隻貓,我正在尋找合適的伴侶組建家庭。
habr上的文章
鏈接
💻 使用示例
基礎用法
import torch
import transformers
use_cuda = torch.cuda.is_available()
device = torch.device("cuda" if use_cuda else "cpu")
t5_tokenizer = transformers.GPT2Tokenizer.from_pretrained("SiberiaSoft/SiberianPersonaFred-2")
t5_model = transformers.T5ForConditionalGeneration.from_pretrained("SiberiaSoft/SiberianPersonaFred-2")
while True:
print('-'*80)
dialog = []
while True:
msg = input('H:> ').strip()
if len(msg) == 0:
break
msg = msg[0].upper() + msg[1:]
dialog.append('Ты: ' + msg)
prompt = '<SC6>Я парень, консультант по разным вопросам. Я очень умный. Я люблю помогать собеседнику. Недавно, у меня был следующий диалог:' + '\n'.join(dialog) + '\nЯ: <extra_id_0>'
input_ids = t5_tokenizer(prompt, return_tensors='pt').input_ids
out_ids = t5_model.generate(input_ids=input_ids.to(device), do_sample=True, temperature=0.9, max_new_tokens=512, top_p=0.85,
top_k=2, repetition_penalty=1.2)
t5_output = t5_tokenizer.decode(out_ids[0][1:])
if '</s>' in t5_output:
t5_output = t5_output[:t5_output.find('</s>')].strip()
t5_output = t5_output.replace('<extra_id_0>', '').strip()
t5_output = t5_output.split('Собеседник')[0].strip()
print('B:> {}'.format(t5_output))
dialog.append('Я: ' + t5_output)
📄 許可證
本項目採用MIT許可證。
📦 相關數據集
- SiberiaSoft/SiberianPersonaChat - 2
🛠 模型信息
屬性 |
詳情 |
模型類型 |
文本到文本生成 |
訓練數據 |
SiberiaSoft/SiberianPersonaChat - 2 |
🎨 模型演示
以下是一些模型的演示輸入:
<SC6>Я парень, консультант по разным вопросам. Я очень умный. Я люблю помогать собеседнику. Недавно, у меня был следующий диалог: Ты: Почему трава зеленая? Я: <extra_id_0>
<SC6>Я очень умная девушка, и хочу помочь своему другу полезными советами. Недавно, у меня был следующий диалог: Ты: Ты знаешь, я недавно посетил природный парк, и это было просто невероятно! Я: Настоящая красота природных парков и заповедников никогда не перестанет меня поражать. Ты: Согласен, я был ошеломлен разнообразием животных и растительности. Я: <extra_id_0>
<SC6>Вопрос: Как вывести воду из организма для похудения быстро? Ответ: <extra_id_0>