phera-ra commited on
Commit
fb2816f
·
verified ·
1 Parent(s): 92b92e6

Fix the Atomic docs, and ship the architecture as a real GGUF

Browse files

BROKEN: docs/ATOMIC_QUICK_START.md told readers to download cosmos-namebind-weights.gguf, which was removed on 2026-08-01 for being a Qwen2.5-1.5B fine-tune whose metadata made this hub display qwen2 as this repository's architecture. The instruction has been dead since. docs/USAGE_ATOMIC.md referenced cosmos_best.pt at the root (it is at weights/cosmos_best.pt) and imported a cosmos_model module that does not exist.

ADDED: weights/cosmos-cst.gguf -- the 54D Mixture-of-States Hebbian attention as a real GGUF. 61 tensors, general.architecture=cosmos, attention.key_length=102 (head_dim 48 + the 54-dimensional state carried in the key rows). Verified running in a llama.cpp fork at 2,411 tok/s prompt eval and 1,078 tok/s generation.

STATED PLAINLY: stock Atomic, Ollama and LM Studio CANNOT load this and no setting changes that. llama.cpp dispatches on general.architecture against an enum compiled into the binary, and none of them ship LLM_ARCH_COSMOS. What works today is serving/cosmos_serve.py, which speaks the Ollama HTTP API from PyTorch, so any Ollama-compatible client reaches PHOS, CST and Spark by pointing at port 11501. The fork runs the GGUF natively; build instructions are in the doc.

Both documents now carry only paths that exist, and every code example in USAGE_ATOMIC.md was executed before being written down.

.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  cosmos-namebind-weights.gguf filter=lfs diff=lfs merge=lfs -text
37
  cosmos-namebind-weights-test-arch.gguf filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  cosmos-namebind-weights.gguf filter=lfs diff=lfs merge=lfs -text
37
  cosmos-namebind-weights-test-arch.gguf filter=lfs diff=lfs merge=lfs -text
38
+ weights/cosmos-cst.gguf filter=lfs diff=lfs merge=lfs -text
docs/ATOMIC_QUICK_START.md CHANGED
@@ -1,33 +1,98 @@
1
- # Quick Setup for Atomic AI
2
-
3
- ## Step 1: Download COSMOS GGUF
4
- `ash
5
- wget https://huggingface.co/phera-ra/QC67_cosmo/resolve/main/cosmos-namebind-weights.gguf
6
- # or use Atomic's built-in model browser to search "QC67_cosmo"
7
- `
8
-
9
- ## Step 2: Verify SHA256
10
- `ash
11
- sha256sum cosmos-namebind-weights.gguf
12
- # Expected: 726c464259c55de3d880a242f8a9106662910753f35fccac701534ca00d33f7a
13
- `
14
-
15
- ## Step 3: Import to Atomic
16
- 1. Open Atomic AI app
17
- 2. Model → Import → Select cosmos-namebind-weights.gguf
18
- 3. Wait for import to complete
19
- 4. Model → Create new session → cosmos
20
-
21
- ## Step 4: Run test suite
22
- Use the ATOMIC_TEST_SUITE.md checklist above
23
-
24
- ## If Import Fails
25
- - Try backup file: cosmos-namebind-weights-BACKUP-before-replace.gguf
26
- - Check file size: should be ~3.1 GB
27
- - Verify disk space available: ~6 GB (file + temp)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  ---
30
 
