Downloads · 30 days
6
35% of all-time downloads
rohan-s/AIKipling
AIKipling is a machine learning model from rohan-s. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a GPT-2 model fine-tuned on the works of Rudyard Kipling, designed to generate text in his unique literary style. The model can be used for generating Kipling-inspired prose, poetry, or creati…
Downloads · 30 days
6
35% of all-time downloads
All-time downloads
17
Public
Parameters
124M
498 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors498 MB · 100%
From the Hugging Face model README
This repository contains a GPT-2 model fine-tuned on the works of Rudyard Kipling, designed to generate text in his unique literary style. The model can be used for generating Kipling-inspired prose, poetry, or creative writing.
| File Name | Purpose |
|---|---|
model.safetensors | Model weights (replaces pytorch_model.bin in newer versions). |
tokenizer_config.json | Configuration for the tokenizer (e.g., padding, truncation settings). |
vocab.json | Vocabulary file for the tokenizer. |
merges.txt | BPE merge rules (used by GPT-2's tokenizer). |
special_tokens_map.json | Defines special tokens. |
config.json | Model architecture configuration (layers, heads, etc.). |
generation_config.json | Default text-generation settings (temperature, top-k, etc.). |
training_args.bin | Training arguments (optional, not needed for inference). |
.DS_Store | (Ignore) macOS metadata file. |
You can load the fine-tuned model using the following code:
from transformers import GPT2LMHeadModel, GPT2Tokenizer
# Load the fine-tuned model and tokenizer
model = GPT2LMHeadModel.from_pretrained("path_to_model_directory")
tokenizer = GPT2Tokenizer.from_pretrained("path_to_model_directory")
# Example prompt
prompt = "If you can keep your head when all about you"
inputs = tokenizer(prompt, return_tensors="pt")
# Generate text
outputs = model.generate(
inputs["input_ids"],
max_length=100,
num_return_sequences=1,
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.9
)
# Print generated text
print(tokenizer.decode(outputs[0], skip_special_tokens=True))