资源算法gluonnlp-gpt2

gluonnlp-gpt2

2020-03-03 | |  42 |   0 |   0

GPT2 Generator Demo in GluonNLP

First, you need to convert the pretrained models in openai/gpt-2 to GluonNLP

Step-1: Download the pretrained models provided by OpenAI.

git clone https://github.com/openai/gpt-2.git cd gpt-2 python download_model.py 117M python download_model.py 345M cd ..

Step-2: Convert the model to GluonNLP (Make sure the current directory is gluonnlp-gpt2)

python gpt2_tf_to_gluonnlp.py --src_dir gpt-2/models --dst_dir models --model 117M python gpt2_tf_to_gluonnlp.py --src_dir gpt-2/models --dst_dir models --model 345M

Step-3: Test the correctness of the pretrained models:

nosetests3 test_transform.py python test_model.py

Step-4: Try the generation demo

For the conditional generator, use the following command

python sampling_demo.py --model 117M

For the unconditional generator, use the following command

python sampling_demo.py --model 117M --unconditional

You can also try the large model with 345M parameters

python sampling_demo.py --model 345M python sampling_demo.py --model 345M --unconditional

Dependencies

mxnet gluonnlp regex tensorflow


上一篇: gpt-2-withdata

下一篇:gpt2colab-js

用户评价
全部评价

热门资源

  • TensorFlow-Course

    This repository aims to provide simple and read...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • mxnet_VanillaCNN

    This is a mxnet implementation of the Vanilla C...

  • DuReader_QANet_BiDAF

    Machine Reading Comprehension on DuReader Usin...

  • Klukshu-Sockeye-...

    KLUKSHU SOCKEYE PROJECTS 2016 This repositor...