simple character level model for mobile/termux personal ai
A simple character-level AI you can run on your phone. It learns from your text and can generate new text based on what it learned.
Requirements
PyTorch installed
A corpus.txt file with a large amount of text
How to Run
Train the model:
python mini_llm.py
Trains for 500 epochs or resumes from the last saved checkpoint (mini_llm.pth).
Generate text only (skip training):
python mini_llm.py generative
Enter a seed phrase of at least 50 characters to set the starting context.
Parameters
HIDDEN_SIZE = 256 → model capacity
N_LAYERS = 2 → number of GRU layers
SEQUENCE_LENGTH = 50 → input sequence length
N_EPOCHS = 500 → total training iterations
TEMPERATURE = 0.8 → randomness of text (lower = more predictable)