Based on
Randeng-T5-77M
, we fine-tuned it on a collection of 100+ multitasking datasets in Chinese domains (from which 30w+ samples were sampled) to obtain this multitasking version. These multitasks include: sentiment analysis, news classification, text classification, intention recognition, natural language inference, multiple choice, denotational disambiguation, extractive reading comprehension, entity recognition, keyword extraction, and generative summarization.
使用 Usage
import torch
from transformers import T5Tokenizer, T5Config, T5ForConditionalGeneration
# load tokenizer and model
pretrained_model = "IDEA-CCNL/Randeng-T5-77M-MultiTask-Chinese"
special_tokens = ["<extra_id_{}>".format(i) for i inrange(100)]
tokenizer = T5Tokenizer.from_pretrained(
pretrained_model,
do_lower_case=True,
max_length=512,
truncation=True,
additional_special_tokens=special_tokens,
)
config = T5Config.from_pretrained(pretrained_model)
model = T5ForConditionalGeneration.from_pretrained(pretrained_model, config=config)
model.resize_token_embeddings(len(tokenizer))
model.eval()
# tokenize
text = "情感分析任务:【房间还是比较舒适的,酒店服务良好】这篇文章的情感态度是什么?正面/负面"
encode_dict = tokenizer(text, max_length=512, padding='max_length',truncation=True)
inputs = {
"input_ids": torch.tensor([encode_dict['input_ids']]).long(),
"attention_mask": torch.tensor([encode_dict['attention_mask']]).long(),
}
# generate answer
logits = model.generate(
input_ids = inputs['input_ids'],
max_length=100,
early_stopping=True,
)
logits=logits[:,1:]
predict_label = [tokenizer.decode(i,skip_special_tokens=True) for i in logits]
print(predict_label)
# model output: 正面
除了分类任务,其他任务的数据构造例子如下:
In addition to classification tasks, data construction examples of other tasks are as follows:
If you want to pre train the Randeng T5 model or fine tune the Randeng model in your downstream tasks, welcome to use [Fengshenbang LM](
https://github.com/IDEA-CCNL/Fengshenbang-LM/
)A complete example of the project is provided here:
If you are using the resource for your work, please cite the our
paper
:
@article{fengshenbang,
author = {Jiaxing Zhang and Ruyi Gan and Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen},
title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
journal = {CoRR},
volume = {abs/2209.02970},
year = {2022}
}
Randeng-T5-77M-MultiTask-Chinese huggingface.co is an AI model on huggingface.co that provides Randeng-T5-77M-MultiTask-Chinese's model effect (), which can be used instantly with this IDEA-CCNL Randeng-T5-77M-MultiTask-Chinese model. huggingface.co supports a free trial of the Randeng-T5-77M-MultiTask-Chinese model, and also provides paid use of the Randeng-T5-77M-MultiTask-Chinese. Support call Randeng-T5-77M-MultiTask-Chinese model through api, including Node.js, Python, http.
Randeng-T5-77M-MultiTask-Chinese huggingface.co is an online trial and call api platform, which integrates Randeng-T5-77M-MultiTask-Chinese's modeling effects, including api services, and provides a free online trial of Randeng-T5-77M-MultiTask-Chinese, you can try Randeng-T5-77M-MultiTask-Chinese online for free by clicking the link below.
IDEA-CCNL Randeng-T5-77M-MultiTask-Chinese online free url in huggingface.co:
Randeng-T5-77M-MultiTask-Chinese is an open source model from GitHub that offers a free installation service, and any user can find Randeng-T5-77M-MultiTask-Chinese on GitHub to install. At the same time, huggingface.co provides the effect of Randeng-T5-77M-MultiTask-Chinese install, users can directly use Randeng-T5-77M-MultiTask-Chinese installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Randeng-T5-77M-MultiTask-Chinese install url in huggingface.co: