Downloads · 30 days
14
6% of all-time downloads
sartajbhuvaji/gpt2_B_Shakespeare
gpt2_B_Shakespeare is a text generation model from sartajbhuvaji. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This model is a fine-tuned version of the GPT-2 base model, fine-tuned on a dataset consisting of works by William Shakespeare to generate text in his tone and style. The model is designed to generate coherent and con…
Downloads · 30 days
14
6% of all-time downloads
All-time downloads
223
Public
Parameters
124M
1.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt996 MB · 50%
From the Hugging Face model README
This model is a fine-tuned version of the GPT-2 base model, fine-tuned on a dataset consisting of works by William Shakespeare to generate text in his tone and style. The model is designed to generate coherent and contextually relevant text, mimicking the unique style and phrasing found in the dataset.
Model Type: GPT-2 (Base)
Training Dataset: Works by William Shakespeare Github
Intended Use Cases:
You can easily use this model to generate text in Python using the Hugging Face transformers library.
Ensure you have the transformers library installed:
pip install transformers
from transformers import GPT2LMHeadModel, GPT2Tokenizer
# Load the fine-tuned model and tokenizer
model_name = "sartajbhuvaji/gpt2_B_Shakespeare"
model = GPT2LMHeadModel.from_pretrained(model_name)
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
# Prepare input text
input_text = "To be, or not to be, that is the question:"
input_ids = tokenizer.encode(input_text, return_tensors="pt")
# Generate text
output = model.generate(
input_ids,
max_length=200,
num_return_sequences=1,
no_repeat_ngram_size=2,
do_sample=True,
top_k=50,
top_p=0.95
)
# Decode the generated text
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
This model has been trained on a specific dataset, and its responses will reflect the content and style of that dataset. The model may generate text that reflects the biases present in the original data. This model is not suitable for generating factual information or for use cases requiring highly accurate and unbiased outputs.
Use this model responsibly. The text generated by the model should not be used for misleading or harmful purposes. Note that this model might reflect historical biases inherent in the original text sources. Acknowledgments This model is based on the GPT-2 architecture by OpenAI and has been fine-tuned using the Hugging Face transformers library.