Downloads · 30 days
0
dogman189/odysseus-1
odysseus-1 is a text generation model from dogman189. Use it when you need the model to write or continue text. The card lists the license as mit.
This model is a small-scale Transformer-based model trained on a text corpus. The model generates text by predicting the next character in a sequence, making it suitable for creative text generation tasks. This model…
Downloads · 30 days
0
Access
Public
Updated Oct 26, 2025
Repo size
52.7 MB
Likes
1
Public
Click a slice to open those files.
.pth52.7 MB · 99%
From the Hugging Face model README
This model is a small-scale Transformer-based model trained on a text corpus. The model generates text by predicting the next character in a sequence, making it suitable for creative text generation tasks. This model is the mid-size model of my odysseus lineup of generative transformers. It is trained to recreate text similar to that of the Odessey and the Iliad by Homer.
n_embd): 384n_head): 6n_layer): 6The model was trained using AdamW optimizer with a learning rate of 3e-4 for 5000 iterations, on a 90/10 train/validation split of the input text.
train.txt (not included here; assume Shakespeare for reference).pip install torchgpt_model.pth) and vocabulary (vocab.pkl) must be downloaded from this repository.The model uses a custom PyTorch architecture. Copy the model classes from generate.py (or train.py) into your script. Here's an example:
import torch
import pickle
# Load hyperparameters (ensure they match training)
block_size = 256
n_embd = 384
n_head = 6 # Corrected to match training
n_layer = 6 # Corrected to match training
dropout = 0.2
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Load vocab
with open('vocab.pkl', 'rb') as f:
vocab_data = pickle.load(f)
stoi = vocab_data['stoi']
itos = vocab_data['itos']
vocab_size = vocab_data['vocab_size']
decode = lambda l: ''.join([itos[i] for i in l])
# Model classes (paste from generate.py or train.py here)
# ... (Head, MultiHeadAttention, FeedForward, Block, GPTLanguageModel)
# Load the model
model = GPTLanguageModel()
model.load_state_dict(torch.load('gpt_model.pth', map_location=device))
model = model.to(device)
model.eval()
# Generate text
context = torch.zeros((1, 1), dtype=torch.long, device=device)
generated = model.generate(context, max_new_tokens=500)
print(decode(generated[0].tolist()))
For full scripts, see train.py (for training) and generate.py (for inference) in the repository.
train.txt with your text corpus.train.py to train and save the model/vocab.The model was trained on train.txt, assumed to be a concatenation of Shakespeare's works (as in nanoGPT). Total characters: ~1M (typical for Shakespeare). Unique characters: 65.
Final losses (example; actual values depend on run):
The model is evaluated via perplexity (derived from cross-entropy loss) on validation data. No additional benchmarks (e.g., BLEU) were performed, as this is a generative model.