31
- **Model Card:** https://huggingface.co/phera-ra/QC67_cosmo
32
- **Performance Profile:** https://huggingface.co/phera-ra/QC67_cosmo/blob/main/performance.md
33
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Running Cosmos — Atomic, Ollama, llama.cpp, or plain Python
2
+
3
+ **Read this first, because it will save you an hour.** Cosmos is not a fine-tune of an
4
+ existing model. Its attention runs a mechanism (`LLM_ARCH_COSMOS`) that no released
5
+ inference runtime knows about, and `llama.cpp` dispatches on `general.architecture`
6
+ against an enum compiled into the binary. So:
7
+
8
+ | you want | works today | why |
9
+ |---|---|---|
10
+ | **Talk to her right now, no build** | ✅ `serving/cosmos_serve.py` | PyTorch, speaks the Ollama HTTP API |
11
+ | **Her architecture natively in C++** | ✅ the `cosmos-arch` llama.cpp fork | has the enum entry |
12
+ | **Stock Atomic / stock Ollama / LM Studio** | ❌ not yet | their bundled llama.cpp has no `LLM_ARCH_COSMOS` |
13
+
14
+ No Modelfile, flag, or conversion changes the third row. It needs a runtime built with
15
+ the architecture registered. That is a pull request to those projects, not a setting.
16
+
17
+ ---
18
+
19
+ ## 1. Fastest path — talk to her in about a minute
20
+
21
+ Needs Python 3.9+ and `torch`. Nothing else.
22
+
23
+ ```bash
24
+ pip install torch
25
+ python serving/cosmos_serve.py 11501
26
+ ```
27
+
28
+ That serves **PHOS**, **CST** and **Spark** behind the Ollama HTTP API on port 11501, so
29
+ any Ollama-compatible client works by pointing at it instead of 11434:
30
+
31
+ ```bash
32
+ curl http://127.0.0.1:11501/api/tags
33
+ curl http://127.0.0.1:11501/api/chat -d '{"model":"cosmos-phos","messages":[{"role":"user","content":"hello"}],"stream":false}'
34
+ ```
35
+
36
+ In Atomic, LM Studio, or anything else that accepts a custom Ollama endpoint, set the
37
+ base URL to `http://127.0.0.1:11501`. The models appear by name.
38
+
39
+ Or just use the launcher, which starts the server and waits for the port:
40
+
41
+ ```
42
+ START_COSMOS_KIT.bat -> 1. Chat with Cosmos
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 2. Native C++ — her real architecture in llama.cpp
48
+
49
+ `cosmos-cst.gguf` in this repository is her 54D Mixture-of-States Hebbian attention as a
50
+ real GGUF: 61 tensors, `general.architecture: cosmos`, `attention.key_length = 102`
51
+ (head_dim 48 + the 54-dimensional state riding in the key rows).
52
+
53
+ Stock llama.cpp will refuse it — correctly, because it does not have the architecture.
54
+ Build the fork:
55
+
56
+ ```bash
57
+ git clone -b cosmos-arch https://github.com/NavisWORLD/llama.cpp
58
+ cd llama.cpp
59
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_SERVER=OFF -DLLAMA_CURL=OFF
60
+ cmake --build build --config Release --target llama-completion
61
+ ./build/bin/Release/llama-completion -m cosmos-cst.gguf -p "the woods" -n 48 -c 128
62
+ ```
63
+
64
+ Measured on a 6-core CPU: **2,411 tok/s prompt eval, 1,078 tok/s generation.**
65
+
66
+ > This is a **1.9M-parameter character-level model.** It produces proto-English with real
67
+ > structure (`a dimly lit ... bedroom room`) and is not fluent. That is the expected
68
+ > result at this size and is not a defect. If you want fluency, this is the wrong repo;
69
+ > if you want an architecture nobody else has running, this is it.
70
 
71
  ---
72
 
73
+ ## 3. Plain PyTorch
74
+
75
+ ```python
76
+ import torch
77
+ ck = torch.load("weights/phos.pt", map_location="cpu", weights_only=False)
78
+ print(ck["arch"], f'{ck["total_steps"]:,} steps', ck["best_val_loss"])
79
+ # PHOS-dyn12-phi-QuantumBorn 2,800 steps 0.6984356045722961
80
+ ```
81
+
82
+ `weights/phos.pt`, `weights/cosmos_born.pt` and `weights/spark_cst.pt` are all
83
+ architecturally original and quantum-born. The model classes live in `architecture/`.
84
+
85
+ ---
86
+
87
+ ## What changed on 2026-08-01, and why your old bookmark broke
88
+
89
+ Earlier versions of this file told you to download `cosmos-namebind-weights.gguf`. **That
90
+ file was removed.** It was a Qwen2.5-1.5B fine-tune, not this architecture — its GGUF
91
+ metadata carried `general.architecture: qwen2`, which this hub rendered as an
92
+ architecture badge above the model card, so the page announced someone else's base model
93
+ as this work's architecture. Removing it also made the card's own statement true: this
94
+ repository distributes only weights that are architecturally original.
95
+
96
+ If you specifically want that conversational teacher model, it is a Qwen2.5-1.5B
97
+ derivative under **Apache 2.0** © Alibaba Cloud, and you should get Qwen from Alibaba
98
+ rather than from here. See §1b of the [model card](../README.md) for the full provenance.
docs/USAGE_ATOMIC.md CHANGED
@@ -1,47 +1,124 @@
1
- # Using QC67_cosmo with Atomic
2
-
3
- ## Loading
4
-
5
- The model checkpoint (cosmos_best.pt) is a PyTorch state_dict compatible with the COSMOS 54D architecture.
6
-
7
- ```python
8
- import torch
9
-
10
- # Load checkpoint (CPU or GPU)
11
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
12
- checkpoint = torch.load('cosmos_best.pt', map_location=device)
13
- # checkpoint is typically state_dict or wrapped as {'state_dict': ...}
14
-
15
- # With your CosmosModel class:
16
- from cosmos_model import CosmosModel # adjust import as needed
17
- model = CosmosModel(config)
18
- model.load_state_dict(checkpoint)
19
- model.to(device)
20
- model.eval()
21
- ```
22
-
23
- ## Generation
24
-
25
- ```python
26
- import torch
27
-
28
- input_text = "Hello, Cosmos!"
29
- # Tokenize using your tokenizer (assumed available)
30
- # tokens = tokenizer.encode(input_text)
31
- # Inference
32
- # with torch.no_grad():
33
- # output = model.generate(tokens, max_new_tokens=100)
34
- # result = tokenizer.decode(output)
35
- ```
36
-
37
- ## Local Execution
38
-
39
- The user confirms the model works locally with the **Atomic** runtime environment bundled in the COSMOS_MASTER project. Refer to the included Atomic docs and the local COSMOS setup for exact usage patterns.
40
-
41
- ## Memory & Performance
42
-
43
- - Model size: ~134 MB (checkpoint)
44
- - Suitable for CPU or GPU inference
45
- - Recommended: GPU with ≥2GB VRAM or CPU with ≥8GB RAM for smooth generation
46
-
47
- For more details on the COSMOS 54D architecture (CST, Hebbian, chaos, memory), see the README and cosmos_model.py in the source repo.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Using Cosmos from code
2
+
3
+ Every path below was run before being written here. Paths are relative to the repository
4
+ root, and they are the paths that actually exist — an earlier version of this file
5
+ referenced `cosmos_best.pt` at the root and a `cosmos_model` module, and neither is where
6
+ it said.
7
+
8
+ ---
9
+
10
+ ## Load a checkpoint and read its provenance
11
+
12
+ ```python
13
+ import torch
14
+
15
+ ck = torch.load("weights/phos.pt", map_location="cpu", weights_only=False)
16
+
17
+ print(ck["arch"]) # PHOS-dyn12-phi-QuantumBorn
18
+ print(f'{ck["total_steps"]:,}')# 2,800
19
+ print(ck["best_val_loss"]) # 0.6984356045722961
20
+ print(ck["quantum_source"]) # ibm_real_shots
21
+ print(ck["quantum_draws"]) # 400000
22
+ print(len(ck["vocab_list"])) # 162
23
+ ```
24
+
25
+ Every checkpoint carries its own lineage. Nothing here needs a config file to be trusted.
26
+
27
+ | file | params | what it is |
28
+ |---|---|---|
29
+ | `weights/phos.pt` | 1,153,804 | **the flagship.** dyn12 on the φ scaffold, still growing |
30
+ | `weights/spark_cst.pt` | 1,924,488 | the 54D Hebbian kernel model |
31
+ | `weights/cosmos_born.pt` | 1,842,432 | the original quantum-born char transformer |
32
+ | `weights/cosmos_best.pt` | — | earlier lineage, tiktoken BPE, no quantum birth |
33
+
34
+ ---
35
+
36
+ ## Build the model and generate
37
+
38
+ The classes are in `architecture/`, not a package you have to install:
39
+
40
+ ```python
41
+ import sys; sys.path.insert(0, "architecture")
42
+ import torch, cosmos_state_ladder as L
43
+
44
+ ck = torch.load("weights/phos.pt", map_location="cpu", weights_only=False)
45
+ vocab = ck["vocab_list"]
46
+ m = L.Ladder(vocab=len(vocab), rung=ck["rung"], ffn=ck["ffn"])
47
+ m.load_state_dict(ck["model"], strict=False)
48
+ m.eval()
49
+
50
+ stoi = {c: i for i, c in enumerate(vocab)}
51
+ idx = torch.tensor([[stoi.get(c, 0) for c in "the woods"]])
52
+ for _ in range(60):
53
+ logits = m(idx[:, -128:])
54
+ logits = logits[0] if isinstance(logits, tuple) else logits
55
+ nxt = int(torch.multinomial(torch.softmax(logits[0, -1] / 0.8, -1), 1))
56
+ idx = torch.cat([idx, torch.tensor([[nxt]])], 1)
57
+ print("".join(vocab[i] for i in idx[0].tolist()))
58
+ ```
59
+
60
+ `strict=False` is deliberate: checkpoints from different rungs carry different state
61
+ tensors, and a mismatch should be visible rather than fatal.
62
+
63
+ ---
64
+
65
+ ## Serve it over HTTP instead
66
+
67
+ ```bash
68
+ python serving/cosmos_serve.py 11501
69
+ ```
70
+
71
+ Ollama-compatible, so existing clients work unchanged:
72
+
73
+ ```python
74
+ import requests
75
+ r = requests.post("http://127.0.0.1:11501/api/chat", json={
76
+ "model": "cosmos-phos",
77
+ "messages": [{"role": "user", "content": "hello"}],
78
+ "stream": False,
79
+ "options": {"num_predict": 200},
80
+ })
81
+ print(r.json()["message"]["content"])
82
+ ```
83
+
84
+ **Serve on CPU.** Measured 2026-08-02 on a GTX 1650 Ti with a working CUDA torch:
85
+
86
+ ```
87
+ phos n=200 GPU 14.25s CPU 10.44s
88
+ cst n=200 GPU 10.32s CPU 3.76s CPU 2.7x faster
89
+ ```
90
+
91
+ Generation is one forward pass per character, strictly sequential, so at 1–2M parameters
92
+ there is no batch to amortise kernel-launch overhead over and the card spends its time
93
+ dispatching. **Training the same models is 7–25× faster on that GPU** — same hardware,
94
+ opposite answer, because a training step is one large batched forward+backward.
95
+ `COSMOS_SERVE_DEVICE=cuda` forces the card if your models are much larger.
96
+
97
+ ---
98
+
99
+ ## Keep training it on your own text
100
+
101
+ ```bash
102
+ python architecture/phos_grow.py --status
103
+ python architecture/phos_grow.py
104
+ ```
105
+
106
+ It warm-starts from the checkpoint **and its optimiser state**, appends new vocabulary
107
+ without moving existing indices, and refuses to train if its preflight cannot prove the
108
+ mechanism is live — a refusal is recorded in `phos_lineage.jsonl` rather than silently
109
+ skipped. Five mechanisms in this project's history ran clean and did nothing; that guard
110
+ is why.
111
+
112
+ ---
113
+
114
+ ## Verify any of this yourself
115
+
116
+ ```bash
117
+ python benchmarks/verify_quantum_engine.py # shot conservation, weight-birth vs theory
118
+ python benchmarks/causality_probe.py # Ω cannot see the future (random seed each run)
119
+ python kit_health.py # every part: PRESENT -> LOADS -> ANSWERS
120
+ ```
121
+
122
+ `causality_probe.py` draws a fresh random seed every run, so your execution is independent
123
+ evidence rather than a replay of someone else's. Set `COSMOS_CAUSAL_OMEGA=0` and it fails
124
+ — a check that cannot fail is not a check.
weights/cosmos-cst.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b833817230817921de8ed1aa52d92829f32a3ed222aedbba1d3237364596e1c6
3
+ size 7639104