shibing624 / t5-chinese-couplet

huggingface.co
Total runs: 29
24-hour runs: 5
7-day runs: -5
30-day runs: 1
Model's Last Updated: Bước đều 28 2023
text2text-generation

Introduction of t5-chinese-couplet

Model Details of t5-chinese-couplet

T5 for Chinese Couplet(t5-chinese-couplet) Model

T5中文对联生成模型

t5-chinese-couplet evaluate couplet test data:

The overall performance of T5 on couplet test :

prefix input_text target_text pred
对联: 春回大地,对对黄莺鸣暖树 日照神州,群群紫燕衔新泥 福至人间,家家紫燕舞和风

在Couplet测试集上生成结果满足字数相同、词性对齐、词面对齐、形似要求,而语义对仗工整和平仄合律还不满足。

T5的网络结构(原生T5):

arch

Usage

本项目开源在文本生成项目: textgen ,可支持T5模型,通过如下命令调用:

Install package:

pip install -U textgen
from textgen import T5Model
model = T5Model("t5", "shibing624/t5-chinese-couplet")
r = model.predict(["对联:丹枫江冷人初去"])
print(r) # ['白石矶寒客不归']
Usage (HuggingFace Transformers)

Without textgen , you can use the model like this:

First, you pass your input through the transformer model, then you get the generated sentence.

Install package:

pip install transformers 
from transformers import T5ForConditionalGeneration, T5Tokenizer

tokenizer = T5Tokenizer.from_pretrained("shibing624/t5-chinese-couplet")
model = T5ForConditionalGeneration.from_pretrained("shibing624/t5-chinese-couplet")


def batch_generate(input_texts, max_length=64):
    features = tokenizer(input_texts, return_tensors='pt')
    outputs = model.generate(input_ids=features['input_ids'],
                             attention_mask=features['attention_mask'],
                             max_length=max_length)
    return tokenizer.batch_decode(outputs, skip_special_tokens=True)


r = batch_generate(["对联:丹枫江冷人初去"])
print(r)

output:

['白石矶寒客不归']

模型文件组成:

t5-chinese-couplet
    ├── config.json
    ├── model_args.json
    ├── pytorch_model.bin
    ├── special_tokens_map.json
    ├── tokenizer_config.json
    ├── spiece.model
    └── vocab.txt
训练数据集
中文对联数据集

数据格式:

head -n 1 couplet_files/couplet/train/in.txt
晚 风 摇 树 树 还 挺 

head -n 1 couplet_files/couplet/train/out.txt
晨 露 润 花 花 更 红 

如果需要训练T5模型,请参考 https://github.com/shibing624/textgen/blob/main/docs/%E5%AF%B9%E8%81%94%E7%94%9F%E6%88%90%E6%A8%A1%E5%9E%8B%E5%AF%B9%E6%AF%94.md

Citation
@software{textgen,
  author = {Xu Ming},
  title = {textgen: Implementation of Text Generation models},
  year = {2022},
  url = {https://github.com/shibing624/textgen},
}

Runs of shibing624 t5-chinese-couplet on huggingface.co

29
Total runs
5
24-hour runs
4
3-day runs
-5
7-day runs
1
30-day runs

More Information About t5-chinese-couplet huggingface.co Model

More t5-chinese-couplet license Visit here:

https://choosealicense.com/licenses/apache-2.0

t5-chinese-couplet huggingface.co

t5-chinese-couplet huggingface.co is an AI model on huggingface.co that provides t5-chinese-couplet's model effect (), which can be used instantly with this shibing624 t5-chinese-couplet model. huggingface.co supports a free trial of the t5-chinese-couplet model, and also provides paid use of the t5-chinese-couplet. Support call t5-chinese-couplet model through api, including Node.js, Python, http.

t5-chinese-couplet huggingface.co Url

https://huggingface.co/shibing624/t5-chinese-couplet

shibing624 t5-chinese-couplet online free

t5-chinese-couplet huggingface.co is an online trial and call api platform, which integrates t5-chinese-couplet's modeling effects, including api services, and provides a free online trial of t5-chinese-couplet, you can try t5-chinese-couplet online for free by clicking the link below.

shibing624 t5-chinese-couplet online free url in huggingface.co:

https://huggingface.co/shibing624/t5-chinese-couplet

t5-chinese-couplet install

t5-chinese-couplet is an open source model from GitHub that offers a free installation service, and any user can find t5-chinese-couplet on GitHub to install. At the same time, huggingface.co provides the effect of t5-chinese-couplet install, users can directly use t5-chinese-couplet installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

t5-chinese-couplet install url in huggingface.co:

https://huggingface.co/shibing624/t5-chinese-couplet

Url of t5-chinese-couplet

t5-chinese-couplet huggingface.co Url

Provider of t5-chinese-couplet huggingface.co

shibing624
ORGANIZATIONS

Other API from shibing624

huggingface.co

Total runs: 97
Run Growth: 12
Growth Rate: 12.37%
Updated: Tháng hai 19 2024