(3 Sept 26) Build your own small scale language model with the materials you choose, the way you want. Think quality over quantity. You don't need a monolithic model that contains the whole internet - you need a small, precise model with excellent data.
1
stars
13
commits
Python
primary language
Sep 3, 2026
updated
NanoLM Studio is a local desktop workbench for building a small decoder-only language model from a corpus you can inspect and control. You can built it your way, how you want it to be. It combines document ingestion, cleaning, ByteLevel BPE tokenization, PyTorch training, interactive generation, and attention visualisation in one Tk application.
Although this is the first time I have released it publicly, the program has gone through a number of iterations and this V4 Studio is a reliability-focused version. It has a five-tab workflow while correcting the package, storage, cache, training, threading, and generation problems found in earlier versions.
Use Python 3.11 or newer. A virtual environment is strongly recommended.
py -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
pip install -r requirements.txt
python main.py
The Windows requirements explicitly install PyTorch 2.12.1 with CUDA 12.6. NanoLM also checks for the broken state where Windows can see an NVIDIA GPU but the active environment contains CPU-only PyTorch. Training is blocked with repair instructions in that case; it will no longer silently use CPU.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
python main.py
On non-Windows systems, PyTorch installation can vary by operating system and
accelerator. If the standard requirements command cannot select the right
build, install PyTorch using the command generated at
https://pytorch.org/get-started/locally/, then run
pip install -r requirements.txt again.
best.pt, final.pt, or a chosen checkpoint and generate in
dialogue or continuation mode. Generation streams, can be stopped, and uses
a key/value cache while the context window has room.By default, all mutable data is placed in ./data beside main.py:
data/
corpus.db
raw/
documents/
tokenizer/tokenizer.json
cache/{train_tokens.npy,val_tokens.npy,meta.json}
checkpoints/{best.pt,final.pt}
runs/run_*.jsonl
Set NANOLM_DATA_DIR before launch to use another workspace:
$env:NANOLM_DATA_DIR = "D:\NanoLMProjects\experiment-01"
python main.py
NANOLM_DATA_DIR="$HOME/NanoLMProjects/experiment-01" python main.py
This also makes automated tests safe: they use isolated temporary directories and never touch the real corpus.
python main.py now imports the included nanolm
package successfully.final.pt time to be
saved.See V4_REVIEW.md for the full audit and development critique.
See V4_CAPACITY_PLANNER.md for planner ranges, estimates, and usage.
Run the non-GUI suite from the project directory:
python -m unittest discover -s tests -v
python smoke_test.py
The smoke test creates a temporary corpus, tokenizer, cache, run history, and checkpoints. It does not delete or overwrite application data.
This is an educational local language-model studio, not a substitute for a large pretrained assistant. Results depend heavily on corpus quality, corpus size, compute, and training time. The medium preset may be slow on CPU. Keep backups of valuable corpora and only load checkpoint files you trust, because PyTorch checkpoints are not a safe format for untrusted downloads.
The next natural evolution is a multi-project experiment studio: named project workspaces, richer dataset versioning, comparative run dashboards, adapter fine-tuning of pretrained models, and export/inference backends such as ONNX or GGUF. V4 deliberately establishes the reliable local foundation those features would need.
It is released open-source under MIT license.
By JL Kosev-Lex on 3 September 2026.
13 commits
Hacker News (1)
Python
100.0%
(3 Sept 26) Build your own small scale language model with the materials you choose, the way you want. Think quality over quantity. You don't need a monolithic model that contains the whole internet - you need a small, precise model with excellent data.
1
stars
13
commits
Python
primary language
Sep 3, 2026
updated
NanoLM Studio is a local desktop workbench for building a small decoder-only language model from a corpus you can inspect and control. You can built it your way, how you want it to be. It combines document ingestion, cleaning, ByteLevel BPE tokenization, PyTorch training, interactive generation, and attention visualisation in one Tk application.
Although this is the first time I have released it publicly, the program has gone through a number of iterations and this V4 Studio is a reliability-focused version. It has a five-tab workflow while correcting the package, storage, cache, training, threading, and generation problems found in earlier versions.
Use Python 3.11 or newer. A virtual environment is strongly recommended.
py -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
pip install -r requirements.txt
python main.py
The Windows requirements explicitly install PyTorch 2.12.1 with CUDA 12.6. NanoLM also checks for the broken state where Windows can see an NVIDIA GPU but the active environment contains CPU-only PyTorch. Training is blocked with repair instructions in that case; it will no longer silently use CPU.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
python main.py
On non-Windows systems, PyTorch installation can vary by operating system and
accelerator. If the standard requirements command cannot select the right
build, install PyTorch using the command generated at
https://pytorch.org/get-started/locally/, then run
pip install -r requirements.txt again.
best.pt, final.pt, or a chosen checkpoint and generate in
dialogue or continuation mode. Generation streams, can be stopped, and uses
a key/value cache while the context window has room.By default, all mutable data is placed in ./data beside main.py:
data/
corpus.db
raw/
documents/
tokenizer/tokenizer.json
cache/{train_tokens.npy,val_tokens.npy,meta.json}
checkpoints/{best.pt,final.pt}
runs/run_*.jsonl
Set NANOLM_DATA_DIR before launch to use another workspace:
$env:NANOLM_DATA_DIR = "D:\NanoLMProjects\experiment-01"
python main.py
NANOLM_DATA_DIR="$HOME/NanoLMProjects/experiment-01" python main.py
This also makes automated tests safe: they use isolated temporary directories and never touch the real corpus.
python main.py now imports the included nanolm
package successfully.final.pt time to be
saved.See V4_REVIEW.md for the full audit and development critique.
See V4_CAPACITY_PLANNER.md for planner ranges, estimates, and usage.
Run the non-GUI suite from the project directory:
python -m unittest discover -s tests -v
python smoke_test.py
The smoke test creates a temporary corpus, tokenizer, cache, run history, and checkpoints. It does not delete or overwrite application data.
This is an educational local language-model studio, not a substitute for a large pretrained assistant. Results depend heavily on corpus quality, corpus size, compute, and training time. The medium preset may be slow on CPU. Keep backups of valuable corpora and only load checkpoint files you trust, because PyTorch checkpoints are not a safe format for untrusted downloads.
The next natural evolution is a multi-project experiment studio: named project workspaces, richer dataset versioning, comparative run dashboards, adapter fine-tuning of pretrained models, and export/inference backends such as ONNX or GGUF. V4 deliberately establishes the reliable local foundation those features would need.
It is released open-source under MIT license.
By JL Kosev-Lex on 3 September 2026.
Hacker News (1)
13 commits
Python
100.0%