Metadata-Version: 2.4
Name: llmcompoz
Version: 0.1.1
Summary: Compose a language model from scratch — and learn how it works. PySide6 educational GUI + CLI.
Author: Bayram Kotan
License-Expression: MIT
Project-URL: Homepage, https://github.com/bayramkotan/LLMcompoz
Project-URL: Repository, https://github.com/bayramkotan/LLMcompoz
Project-URL: Issues, https://github.com/bayramkotan/LLMcompoz/issues
Keywords: llm,gpt,transformer,education,pyside6,from-scratch
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Education
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.1
Requires-Dist: PySide6>=6.6
Provides-Extra: bpe
Requires-Dist: tiktoken>=0.5; extra == "bpe"
Dynamic: license-file

# LLMcompoz

**Compose a language model from scratch — and learn how it works.**

LLMcompoz is a PySide6 desktop app (with a matching Qt-free CLI) that walks you
through building a GPT-style language model from nothing: a tokenizer you watch
split text into chips, a transformer you assemble with four sliders while the
parameter count moves, a training loop that draws its own loss curve, and a
generation panel where you scrub `temperature` and `top-k` and watch tokens
appear one at a time.

It also runs models you did not train. Point it at a `.gguf` file or a
transformers folder and it reads the architecture straight out of the header —
layer count, head count, grouped-query attention, quantization scheme and the
KV-cache cost — **without loading a single weight**. That inspection is the part
a model runner normally hides.

Nothing is behind a framework `Trainer`. Every core file is meant to be read top
to bottom: the attention maths, the training step, the sampling loop.

## The screens

| | | |
|---|---|---|
| **01 Veri** | the text to learn from | character, word and vocabulary counts as you type |
| **02 Tokenizer** | text → numbers | char vs from-scratch BPE, with the live split shown as coloured chips and ids |
| **03 Model** | the shape of the network | four sliders, live parameter count, and the full per-layer breakdown |
| **04 Eğitim** | training, watched | live loss curve on a worker thread, step rate, working Stop, checkpoints |
| **05 Üretim** | the model writes | streaming tokens, temperature and top-k explained as you move them |
| **Hazır modeller** | models you downloaded | GGUF and transformers library, architecture read from the file header |
| **Öğren** | the ideas behind each control | eight notes, grouped by the stage they explain |

## Layout

```
src/llmcompoz/
├── core/              # the actual ML — readable, framework-free
│   ├── tokenizer.py       # CharTokenizer + BPE with word-boundary pre-tokenisation
│   ├── attention.py       # multi-head causal self-attention
│   ├── model.py           # GPT: embeddings → blocks → head
│   ├── trainer.py         # explicit training loop with callbacks and stop()
│   ├── sampler.py         # streaming generation
│   ├── config.py          # ModelConfig / TrainConfig
│   ├── gguf_meta.py       # pure-Python GGUF header reader
│   └── runtime/           # one interface, two engines (llama.cpp, transformers)
├── gui/
│   ├── theme.py           # one palette, one type scale, one stylesheet
│   ├── widgets.py         # cards, stat tiles, the loss chart
│   ├── state.py           # what the panels share
│   └── panels/            # one file per screen
├── learn/content.py   # the teaching notes, shared by the window and the CLI
└── cli.py             # Qt-free llmcompoz command
```

## Quick start

**Linux**
```bash
cd ~/Github/LLMcompoz
python3.13 -m venv .venv && source .venv/bin/activate
pip install -e .
llmcompoz-gui
```

**Windows (PowerShell)**
```powershell
cd C:\Github\LLMcompoz
py -3.13 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .
llmcompoz-gui
```

PyTorch has no wheels for Python 3.14 yet — use 3.13 or earlier.

## The command line

Everything the window does, without a display:

```bash
llmcompoz info                                  # version, torch, device
llmcompoz tokenize data/tiny.txt --bpe 512      # vocabulary and the first ids
llmcompoz train data/tiny.txt --steps 2000      # train and write a checkpoint
llmcompoz generate "To be" --ckpt checkpoints/model_latest.pt --data data/tiny.txt
llmcompoz models                                # the local model library
llmcompoz models --inspect model.gguf           # architecture, without loading it
llmcompoz learn attention                       # the teaching notes
```

## Optional engines

The from-scratch half needs only torch. Running downloaded models is opt-in,
because `llama-cpp-python` compiles:

```bash
pip install llmcompoz[gguf]    # run .gguf models through llama.cpp
pip install llmcompoz[hf]      # run transformers models, inspect their layers
pip install llmcompoz[all]
```

Browsing and inspecting models needs neither — the header reader is pure Python.

## Status

`v0.1.1` — the seven screens are real and wired to the core; the from-scratch
pipeline runs end to end; GGUF/transformers models are listed and inspected.
Loading and chatting with a downloaded model, and the OpenAI-compatible server,
are next.

## License

MIT
