Downloads · 30 days
22
0% of all-time downloads
ashiqabdulkhader/GPT2-Poet
GPT2-Poet is a text generation model from ashiqabdulkhader. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as bigscience-bloom-rail-1.0.
GPT2-Poet is a GPT-2 transformer model fine Tuned on a large corpus of English Poems dataset in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way w…
Downloads · 30 days
22
0% of all-time downloads
All-time downloads
7.5K
Public
Repo size
498 MB
Likes
4
Public
Click a slice to open those files.
.h5498 MB · 100%
From the Hugging Face model README
GPT2-Poet is a GPT-2 transformer model fine Tuned on a large corpus of English Poems dataset in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.
This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks.
You can use the raw model for text generation or fine-tune it to a downstream task. See the model hub to look for fine-tuned versions on a task that interests you.
You can use this model for English Poem generation:
>>> from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
>>> tokenizer = GPT2Tokenizer.from_pretrained("ashiqabdulkhader/GPT2-Poet")
>>> model = TFGPT2LMHeadModel.from_pretrained("ashiqabdulkhader/GPT2-Poet")
>>> text = "The quick brown fox"
>>> input_ids = tokenizer.encode(text, return_tensors='tf')
>>> sample_outputs = model.generate(
input_ids,
do_sample=True,
max_length=100,
top_k=0,
top_p=0.9,
temperature=1.0,
num_return_sequences=3
)
>>> print("Output:", tokenizer.decode(sample_outputs[0], skip_special_tokens=True))