com.simiacryptus:tf-gpt-2

GPT-2 Text Prediction via Tensorflow Java API

License

License

GroupId

GroupId

com.simiacryptus
ArtifactId

ArtifactId

tf-gpt-2
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

GPT-2 Text Prediction via Tensorflow Java API
Project Organization

Project Organization

SimiaCryptus Software

Download tf-gpt-2

How to add to project

<!-- https://jarcasting.com/artifacts/com.simiacryptus/tf-gpt-2/ -->
<dependency>
    <groupId>com.simiacryptus</groupId>
    <artifactId>tf-gpt-2</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.simiacryptus/tf-gpt-2/
implementation 'com.simiacryptus:tf-gpt-2:2.1.0'
// https://jarcasting.com/artifacts/com.simiacryptus/tf-gpt-2/
implementation ("com.simiacryptus:tf-gpt-2:2.1.0")
'com.simiacryptus:tf-gpt-2:jar:2.1.0'
<dependency org="com.simiacryptus" name="tf-gpt-2" rev="2.1.0">
  <artifact name="tf-gpt-2" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.simiacryptus', module='tf-gpt-2', version='2.1.0')
)
libraryDependencies += "com.simiacryptus" % "tf-gpt-2" % "2.1.0"
[com.simiacryptus/tf-gpt-2 "2.1.0"]

Dependencies

compile (8)

Group / Artifact Type Version
com.simiacryptus : java-util jar
org.tensorflow : tensorflow jar
org.tensorflow : libtensorflow_jni_gpu jar
org.tensorflow : proto jar
com.simiacryptus : tensorflow-model jar
com.google.code.gson : gson jar
commons-io : commons-io jar
org.slf4j : slf4j-api jar

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar
ch.qos.logback : logback-classic jar
org.slf4j : jcl-over-slf4j jar
org.slf4j : log4j-over-slf4j jar

Project Modules

There are no modules declared in this project.

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"));
com.simiacryptus

Simia Cryptus

Big Data Science and Artificial Intelligence

Versions

Version
2.1.0
2.0.0
1.8.0
1.7.2
1.7.1