Giter VIP home page Giter VIP logo

coupletai's Introduction

coupletAI

参考 https://github.com/wangjiezju1988/aichpoem 实现的对对联AI

Dataset

采用 https://github.com/wb14123/couplet-dataset,包含70万首对联

需要手动去除数据集中每个字之间的空格,并合并训练集和测试集。上联保存到data/in.txt,下联保存到data/out.txt,可以到Release下载处理好的数据集

BERT Model

采用 https://github.com/ymcui/Chinese-BERT-wwm 中的预训练模型RoBERTa-wwm-ext, Chinese,模型存放到data/chinese_roberta_wwm_ext_L-12_H-768_A-12目录

Dependencies

  • tensorflow 2.X : pip install tensorflow
  • bert4keras : pip install bert4keras

Training

运行train_coupletAI.py来训练模型,如果有多张显卡,可以用多GPU版本train_coupletAI_multigpu.py加速训练

每个epoch都会保存最优的权重参数到data/best_model.weight(大小约1G),训练结束后运行save_h5.py读取最优的权重参数,保存h5文件到data/model.h5(大小约350M)

如果不想自己训练,可以到Release下载已经训练好的model.h5

Local deployment

运行api_server.py就能启动服务,通过浏览器打开 http://[::1]:11456 查看效果

coupletai's People

Contributors

llccd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.