A lightweight software to train, finetune, and test a small Language Model (LLM) on your local CPU. No heavy GPUs required!
- Custom Data Training: Input your own
USER INPUT/OUTPUTpairs. - Adjustable Hyperparameters: Control Learning Rate, Batch Size, and Epochs.
- Inference Playground: Test your model with adjustable Temperature and Nucleus Sampling (Top-P).
- Lightweight: Uses a miniature GPT architecture implemented in pure PyTorch (no Hugging Face
transformersdependency). - CPU Friendly: Designed to run on standard laptops.
- Python 3.8 or higher
-
Open a terminal in this folder.
-
Install the required packages:
pip install -r requirements.txt
-
Run the application:
streamlit run app.py
-
Tab 1 (Data):
- Paste your training data in the text box.
- Click Parse & Preview to prepare the data.
-
Tab 2 (Training):
- Set your desired parameters.
- Click Start Training. Watch the loss go down!
-
Tab 3 (Inference):
- Once training is complete, switch to this tab.
- Type a message and see how your model responds.
- Play with Temperature and Top-P to change the creativity.
This software implements a NanoGPT (a small Transformer-based language model) from scratch. It treats your input data as a continuous stream of text and learns to predict the next character. It uses a custom character-level tokenizer for simplicity.
app.py: The main Streamlit interface.model.py: The GPT model architecture (PyTorch).train.py: Training loop and logic.utils.py: Data parsing and tokenization utilities.