13 Star 61 Fork 279

Ascend/ModelZoo-TensorFlow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

乐府

Table Of Contents

Description

Yuefu is proposed by Huawei’s Noah’s Ark. It proposes a method for generating ancient Chinese poetry based on the GPT model. It uses large-scale Chinese news corpus training to obtain a Chinese GPT model, and collects a large number of ancient Chinese poems, words, and couplets in a specific format. After sorting, and then inputting the sorted data into the GPT model for fine-tune, a high-quality ancient poetry generation system is obtained.

Reference paper: Yi Liao, Yasheng Wang, Qun Liu, Xin Jiang: “GPT-based Generation for Classical Chinese Poetry”, 2019

Requirements

  • Prepare python environment and yuefu checkopint.

Quick start guide

Key configuration changes

Before starting the training, first configure the environment variables related to the program running. For environment variable configuration information, see:

Running the example

Evaluation

Set the checkpoint path, the default is ModelZoo_Yuefu_TF/

Set main_1p.sh, configuration parameters for non-distributed training of Transformer model.

max_decode_len: the maximum generation length, the default setting is 80

Title: Enter the subject of the poetry you want to generate

Type: Enter the subject of the poetry you want to generate, including five-character quatrain poetry, five-character quatrain, seven-character quatrain, seven-character quatrain

export JOB_ID=10086
export DEVICE_ID=3
export RANK_ID=0
export RANK_SIZE=1
export RANK_TABLE_FILE=${dir}/device_table_1p.json
export USE_NPU=True
export POETRY_TYPE=-1
export max_decode_len=80
python3 poetry_v2.py --title="Mid-Autumn Festival" --type="Seven Words Quatrains"
  • Set options in main_1p.sh, including max_decode_len and other hyperparameters,Run the script:

    sh main_1p.sh
    
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend/ModelZoo-TensorFlow.git
git@gitee.com:ascend/ModelZoo-TensorFlow.git
ascend
ModelZoo-TensorFlow
ModelZoo-TensorFlow
master

搜索帮助