A 124M parameter transformer model trained on Mechanicus-style prayers using the GPT-2 architecture.
Model Description
This model generates thematic prayers, blessings, and activation rites for various machines and equipment in the Mechanicus style. It produces natural prose with appropriate Mechanicus flavor (references to the Omnissiah, Machine Spirits, sacred oils, litanies, etc.).
Architecture: GPT-2 (124M parameters, trained from scratch) Training Data: 3,972 Grok-generated examples (dataset) Tokenization: Trained without bias terms, uses tiktoken encoding
Performance Metrics
Object Consistency: 86% (correctly references the machine/component from prompt)
Format Quality: 100% (natural prose, no step labels)
Overall Score: 93%
Quick Start
Installation
pip install transformers torch tiktoken
Basic Usage
python
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
34# Load model and tokenizer5tokenizer = AutoTokenizer.from_pretrained(6"merileijona/mechanicus-prayer-gpt2",7 trust_remote_code=True# Required for custom tiktoken tokenizer8)9model = AutoModelForCausalLM.from_pretrained("merileijona/mechanicus-prayer-gpt2")10model.eval()1112# Format prompt13prompt ="<|user|>Prayer for activating a plasma reactor.<|end|>\n<|assistant|>"1415# Generate16inputs = tokenizer(prompt, return_tensors="pt")17with torch.no_grad():18 outputs = model.generate(19 inputs["input_ids"],20 max_new_tokens=256,21 temperature=0.65,# Lower = more consistent22 top_k=30,23 do_sample=True,24)2526# Decode27text = tokenizer.decode(outputs[0], skip_special_tokens=False)28prayer = text.split("<|assistant|>")[1].split("<|end|>")[0].strip()29print(prayer)
Example Output
Input:"Prayer for activating a plasma reactor."
Generated:
Encircle the plasma reactor, intoning the Litany of Containment.
Beseech the plasma reactor's volatile Machine Spirit to accept charging.
Infuse plasma conduits with sanctified isotopes into the plasma reactor's core.
Chant the Incantation of Contained Fury during the charging ritual.
Seal the plasma reactor's charged plasma with a final benediction.
Prompt Format
<|user|>[Your request]<|end|>
<|assistant|>
Example prompts:
"Prayer for activating a [device]"
"Blessing for a [weapon/tool]"
"Emergency prayer for a [system]"
"Litany for [action/sequence]"
"Rite of [operation] for a [component]"
Recommended Parameters
temperature: 0.65 (lower than default 1.0 for better consistency)
top_k: 30 (lower than default 50)
max_new_tokens: 256
Higher temperatures may produce less coherent results.
Technical Details
Custom Tokenizer
This model uses a custom tiktoken-based tokenizer wrapped in HuggingFace's interface. This ensures compatibility with the original training process while maintaining standard HuggingFace APIs.
Why? The model was trained using tiktoken (standard for nanoGPT). HuggingFace's default GPT2Tokenizer has subtle encoding differences that break generation quality.
The custom tokenizer loads automatically with trust_remote_code=True.
Architecture
Base: GPT-2 (124M parameters)
Modifications: No bias terms (common optimization)
Vocabulary: 50,304 tokens (GPT-2 base + special tokens)
Special tokens:<|user|> (50257), <|assistant|> (50258), <|end|> (50259)
Context length: 512 tokens
Training
Dataset: 3,972 synthetic examples generated by xAI Grok (Grok-4-1-reasoning)
Quality: 100% format consistency, 0% duplicates, 100% natural prose
Validation: Rigorous object consistency and format checking
Framework: nanoGPT with tiktoken tokenization
Limitations
Specialized for Mechanicus-style creative writing only
Requires specific prompt format for best results (i.e., action + w40k object)
Performance degrades with components not in training vocabulary
May occasionally generate minor repetitions or inconsistencies
This is an unofficial, non-commercial fan project for educational and entertainment purposes. Not affiliated with, endorsed by, or sponsored by Games Workshop Limited.
From the weakness of the mind, Omnissiah save us.
From the lies of the Antipath, circuit preserve us.
From the rage of the Beast, iron protect us.
From the temptations of the Flesh, silica cleanse us.
From the ravages of the Destroyer, anima shield us.
From this rotting cage of biomatter, Machine God, set us free. ⚙️