🚀 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>