YAML Metadata
Warning:
The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Den4ikAI/FRED-T5-XL-chitchat
Болталка на основе FRED-T5-XL. Длина контекста модели 6-8 реплик.
Пример использования
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("Den4ikAI/FRED-T5-XL-chitchat")
t5_model = transformers.T5ForConditionalGeneration.from_pretrained("Den4ikAI/FRED-T5-XL-chitchat")
while True:
print('-'*80)
dialog = []
while True:
msg = input('H:> ').strip()
if len(msg) == 0:
break
dialog.append('- ' + msg)
dialog.append('- <extra_id_0>')
input_ids = t5_tokenizer('<SC1>'+'\n'.join(dialog), return_tensors='pt').input_ids
out_ids = t5_model.generate(input_ids=input_ids,
max_length=200,
eos_token_id=t5_tokenizer.eos_token_id,
early_stopping=True,
do_sample=True,
temperature=1.0,
top_k=0,
top_p=0.85)
dialog.pop(-1)
t5_output = t5_tokenizer.decode(out_ids[0][1:]).replace('<extra_id_0>','')
if '</s>' in t5_output:
t5_output = t5_output[:t5_output.find('</s>')].strip()
print('B:> {}'.format(t5_output))
dialog.append('- '+t5_output)
Citation
@MISC{Den4ikAI/FRED-T5-XL-chitchat,
author = {Denis Petrov},
title = {Russian chitchat model},
url = {https://huggingface.co/Den4ikAI/FRED-T5-XL-chitchat},
year = 2023
}
- Downloads last month
- 9