Downloads · 30 days
5
15% of all-time downloads
thetobysiu/gpt2-witcher-books
gpt2-witcher-books is a text generation model from thetobysiu. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
A GPT-2 Medium model fine-tuned on text from The Witcher book series by Andrzej Sapkowski for creative text generation in a dark fantasy style.
Downloads · 30 days
5
15% of all-time downloads
All-time downloads
33
Public
Repo size
1.4 GB
Likes
0
Public
Click a slice to open those files.
.bin1.4 GB · 100%
From the Hugging Face model README
A GPT-2 Medium model fine-tuned on text from The Witcher book series by Andrzej Sapkowski for creative text generation in a dark fantasy style.
This model is part of the Deepstory project, which combines Natural Language Generation, Text-to-Speech, and animation technologies to create interactive storytelling experiences.
The model has been fine-tuned on The Witcher novels to generate text that captures the narrative style, vocabulary, and themes of the original books.
This model is based on GPT-2 Medium architecture.
| Parameter | Value |
|---|---|
| Architecture | GPT2LMHeadModel |
| Model Size | GPT-2 Medium |
| Number of Layers (n_layer) | 24 |
| Hidden Size (n_embd) | 1024 |
| Attention Heads (n_head) | 16 |
| Context Length (n_ctx) | 1024 |
| Max Positions (n_positions) | 1024 |
| Vocabulary Size | 50,257 |
| Activation Function | GELU (new) |
| Attention Dropout | 0.1 |
| Embedding Dropout | 0.1 |
| Residual Dropout | 0.1 |
| Layer Norm Epsilon | 1e-05 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
import torch
# Load model and tokenizer
tokenizer = GPT2Tokenizer.from_pretrained("thetobysiu/gpt2-witcher-books")
model = GPT2LMHeadModel.from_pretrained("thetobysiu/gpt2-witcher-books")
# Generate text
prompt = "The witcher drew his silver sword and"
input_ids = tokenizer.encode(prompt, return_tensors='pt')
output = model.generate(
input_ids=input_ids,
max_length=150,
temperature=0.9,
top_p=0.95,
top_k=50,
do_sample=True,
num_return_sequences=1
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
For best results, we recommend the following generation parameters:
| Parameter | Recommended Value | Description |
|---|---|---|
| temperature | 0.7 - 1.0 | Higher values = more creative |
| top_p | 0.9 - 0.95 | Nucleus sampling threshold |
| top_k | 40 - 50 | Top-k sampling |
| max_length | 100 - 300 | Maximum tokens to generate |
| do_sample | True | Enable sampling |
The model was fine-tuned on text from The Witcher book series, including:
The model was fine-tuned using the Hugging Face Transformers library starting from the pre-trained GPT-2 Medium checkpoint.
This model is intended for:
If you use this model, please cite the Deepstory project:
@misc{deepstory,
author = {Siu King Wai},
title = {Deepstory},
year = {2020},
publisher = {GitHub},
url = {https://github.com/thetobysiu/deepstory}
}
This model is released under the MIT License. Please note that The Witcher series is the intellectual property of Andrzej Sapkowski and CD Projekt.