资源算法tf-gpt-2

tf-gpt-2

2020-03-03 | |  77 |   0 |   0

tf-gpt-2

Java library for the GPT-2 Text Model using Tensorflow

Source:

  1. Original Python Release

  2. OpenAI Blog - GPT2 Details

More Background:

  1. Transformers and Attention Models

Basic Usage

Import the Library

<dependency>
    <groupId>com.simiacryptus</groupId>
    <artifactId>tf-gpt-2</artifactId>
    <version>1.7.1</version>
</dependency>

Instantiate the text generator

import com.simiacryptus.text.TextGenerator;import com.simiacryptus.text.gpt2.GPT2Util;TextGenerator textGenerator = GPT2Util.get345M();

Generate text

System.out.println(textGenerator.generateText(500));

Generate text given prefix

System.out.println(textGenerator.generateText(500, "Once upon a time"));


上一篇:gpt-2-haiku

下一篇:gpt2-nim

用户评价
全部评价

热门资源

  • TensorFlow-Course

    This repository aims to provide simple and read...

  • seetafaceJNI

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

  • mxnet_VanillaCNN

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

  • vsepp_tensorflow

    Improving Visual-Semantic Embeddings with Hard ...

  • DuReader_QANet_BiDAF

    Machine Reading Comprehension on DuReader Usin...