Edit model card

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
35
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.