| ``` | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β β | |
| β ⬑ S U M M O N β | |
| β β | |
| β ββββββββββββββββββββββββββββββββββββββββ β | |
| β Build your own weights. Name your own model. β | |
| β Sovereign fine-tuning framework Β· pip install summon β | |
| β ββββββββββββββββββββββββββββββββββββββββ β | |
| β β | |
| β ⬑ Ξ© βΊ Ξ¨ Ξ Ξ Ξ£ Ξ¦ Ξ± β WORM SEALED AT EVERY STEP β | |
| β β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ``` | |
| Summon is a pip-installable Python framework for building sovereign fine-tuned language models. It wraps HuggingFace PEFT + TRL + bitsandbytes into a single fluent chain: `Summon.begin("YourModel")` β `.base()` β `.corpus()` β `.constitutional()` β `.license()` β `.train()` β `.push()`. The API is designed in the functional / immutable style β every method returns a new `SovereignModel` instance; nothing mutates in place. The `Corpus` builder is equally composable: stack named layers from JSONL files or raw string lists, then `.seal()` to freeze them. A SHA-256 WORM chain runs through every step of both pipelines, producing a verifiable manifest of exactly what data, what base, and what constitution went into your weights. Training is QLoRA (4-bit NF4 quantization via bitsandbytes, `r=16 lora_alpha=32`, target modules `q_proj/v_proj/k_proj/o_proj`) using HuggingFace `SFTTrainer`. Supported base models include Nemotron Mini 4B, Llama 3 8B/70B, Mistral 7B, Phi-3 Mini, Qwen2 7B, Gemma2 9B, and Falcon 7B β or pass any HuggingFace ID directly. | |
| ## Architecture | |
| ```mermaid | |
| flowchart LR | |
| subgraph Corpus Builder | |
| C0([Corpus.layer 0\ngenesis.jsonl]) | |
| C1([Corpus.layer 1\nenochian.jsonl]) | |
| C2([Corpus.layer N\n...]) | |
| CS([.seal\nWORM hash]) | |
| C0 --> C1 --> C2 --> CS | |
| end | |
| subgraph SovereignModel Chain | |
| M0([Summon.begin\nname]) --> M1 | |
| M1([.base\nnominate HF model]) --> M2 | |
| M2([.corpus\nlayers / Corpus obj]) --> M3 | |
| M3([.constitutional\nprinciples list]) --> M4 | |
| M4([.license\nsovereign-source-v1]) --> M5 | |
| M5([.train\nQLoRA 4-bit]) --> M6 | |
| M6([.push\nHuggingFace Hub]) | |
| end | |
| CS -->|corpus_obj| M2 | |
| subgraph Trainer | |
| T0[Load base model\nBitsAndBytesConfig NF4] | |
| T1[Apply LoraConfig\nr=16 alpha=32] | |
| T2[SFTTrainer\nepochs Β· batch Β· lr] | |
| T3[save_model\nwrite model card] | |
| T0 --> T1 --> T2 --> T3 | |
| end | |
| M5 --> Trainer | |
| subgraph WORM Chain | |
| W0[GENESIS] --> W1[BASE seal] | |
| W1 --> W2[CORPUS seal] | |
| W2 --> W3[CONSTITUTION seal] | |
| W3 --> W4[LICENSE seal] | |
| W4 --> W5[TRAIN seal] | |
| W5 --> W6[PUSH seal] | |
| end | |
| M1 -.->|SHA-256| W1 | |
| M2 -.->|SHA-256| W2 | |
| M3 -.->|SHA-256| W3 | |
| M4 -.->|SHA-256| W4 | |
| M5 -.->|SHA-256| W5 | |
| M6 -.->|SHA-256| W6 | |
| ``` | |
| ## File Tree | |
| ``` | |
| summon/ | |
| βββ summon/ | |
| β βββ __init__.py # Summon class β .begin() and .corpus() entry points | |
| β βββ identity/ | |
| β β βββ __init__.py | |
| β β βββ model.py # SovereignModel β fluent chain (.base/.corpus/.constitutional/.license/.train/.push/.manifest) | |
| β βββ corpus/ | |
| β β βββ __init__.py | |
| β β βββ builder.py # Corpus β layered JSONL builder (.layer/.layer_raw/.seal/.export/.summary) | |
| β βββ train/ | |
| β βββ __init__.py | |
| β βββ runner.py # Trainer β QLoRA fine-tuning (validate/run/_write_model_card) | |
| βββ examples/ | |
| β βββ build_my_model.py # Three usage patterns: full pipeline, corpus-first, dry run | |
| βββ setup.py # pip packaging (extras: [train] and [hub]) | |
| βββ README.md | |
| ``` | |
| ## Quick Start | |
| ```bash | |
| # Install (core β no GPU deps) | |
| pip install summon | |
| # Install with training deps | |
| pip install "summon[train]" # torch, transformers, peft, trl, datasets, bitsandbytes, accelerate | |
| # Install with HuggingFace Hub push support | |
| pip install "summon[train,hub]" | |
| ``` | |
| **Full pipeline:** | |
| ```python | |
| from summon import Summon | |
| model = ( | |
| Summon.begin("AhmadMeta-v1") | |
| .base("nemotron-mini-4b") # or full HF ID: "nvidia/Minitron-4B-Base" | |
| .corpus(layers=[ | |
| "data/the_book.jsonl", | |
| "data/enoch.jsonl", | |
| "data/circle7.jsonl", | |
| ]) | |
| .constitutional(["truth", "sovereignty", "evidence", "no_deception"]) | |
| .license("sovereign-source-v1") | |
| .train(device="cuda", epochs=3, batch_size=4, learning_rate=2e-4) | |
| .push("my-org/AhmadMeta-v1") | |
| ) | |
| model.manifest() # print WORM-sealed manifest, optionally write to file | |
| ``` | |
| **Corpus builder separately:** | |
| ```python | |
| from summon import Summon | |
| corpus = ( | |
| Summon.corpus() | |
| .layer(0, "data/genesis.jsonl", name="genesis") | |
| .layer(1, "data/enoch.jsonl", name="enochian") | |
| .layer_raw(2, ["raw text line 1", "raw text line 2"], name="inline") | |
| .seal() | |
| ) | |
| model = ( | |
| Summon.begin("JessicaLM-v1") | |
| .base("llama3-8b") | |
| .corpus(corpus_obj=corpus) # pass the sealed Corpus object | |
| .constitutional(["truth", "care", "sovereignty"]) | |
| .license("apache-2.0") | |
| .train(device="cuda", epochs=5) | |
| .push("jessica-org/JessicaLM-v1") | |
| ) | |
| ``` | |
| **Dry run (validate config, no GPU):** | |
| ```python | |
| model = ( | |
| Summon.begin("TestModel-v1") | |
| .base("phi3-mini") | |
| .corpus(layers=["data/sample.jsonl"]) | |
| .constitutional(["truth"]) | |
| .train(dry_run=True) # validates, does not launch training | |
| ) | |
| ``` | |
| ## Key Features | |
| - **Single fluent chain** β `Summon.begin("name").base().corpus().constitutional().license().train().push()` β the entire pipeline in one expression | |
| - **Functional / immutable API** β every method returns a new `SovereignModel` instance; state never mutates; safe to branch at any point | |
| - **Layered Corpus builder** β stack named JSONL layers with `.layer()` (from file) or `.layer_raw()` (from string list); `.seal()` freezes and WORM-stamps the corpus; `.export()` merges all layers to a single JSONL for training | |
| - **QLoRA fine-tuning** β 4-bit NF4 quantization via bitsandbytes, LoRA rank 16, alpha 32, targets `q_proj/v_proj/k_proj/o_proj`, `SFTTrainer` with gradient accumulation and fp16; auto-writes a HuggingFace model card with WORM seal | |
| - **Constitutional principles** β `.constitutional(["truth","sovereignty","evidence"])` bakes your principles into the model manifest and model card; shapes RLHF/preference data generation | |
| - **Eight supported base models** β Nemotron Mini 4B, Llama 3 8B/70B, Mistral 7B, Phi-3 Mini, Qwen2 7B, Gemma2 9B, Falcon 7B β or pass any HuggingFace model ID directly | |
| - **WORM chain on every step** β SHA-256 hash chain from `GENESIS` through `BASE β CORPUS β CONSTITUTION β LICENSE β TRAIN β PUSH`; final hash in `.manifest()` proves exact provenance | |
| - **`.manifest()` output** β prints and optionally writes a JSON document with name, base, corpus layers, constitution, license, output path, WORM head hash, and creation timestamp | |
| - **HuggingFace Hub push** β `.push("org/model")` calls `HfApi().upload_folder()` with optional `private=True`; warns if `.train()` was not called first | |
| --- | |
| *Apache 2.0 Β· SnapKitty Collective 2026 Β· Evidence or Silence* | |