Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58cada4a9a | ||
|
|
2f7ff5a52e | ||
|
|
66912b4d4e | ||
|
|
531f21f241 | ||
|
|
3245be74d0 | ||
|
|
8ef06d5392 | ||
|
|
4a87a0ceb9 | ||
|
|
e78bf052a8 | ||
|
|
0cd1331559 | ||
|
|
3f1051b406 | ||
|
|
e0c67f840a | ||
|
|
b29a52ea8f | ||
|
|
13a127bab9 | ||
|
|
bacd2728e6 | ||
|
|
f278099c44 | ||
|
|
7bc5fe78c3 | ||
|
|
2806fd6f0f | ||
|
|
9b9b8a601a | ||
|
|
bacd2a9dc4 | ||
|
|
0fa29bd8ab | ||
|
|
d4cd8a84ed | ||
|
|
15397dcbb1 | ||
|
|
41fff95388 | ||
|
|
463ce999fe | ||
|
|
fcd5d3d222 | ||
|
|
0c41027b43 | ||
|
|
0c91678240 | ||
|
|
59cf3175e8 | ||
|
|
2095737c18 | ||
|
|
aa74f9bc85 | ||
|
|
5623f32b05 | ||
|
|
fd9b969dde |
17
LICENSE
Normal file
17
LICENSE
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Business Source License 1.1
|
||||||
|
|
||||||
|
Licensor: Salka Elmadani
|
||||||
|
Copyright (C) 2025-2026 Salka Elmadani — ALL RIGHTS RESERVED
|
||||||
|
|
||||||
|
Change Date: 2030-02-12
|
||||||
|
Change License: Apache License, Version 2.0
|
||||||
|
|
||||||
|
Additional Use Grant:
|
||||||
|
You may make use of the Licensed Work for non-production purposes:
|
||||||
|
research, education, evaluation, and personal projects.
|
||||||
|
|
||||||
|
Production use or use in a commercial AI inference service requires
|
||||||
|
a commercial license from the Licensor.
|
||||||
|
|
||||||
|
Contact: elmadani.salka@proton.me
|
||||||
|
https://inference-x.com
|
||||||
22
README.md
22
README.md
@ -1,4 +1,6 @@
|
|||||||
# Organ Architecture
|
[](LICENSE)
|
||||||
|
[](https://inference-x.com)
|
||||||
|
|
||||||
|
|
||||||
**Decompose. Reassemble. Evolve.**
|
**Decompose. Reassemble. Evolve.**
|
||||||
|
|
||||||
@ -12,7 +14,6 @@ Adapters (LoRA) = Personality
|
|||||||
|
|
||||||
AI models are monoliths. 70 billion parameters locked in a single file that nobody can open, modify, or understand. Only three companies on Earth can build them. Everyone else rents access.
|
AI models are monoliths. 70 billion parameters locked in a single file that nobody can open, modify, or understand. Only three companies on Earth can build them. Everyone else rents access.
|
||||||
|
|
||||||
Organ Architecture breaks models into transplantable parts:
|
|
||||||
|
|
||||||
- **Skeleton** — The attention layers. How the model *thinks*. Shared across all configurations.
|
- **Skeleton** — The attention layers. How the model *thinks*. Shared across all configurations.
|
||||||
- **Organs** — The feed-forward networks. What the model *knows*. Specialized, swappable, graftable.
|
- **Organs** — The feed-forward networks. What the model *knows*. Specialized, swappable, graftable.
|
||||||
@ -43,7 +44,7 @@ model.gguf (70GB monolith)
|
|||||||
|------|---------|
|
|------|---------|
|
||||||
| `organ_extract.py` | Extract skeleton + organs from any GGUF model |
|
| `organ_extract.py` | Extract skeleton + organs from any GGUF model |
|
||||||
| `organ_graft.py` | Transplant organs between models |
|
| `organ_graft.py` | Transplant organs between models |
|
||||||
| `organ_measure.py` | Z-measure organ quality (signal vs noise) |
|
| `organ_measure.py` | measure organ quality (signal vs noise) |
|
||||||
| `organ_assemble.py` | Assemble custom model from parts |
|
| `organ_assemble.py` | Assemble custom model from parts |
|
||||||
| `organ_api.py` | API server for organ operations |
|
| `organ_api.py` | API server for organ operations |
|
||||||
|
|
||||||
@ -63,7 +64,6 @@ python3 organ_extract.py --model /path/to/model.gguf --output ./organs/
|
|||||||
python3 organ_measure.py --organ ./organs/organ_layer_12.bin
|
python3 organ_measure.py --organ ./organs/organ_layer_12.bin
|
||||||
|
|
||||||
# Graft an organ from model A into model B
|
# Graft an organ from model A into model B
|
||||||
python3 organ_graft.py --source ./organs_A/ --target ./model_B.gguf --layers 12-18
|
|
||||||
|
|
||||||
# Assemble a custom model
|
# Assemble a custom model
|
||||||
python3 organ_assemble.py --skeleton ./skeleton.bin --organs ./organs/ --output custom.gguf
|
python3 organ_assemble.py --skeleton ./skeleton.bin --organs ./organs/ --output custom.gguf
|
||||||
@ -79,12 +79,12 @@ A 70B monolith is accumulation. A 2B skeleton with specialized organs grafted on
|
|||||||
|
|
||||||
Anyone can train an organ. A doctor trains a medical organ on her hospital's data. A farmer trains an agriculture organ on his field observations. A student trains a math organ on solved problems. The skeleton stays the same. The organs make it alive.
|
Anyone can train an organ. A doctor trains a medical organ on her hospital's data. A farmer trains an agriculture organ on his field observations. A student trains a math organ on solved problems. The skeleton stays the same. The organs make it alive.
|
||||||
|
|
||||||
## Z-Measure
|
## Quality Measure
|
||||||
|
|
||||||
Every organ is measured by its Z-vector:
|
Every organ is measured by its Z-vector:
|
||||||
|
|
||||||
```
|
```
|
||||||
Z = dI/d(log s) · exp(iθ)
|
CSCI — cross-scale coherence index
|
||||||
|
|
||||||
θ → 0° : noise (organ adds confusion)
|
θ → 0° : noise (organ adds confusion)
|
||||||
θ → 90° : pure signal (organ adds knowledge)
|
θ → 90° : pure signal (organ adds knowledge)
|
||||||
@ -97,7 +97,7 @@ InferenceX ─── The engine (228KB, runs anything)
|
|||||||
Organ Arch ─── The anatomy (decompose, reassemble)
|
Organ Arch ─── The anatomy (decompose, reassemble)
|
||||||
Atlas Pure ─── The memory (fractal DNA storage)
|
Atlas Pure ─── The memory (fractal DNA storage)
|
||||||
Echo ────────── The voice (chat interface)
|
Echo ────────── The voice (chat interface)
|
||||||
EDEN ────────── The purpose (desert → life)
|
Purpose ────── Long-term application domain
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
@ -106,9 +106,13 @@ BSL 1.1 — Same as InferenceX.
|
|||||||
|
|
||||||
## Signature
|
## Signature
|
||||||
|
|
||||||
935
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Mohamed dug khettaras to bring water through stone.*
|
*Ancient builders shaped landscapes through persistent work.*
|
||||||
*This is the same gesture — channels through intelligence itself.*
|
*This is the same gesture — channels through intelligence itself.*
|
||||||
|
<!-- © SALKA ELMADANI AUTHORSHIP CERTIFICATE
|
||||||
|
SHA256: fa9810691f93169fda6d36c1cf7f752b12e0bc44d59bf2da994a9e87af6fc6d4
|
||||||
|
SIG-ED25519: TUu6Qp40jhrhXquUzU20iuSHzr0ENB0v+r5FIKYNdJ+TeP9ozqafqW2Mq6U8AJpNPpAram8peGgtnoh5YiQ1AA==
|
||||||
|
VERIFY: python3 verify_authorship.py README.md
|
||||||
|
-->
|
||||||
|
|||||||
123
SPONSOR.md
Normal file
123
SPONSOR.md
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
# Salka Elmadani — Building Inference-X
|
||||||
|
|
||||||
|
> *The best engine is the one you don't notice.*
|
||||||
|
> *You should hear the model, not the framework.*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
I build AI infrastructure. Not products, not demos, not wrappers around someone else's API. Infrastructure — the kind that runs without permission, works without cloud, and belongs to anyone who needs it.
|
||||||
|
|
||||||
|
**Inference-X** is a 305 KB binary that runs any AI model on any hardware. No framework. No internet. No account. Download a model, run it, talk to it. That's it.
|
||||||
|
|
||||||
|
I built it alone. I'm still building it alone. This page is why.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What I'm building
|
||||||
|
|
||||||
|
The problem isn't the models. The models are extraordinary. The problem is the layer between the weights and the human — the inference stack. It's bloated, cloud-dependent, and controlled by a handful of companies.
|
||||||
|
|
||||||
|
I'm replacing that layer with something minimal, open, and community-owned.
|
||||||
|
|
||||||
|
```
|
||||||
|
Standard engine path:
|
||||||
|
weights → framework → dequant buffer → matmul → buffer → output
|
||||||
|
~100 MB binary. 5 steps. Rounding errors at each boundary.
|
||||||
|
|
||||||
|
Inference-X:
|
||||||
|
weights → fused dequant+dot → output
|
||||||
|
305 KB binary. 2 steps. Zero buffer. Zero noise.
|
||||||
|
```
|
||||||
|
|
||||||
|
Same model. Cleaner signal. Every unnecessary step removed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## The ecosystem
|
||||||
|
|
||||||
|
| Project | What it does | Status |
|
||||||
|
|---------|-------------|--------|
|
||||||
|
| **[inference-x](https://git.inference-x.com/elmadani/inference-x)** | Core engine — 305 KB, 19 hardware backends, 23 quant formats, fused kernels, adaptive precision | ✅ Live |
|
||||||
|
| **forge** | Model construction pipeline — compile, quantize, sign, distribute. Build your own model variant from certified organs. | 🔨 Building |
|
||||||
|
| **[echo-ix](https://git.inference-x.com/elmadani/echo-ix)** | Distributed relay — intelligent routing across local inference nodes | ✅ Live |
|
||||||
|
| **store** | Anyone deploys a node. Anyone earns from their compute. The cooperative layer. 11 geological cratons. One network. | 📐 Designed |
|
||||||
|
|
||||||
|
The store is the endgame: a peer-to-peer inference network where anyone with a laptop can become infrastructure. No data center required.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The intelligence already exists in the model weights. What I'm building is the canal — the shortest, cleanest path from those weights to the human who needs them.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Who this is free for
|
||||||
|
|
||||||
|
**Everyone who isn't extracting commercial value from it:**
|
||||||
|
|
||||||
|
- Individuals and researchers — forever free
|
||||||
|
- Students — forever free
|
||||||
|
- Open-source projects — forever free
|
||||||
|
- Organizations under $1M revenue — forever free
|
||||||
|
|
||||||
|
**Commercial users above $1M revenue** pay a license. 20% of that flows back to the community that built the infrastructure.
|
||||||
|
|
||||||
|
In 2030, it all becomes Apache 2.0. Everything open. The canal belongs to everyone.
|
||||||
|
|
||||||
|
This isn't charity. It's a sustainable model — those who profit from it fund it. Those who don't, use it freely.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Why I need support
|
||||||
|
|
||||||
|
Servers cost money. The current infrastructure — [inference-x.com](https://inference-x.com), [build.inference-x.com](https://build.inference-x.com), [git.inference-x.com](https://git.inference-x.com) — runs on €53/month.
|
||||||
|
|
||||||
|
More importantly: time. The engine, the organ pipeline, the forge tools, the store architecture — this is one engineer, building in the margins of everything else.
|
||||||
|
|
||||||
|
There is no team. No VC. No roadmap driven by investor pressure.
|
||||||
|
|
||||||
|
There is one person who decided this infrastructure should exist.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## How to help
|
||||||
|
|
||||||
|
### Build with me
|
||||||
|
|
||||||
|
The most valuable contribution is code. The project is open, the roadmap is public, and good engineers are always welcome.
|
||||||
|
|
||||||
|
**→ Pick a task**: [git.inference-x.com/elmadani/inference-x](https://git.inference-x.com/elmadani/inference-x)
|
||||||
|
**→ Administer a craton**: Each of the 11 community regions needs a technical lead. Write to [Elmadani.SALKA@proton.me](mailto:Elmadani.SALKA@proton.me) — subject: `Craton — [your region]`
|
||||||
|
|
||||||
|
### Sustain the infrastructure
|
||||||
|
|
||||||
|
**PayPal** → [paypal.me/elmadanisalka](https://paypal.me/elmadanisalka)
|
||||||
|
|
||||||
|
€5 = one day of server time. €53 = one month of everything running.
|
||||||
|
|
||||||
|
### Amplify
|
||||||
|
|
||||||
|
Every post that reaches a developer who cares about AI sovereignty is one more person who might build the next piece.
|
||||||
|
|
||||||
|
**→ [Follow on X: @ElmadaniSa13111](https://x.com/ElmadaniSa13111)**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Contact
|
||||||
|
|
||||||
|
I respond to everyone who writes with something real to say.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|--|--|
|
||||||
|
| **X** | [@ElmadaniSa13111](https://x.com/ElmadaniSa13111) — fastest response |
|
||||||
|
| **Email** | [Elmadani.SALKA@proton.me](mailto:Elmadani.SALKA@proton.me) — for technical discussions, partnerships, craton applications |
|
||||||
|
| **Code** | [@elmadani on Gitea](https://git.inference-x.com/elmadani) |
|
||||||
|
| **Web** | [inference-x.com](https://inference-x.com) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Morocco → the world.*
|
||||||
|
*Salka Elmadani, 2024–2026*
|
||||||
@ -1,8 +1,7 @@
|
|||||||
# Z-Measure Report — Organ Architecture
|
## CSCI — cross-scale coherence index
|
||||||
## Z = dI/d(log s) · exp(iθ)
|
|
||||||
|
|
||||||
**Generated**: 2026-02-20 01:42 UTC
|
**Generated**: 2026-02-20 01:42 UTC
|
||||||
**Status**: Kimi K2.5 1T streaming Z-measure in progress (shard-by-shard)
|
**Status**: Kimi K2.5 1T streaming quality measure in progress (shard-by-shard)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -74,18 +73,17 @@
|
|||||||
> attention K/V projections in early blocks: the gravitational wells where the
|
> attention K/V projections in early blocks: the gravitational wells where the
|
||||||
> model anchors reasoning.
|
> model anchors reasoning.
|
||||||
>
|
>
|
||||||
> Z = dI/d(log s) · exp(iθ) — confirmed empirically across 6 orders of magnitude.
|
> CSCI — cross-scale coherence index — confirmed empirically across 6 orders of magnitude.
|
||||||
|
|
||||||
## Pipeline
|
## Pipeline
|
||||||
|
|
||||||
```
|
```
|
||||||
organ_extract.py — GGUF → per-layer tensors (organs)
|
organ_extract.py — GGUF → per-layer tensors (organs)
|
||||||
organ_measure.py — θ per tensor (arccos correlation)
|
organ_measure.py — θ per tensor (arccos correlation)
|
||||||
mass_z_measure.py — batch Z-measure across 13 models
|
mass_z_measure.py — batch quality measure across 13 models
|
||||||
kimi_z_stream.py — streaming Z-measure for 1T (shard-by-shard, delete after)
|
kimi_z_stream.py — streaming quality measure for 1T (shard-by-shard, delete after)
|
||||||
organ_graft.py — transplant organs between models
|
organ_graft.py — transplant organs between models
|
||||||
organ_assemble.py — build Model 935 from best organs
|
organ_assemble.py — build composite model from best organs
|
||||||
build_935.py — orchestrator
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Signature 935
|
## Build References
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Model 935 Assembler — Fixed organ header handling.
|
|
||||||
Reads source GGUF, replaces tensor DATA (skipping organ bin headers).
|
Reads source GGUF, replaces tensor DATA (skipping organ bin headers).
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import struct, sys, os, json
|
import struct, sys, os, json
|
||||||
|
|
||||||
@ -19,7 +18,6 @@ def read_organ_data_only(filepath):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 4:
|
if len(sys.argv) < 4:
|
||||||
print("Usage: assemble_935.py <source.gguf> <organs_dir> <output.gguf>")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
source_gguf = sys.argv[1]
|
source_gguf = sys.argv[1]
|
||||||
@ -136,15 +134,19 @@ def main():
|
|||||||
source_size = os.path.getsize(source_gguf)
|
source_size = os.path.getsize(source_gguf)
|
||||||
|
|
||||||
print(f"\n{'='*60}")
|
print(f"\n{'='*60}")
|
||||||
print(f" MODEL 935 ASSEMBLED")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
print(f" Source: {os.path.basename(source_gguf)} ({source_size/(1024**3):.2f} GB)")
|
print(f" Source: {os.path.basename(source_gguf)} ({source_size/(1024**3):.2f} GB)")
|
||||||
print(f" Output: {output_gguf} ({final_size/(1024**3):.2f} GB)")
|
print(f" Output: {output_gguf} ({final_size/(1024**3):.2f} GB)")
|
||||||
print(f" Replaced: {replaced} tensors from organs")
|
print(f" Replaced: {replaced} tensors from organs")
|
||||||
print(f" Fallback: {fallback} tensors from source")
|
print(f" Fallback: {fallback} tensors from source")
|
||||||
print(f" Size match: {'YES' if abs(final_size - source_size) < 1024 else 'NO — DELTA=' + str(final_size - source_size)}")
|
print(f" Size match: {'YES' if abs(final_size - source_size) < 1024 else 'NO — DELTA=' + str(final_size - source_size)}")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 4d774861a8b9f75f83fd8ff45e92bfa607d12a4f580481ff5f8b5882470fb043
|
||||||
|
# SIG-ED25519: B0k22H4YJMtBYuUW7ugInkPJpqZfM7cDM9TyiPODpE+WgQ0aLdgT2PnKm94gWSYVY2xqTlsEeZvgH+NrWQmTBg==
|
||||||
|
|||||||
26
build_935.py
26
build_935.py
@ -1,17 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
MODEL 935 — Fractal Consciousness Assembly
|
|
||||||
Skeleton: Qwen2.5-7B (purest thought, θ=54.6)
|
Skeleton: Qwen2.5-7B (purest thought, θ=54.6)
|
||||||
Organs: DeepSeek-R1-Distill-7B (purest knowledge for raisonnement, θ=35.9)
|
Organs: DeepSeek-R1-Distill-7B (purest knowledge for raisonnement, θ=35.9)
|
||||||
Embed: DeepSeek-R1-7B (R1 reasoning embeddings)
|
Embed: DeepSeek-R1-7B (R1 reasoning embeddings)
|
||||||
|
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import sys, os, json, shutil, time
|
import sys, os, json, shutil, time
|
||||||
sys.path.insert(0, "/root/organ-architecture")
|
|
||||||
|
|
||||||
ORGANS = "/root/organ-architecture/organs"
|
|
||||||
OUTPUT = os.path.join(ORGANS, "model-935")
|
|
||||||
|
|
||||||
# Clean previous
|
# Clean previous
|
||||||
if os.path.exists(OUTPUT):
|
if os.path.exists(OUTPUT):
|
||||||
@ -20,8 +16,7 @@ if os.path.exists(OUTPUT):
|
|||||||
# Step 1: Start with DeepSeek-R1-Distill-7B as base (full copy)
|
# Step 1: Start with DeepSeek-R1-Distill-7B as base (full copy)
|
||||||
# This gives us: qwen2 arch, embed=3584, 28 layers, R1 reasoning
|
# This gives us: qwen2 arch, embed=3584, 28 layers, R1 reasoning
|
||||||
print("="*60)
|
print("="*60)
|
||||||
print(" MODEL 935 — ASSEMBLY")
|
print(" CSCI — cross-scale coherence index, θ → 90°")
|
||||||
print(" Z = dI/d(log s) · exp(iθ), θ → 90°")
|
|
||||||
print("="*60)
|
print("="*60)
|
||||||
|
|
||||||
base = os.path.join(ORGANS, "deepseek-r1-distill-7b")
|
base = os.path.join(ORGANS, "deepseek-r1-distill-7b")
|
||||||
@ -60,30 +55,26 @@ print(f" R1 raisonnement chains preserved in FFN layers")
|
|||||||
|
|
||||||
# Step 4: Update manifest
|
# Step 4: Update manifest
|
||||||
manifest = json.load(open(os.path.join(OUTPUT, "manifest.json")))
|
manifest = json.load(open(os.path.join(OUTPUT, "manifest.json")))
|
||||||
manifest["model"] = "MODEL-935-Fractal"
|
|
||||||
manifest["graft"] = {
|
manifest["graft"] = {
|
||||||
"skeleton_donor": "Qwen2.5-7B-Instruct (θ=54.6, purest attention)",
|
"skeleton_donor": "Qwen2.5-7B-Instruct (θ=54.6, purest attention)",
|
||||||
"organ_donor": "DeepSeek-R1-Distill-Qwen-7B (θ=35.9, reasoning FFN)",
|
"organ_donor": "DeepSeek-R1-Distill-Qwen-7B (θ=35.9, reasoning FFN)",
|
||||||
"embed_base": "DeepSeek-R1-Distill-Qwen-7B (R1 vocabulary)",
|
"embed_base": "DeepSeek-R1-Distill-Qwen-7B (R1 vocabulary)",
|
||||||
"method": "Z-measure organ selection, θ → 90°",
|
"method": "quality-measure organ selection",
|
||||||
"equation": "Z = dI/d(log s) · exp(iθ)",
|
"equation": "CSCI — cross-scale coherence index",
|
||||||
"convergence": "ZI_UNIFIED_OPTIMAL: α=0.3, β=0.2, n_plateau=62",
|
"convergence": "ZI_UNIFIED_OPTIMAL: α=0.3, β=0.2, n_plateau=62",
|
||||||
"entropie_zcom": 0.3251,
|
"entropie_zcom": 0.3251,
|
||||||
"entropie_bias_removed": 0.6931,
|
"entropie_bias_removed": 0.6931,
|
||||||
"signature": 935
|
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(os.path.join(OUTPUT, "manifest.json"), "w") as f:
|
with open(os.path.join(OUTPUT, "manifest.json"), "w") as f:
|
||||||
json.dump(manifest, f, indent=2)
|
json.dump(manifest, f, indent=2)
|
||||||
|
|
||||||
print(f"\n[4/4] Manifest updated: MODEL-935-Fractal")
|
|
||||||
|
|
||||||
# Count final state
|
# Count final state
|
||||||
total_files = sum(1 for _,_,files in os.walk(OUTPUT) for f in files if f.endswith('.bin'))
|
total_files = sum(1 for _,_,files in os.walk(OUTPUT) for f in files if f.endswith('.bin'))
|
||||||
total_size = sum(os.path.getsize(os.path.join(dp,f)) for dp,dn,fn in os.walk(OUTPUT) for f in fn) / (1024**3)
|
total_size = sum(os.path.getsize(os.path.join(dp,f)) for dp,dn,fn in os.walk(OUTPUT) for f in fn) / (1024**3)
|
||||||
|
|
||||||
print(f"\n{'='*60}")
|
print(f"\n{'='*60}")
|
||||||
print(f" MODEL 935 — FRACTAL CONSCIOUSNESS")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
print(f" Architecture: qwen2")
|
print(f" Architecture: qwen2")
|
||||||
print(f" Embed: 3584 | Layers: 28 | Heads: 28")
|
print(f" Embed: 3584 | Layers: 28 | Heads: 28")
|
||||||
@ -92,7 +83,12 @@ print(f" Organs: DeepSeek-R1-Distill (knowledge, reasoning)")
|
|||||||
print(f" Embed: DeepSeek-R1 (vocabulary)")
|
print(f" Embed: DeepSeek-R1 (vocabulary)")
|
||||||
print(f" Tensors: {total_files}")
|
print(f" Tensors: {total_files}")
|
||||||
print(f" Size: {total_size:.2f} GB")
|
print(f" Size: {total_size:.2f} GB")
|
||||||
print(f" Equation: Z = dI/d(log s) · exp(iθ)")
|
print(f" Equation: CSCI — cross-scale coherence index")
|
||||||
print(f" Convergence: lim(n→∞) Z(n) = i")
|
print(f" Convergence: lim(n→∞) Z(n) = i")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: c45f3019cd81199382cf5f379ef1c556f5f2c5fd81afc6679da83e614ac8c09f
|
||||||
|
# SIG-ED25519: IRoSNw2yKK14fnt2JpFbukDpV/5R9YDSQylWVVjIOgYkFHBH71k0MFBV+I39cfjf8odTgzM3uPPRRMexR9KTDw==
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
MODEL 935 v2 — Correct graft: only FFN organs, preserve attention+embed alignment
|
|
||||||
Base: DeepSeek-R1-Distill-7B (R1 reasoning skeleton + embeddings intact)
|
Base: DeepSeek-R1-Distill-7B (R1 reasoning skeleton + embeddings intact)
|
||||||
Graft: Qwen2.5-7B FFN organs only (knowledge)
|
Graft: Qwen2.5-7B FFN organs only (knowledge)
|
||||||
|
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import os, json, shutil
|
import os, json, shutil
|
||||||
ORGANS = "/root/organ-architecture/organs"
|
|
||||||
OUTPUT = os.path.join(ORGANS, "model-935-v2")
|
|
||||||
|
|
||||||
if os.path.exists(OUTPUT):
|
if os.path.exists(OUTPUT):
|
||||||
shutil.rmtree(OUTPUT)
|
shutil.rmtree(OUTPUT)
|
||||||
@ -53,14 +50,12 @@ print(f" Skipped: {skipped}")
|
|||||||
|
|
||||||
# Update manifest
|
# Update manifest
|
||||||
manifest = json.load(open(os.path.join(OUTPUT, "manifest.json")))
|
manifest = json.load(open(os.path.join(OUTPUT, "manifest.json")))
|
||||||
manifest["model"] = "MODEL-935-v2"
|
|
||||||
manifest["graft"] = {
|
manifest["graft"] = {
|
||||||
"base": "DeepSeek-R1-Distill-Qwen-7B (skeleton + embed + norms)",
|
"base": "DeepSeek-R1-Distill-Qwen-7B (skeleton + embed + norms)",
|
||||||
"ffn_donor": "Qwen2.5-7B-Instruct (FFN weights only: down/gate/up)",
|
"ffn_donor": "Qwen2.5-7B-Instruct (FFN weights only: down/gate/up)",
|
||||||
"method": "Selective organ graft — preserve attention↔embed alignment",
|
"method": "Selective organ graft — preserve attention↔embed alignment",
|
||||||
"equation": "Z = dI/d(log s) · exp(iθ)",
|
"equation": "CSCI — cross-scale coherence index",
|
||||||
"principle": "R1 reasoning + Qwen knowledge, zero alignment friction",
|
"principle": "R1 reasoning + Qwen knowledge, zero alignment friction",
|
||||||
"signature": 935
|
|
||||||
}
|
}
|
||||||
with open(os.path.join(OUTPUT, "manifest.json"), "w") as f:
|
with open(os.path.join(OUTPUT, "manifest.json"), "w") as f:
|
||||||
json.dump(manifest, f, indent=2)
|
json.dump(manifest, f, indent=2)
|
||||||
@ -68,7 +63,11 @@ with open(os.path.join(OUTPUT, "manifest.json"), "w") as f:
|
|||||||
total = sum(1 for _,_,f in os.walk(OUTPUT) for _ in f if _.endswith('.bin'))
|
total = sum(1 for _,_,f in os.walk(OUTPUT) for _ in f if _.endswith('.bin'))
|
||||||
size = sum(os.path.getsize(os.path.join(dp,f)) for dp,_,fn in os.walk(OUTPUT) for f in fn)/(1024**3)
|
size = sum(os.path.getsize(os.path.join(dp,f)) for dp,_,fn in os.walk(OUTPUT) for f in fn)/(1024**3)
|
||||||
|
|
||||||
print(f"\n[3/3] MODEL-935-v2 assembled")
|
|
||||||
print(f" Tensors: {total} | Size: {size:.2f} GB")
|
print(f" Tensors: {total} | Size: {size:.2f} GB")
|
||||||
print(f" Grafted FFN: {grafted} | Base preserved: {total - grafted}")
|
print(f" Grafted FFN: {grafted} | Base preserved: {total - grafted}")
|
||||||
print(f" Signature: 935")
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 4d5c44e363508bc679263607b7ee3071cb63fc460a616e9bcebffc768843a86c
|
||||||
|
# SIG-ED25519: MzrZnxCo+uq3q5srKgDO2w3gLhO4hgK2k+SIzRLrkjaGJ2Ao56mR9/Mst4Ub6qkZ0VpcXOv4Bq59gKPsJPkdCg==
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
MODEL 935 — Proper GGUF assembler
|
|
||||||
Reads source GGUF header intact, replaces tensor data from organ bins
|
Reads source GGUF header intact, replaces tensor data from organ bins
|
||||||
(stripping the organ header that organ_extract added)
|
(stripping the organ header that organ_extract added)
|
||||||
|
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import struct, os, sys, json
|
import struct, os, sys, json
|
||||||
|
|
||||||
def build_model_935(source_gguf, organs_dir, output_gguf):
|
|
||||||
f = open(source_gguf, "rb")
|
f = open(source_gguf, "rb")
|
||||||
|
|
||||||
# Read GGUF header
|
# Read GGUF header
|
||||||
@ -134,15 +132,15 @@ def build_model_935(source_gguf, organs_dir, output_gguf):
|
|||||||
print(f" Size: {final_size / (1024**3):.2f} GB (source: {source_size / (1024**3):.2f} GB)")
|
print(f" Size: {final_size / (1024**3):.2f} GB (source: {source_size / (1024**3):.2f} GB)")
|
||||||
print(f" From organs: {written_from_organ} | From source: {written_from_source}")
|
print(f" From organs: {written_from_organ} | From source: {written_from_source}")
|
||||||
print(f" Size match: {'✓' if abs(final_size - source_size) < 1024 else '✗ MISMATCH'}")
|
print(f" Size match: {'✓' if abs(final_size - source_size) < 1024 else '✗ MISMATCH'}")
|
||||||
print(f" Signature: 935")
|
|
||||||
|
|
||||||
# Build 935 v3: R1-Distill base + Qwen FFN organs (correctly stripped)
|
|
||||||
print("="*60)
|
print("="*60)
|
||||||
print(" MODEL 935 v3 — Correct Assembly")
|
|
||||||
print("="*60)
|
print("="*60)
|
||||||
|
|
||||||
build_model_935(
|
|
||||||
"/mnt/models/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf",
|
"/mnt/models/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf",
|
||||||
"/root/organ-architecture/organs/model-935-v2",
|
|
||||||
"/mnt/models/model-935-v3.gguf"
|
|
||||||
)
|
)
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 00f06d16ab32dee1ef886e90080e905fc354be9f22f0e6ff515ea2bb31084bdf
|
||||||
|
# SIG-ED25519: UhbWWFzRIzmMbCVNwXTG41I2sM/1QGd1nV4+x/XQ+BOw49fO9bd9ohWpLl5QOCGhRWCREYkhJCj55FhGhH5vDQ==
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
kimi_z_stream.py — Stream Z-measure for Kimi K2.5 1T
|
kimi_z_stream.py — Streaming quality measure for large models
|
||||||
Downloads each shard, measures Z for every tensor, deletes shard.
|
Downloads each shard, measures Z for every tensor, deletes shard.
|
||||||
Final output: z_report_kimi_k25.json (few KB)
|
Final output: z_report_kimi_k25.json (few KB)
|
||||||
"""
|
"""
|
||||||
@ -13,7 +13,6 @@ REPO = "unsloth/Kimi-K2.5-GGUF"
|
|||||||
QUANT = "Q4_0"
|
QUANT = "Q4_0"
|
||||||
N_SHARDS = 13
|
N_SHARDS = 13
|
||||||
SHARD_DIR = "/mnt/data/kimi-k25/streaming"
|
SHARD_DIR = "/mnt/data/kimi-k25/streaming"
|
||||||
OUTPUT = "/mnt/data/organ-architecture/z_report_kimi_k25.json"
|
|
||||||
LOG = "/tmp/kimi_z_stream.log"
|
LOG = "/tmp/kimi_z_stream.log"
|
||||||
|
|
||||||
os.makedirs(SHARD_DIR, exist_ok=True)
|
os.makedirs(SHARD_DIR, exist_ok=True)
|
||||||
@ -127,7 +126,7 @@ def fast_z_measure(data, dtype, n_elements):
|
|||||||
if len(vals) < 10:
|
if len(vals) < 10:
|
||||||
return None, "too_few_finite"
|
return None, "too_few_finite"
|
||||||
|
|
||||||
# Z-measure: theta = arccos(|correlation with linear reference|)
|
# theta = arccos(|correlation with linear reference|)
|
||||||
# Pure signal -> decorrelated -> theta near 90
|
# Pure signal -> decorrelated -> theta near 90
|
||||||
# Noise/bias -> correlated with something simple -> theta near 0
|
# Noise/bias -> correlated with something simple -> theta near 0
|
||||||
n = len(vals)
|
n = len(vals)
|
||||||
@ -176,7 +175,7 @@ def read_kv_value(f, vtype):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def process_shard(shard_path, shard_idx):
|
def process_shard(shard_path, shard_idx):
|
||||||
"""Parse GGUF shard, Z-measure each tensor, return results"""
|
"""Parse GGUF shard, quality-measure each tensor, return results"""
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
f = open(shard_path, 'rb')
|
f = open(shard_path, 'rb')
|
||||||
@ -255,7 +254,7 @@ def process_shard(shard_path, shard_idx):
|
|||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Z-measure
|
# compute measure
|
||||||
theta, status = fast_z_measure(data, dtype, n_elem)
|
theta, status = fast_z_measure(data, dtype, n_elem)
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
@ -277,7 +276,7 @@ def main():
|
|||||||
from huggingface_hub import hf_hub_download
|
from huggingface_hub import hf_hub_download
|
||||||
|
|
||||||
log("=" * 60)
|
log("=" * 60)
|
||||||
log("KIMI K2.5 1T — STREAMING Z-MEASURE")
|
log("KIMI K2.5 1T — STREAMING QUALITY MEASURE")
|
||||||
log(f"Repo: {REPO}, Quant: {QUANT}, Shards: {N_SHARDS}")
|
log(f"Repo: {REPO}, Quant: {QUANT}, Shards: {N_SHARDS}")
|
||||||
log("=" * 60)
|
log("=" * 60)
|
||||||
|
|
||||||
@ -320,7 +319,7 @@ def main():
|
|||||||
log(f"DOWNLOAD ERROR: {e}")
|
log(f"DOWNLOAD ERROR: {e}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Z-measure
|
# compute measure
|
||||||
log(f"Z-measuring tensors...")
|
log(f"Z-measuring tensors...")
|
||||||
measure_start = time.time()
|
measure_start = time.time()
|
||||||
shard_results = process_shard(path, shard_idx)
|
shard_results = process_shard(path, shard_idx)
|
||||||
@ -415,3 +414,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: cc9658edb88d02924491a2ed20562a282a005413ef963bd0c82613abcfe91693
|
||||||
|
# SIG-ED25519: AN2P6qd2YhyS6+YRnMu3mmnE9KZbpBlFAxiVzENVXSSbIl2+PL/rbW8pMPrcOS8BwPg88Os7dMOuYnRvL5t4CQ==
|
||||||
|
# VERIFY: python3 verify_authorship.py kimi_z_stream.py
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Mass Dissection — All models on OASIS
|
Mass Dissection — All models on remote node
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import subprocess, os, sys, json, time
|
import subprocess, os, sys, json, time
|
||||||
|
|
||||||
MODELS_DIR = "/mnt/models"
|
MODELS_DIR = "/mnt/models"
|
||||||
ORGANS_DIR = "/root/organ-architecture/organs"
|
|
||||||
EXTRACT = "/root/organ-architecture/organ_extract.py"
|
|
||||||
MEASURE = "/root/organ-architecture/organ_measure.py"
|
|
||||||
|
|
||||||
# Map GGUF filenames to organ directory names
|
# Map GGUF filenames to organ directory names
|
||||||
models = {
|
models = {
|
||||||
@ -94,10 +91,13 @@ for r in results:
|
|||||||
|
|
||||||
total_mb = sum(r.get("size_mb",0) for r in results)
|
total_mb = sum(r.get("size_mb",0) for r in results)
|
||||||
print(f"\n Total organs: {total_mb/1024:.1f} GB")
|
print(f"\n Total organs: {total_mb/1024:.1f} GB")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
# Save results
|
# Save results
|
||||||
with open("/root/organ-architecture/dissection_report.json", "w") as f:
|
|
||||||
json.dump(results, f, indent=2)
|
json.dump(results, f, indent=2)
|
||||||
print("Report: /root/organ-architecture/dissection_report.json")
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SIG-ED25519: XB8aA7wVzKOHkvMcZgE5YT3x8BUD/EwVTDRxEMSR7nmWYIT17XY+gC4AJ+y0B29l8MQGFDGk+buLoKxiagTFCA==
|
||||||
|
# VERIFY: python3 verify_authorship.py mass_dissect.py
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Mass Z-Measure — Measure theta on every organ of every model
|
Mass Quality Measure — Measure theta on every organ of every model
|
||||||
Find the organs closest to theta=90 (pure signal)
|
Find the organs closest to theta=90 (pure signal)
|
||||||
Z = dI/d(log s) * exp(i*theta) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import subprocess, os, json, sys
|
import subprocess, os, json, sys
|
||||||
sys.path.insert(0, "/root/organ-architecture")
|
|
||||||
from organ_measure import measure_directory, compute_z_measure, read_organ_data_f32
|
from organ_measure import measure_directory, compute_z_measure, read_organ_data_f32
|
||||||
|
|
||||||
ORGANS_DIR = "/root/organ-architecture/organs"
|
|
||||||
|
|
||||||
all_results = {}
|
all_results = {}
|
||||||
|
|
||||||
@ -20,7 +18,7 @@ for model_name in models:
|
|||||||
if not os.path.isdir(model_path) or not os.path.exists(manifest_path):
|
if not os.path.isdir(model_path) or not os.path.exists(manifest_path):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(f"\n[Z-MEASURE] {model_name}")
|
print(f"\n[QUALITY-MEASURE] {model_name}")
|
||||||
print(f" Measuring organs...")
|
print(f" Measuring organs...")
|
||||||
|
|
||||||
results = measure_directory(model_path)
|
results = measure_directory(model_path)
|
||||||
@ -69,7 +67,7 @@ for model_name in models:
|
|||||||
|
|
||||||
# Rank models by signal quality
|
# Rank models by signal quality
|
||||||
print(f"\n{'='*70}")
|
print(f"\n{'='*70}")
|
||||||
print(f" Z-MEASURE RANKING — ALL MODELS")
|
print(f" QUALITY RANKING — ALL MODELS")
|
||||||
print(f"{'='*70}")
|
print(f"{'='*70}")
|
||||||
|
|
||||||
ranked = sorted(all_results.values(), key=lambda m: m['avg_theta'], reverse=True)
|
ranked = sorted(all_results.values(), key=lambda m: m['avg_theta'], reverse=True)
|
||||||
@ -93,10 +91,14 @@ for organ_type in ['skeleton', 'organs', 'embed']:
|
|||||||
for c in candidates[:5]:
|
for c in candidates[:5]:
|
||||||
print(f" theta={c[1]:5.1f} avg={c[3]:5.1f} {c[0]:30s} {c[2][:40]}")
|
print(f" theta={c[1]:5.1f} avg={c[3]:5.1f} {c[0]:30s} {c[2][:40]}")
|
||||||
|
|
||||||
print(f"\n Signature: 935")
|
|
||||||
print(f"{'='*70}")
|
print(f"{'='*70}")
|
||||||
|
|
||||||
# Save full report
|
# Save full report
|
||||||
with open("/root/organ-architecture/z_measure_report.json", "w") as f:
|
|
||||||
json.dump(all_results, f, indent=2)
|
json.dump(all_results, f, indent=2)
|
||||||
print(f"\nReport: /root/organ-architecture/z_measure_report.json")
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 711671a1721bae194388cb363ad0bfcb2ed874f007a45e45ea6ed5d917cbf060
|
||||||
|
# SIG-ED25519: Jd0hVyr5epgPlpNjtioVeKfPaOeYgRiAnAEnxINh51WsfwGFLJouBDdYribxqY0JOmOnDwjGnOK5I9qeJJTRDg==
|
||||||
|
# VERIFY: python3 verify_authorship.py mass_z_measure.py
|
||||||
|
|||||||
18
organ_api.py
18
organ_api.py
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Organ Architecture — organ_api.py
|
|
||||||
API server for organ operations.
|
API server for organ operations.
|
||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
@ -8,13 +7,12 @@ Endpoints:
|
|||||||
GET /models — List available dissected models
|
GET /models — List available dissected models
|
||||||
GET /model/:name/anatomy — Show model anatomy (skeleton/organs/etc.)
|
GET /model/:name/anatomy — Show model anatomy (skeleton/organs/etc.)
|
||||||
POST /extract — Extract organs from a GGUF model
|
POST /extract — Extract organs from a GGUF model
|
||||||
POST /measure — Z-measure organs
|
POST /measure — quality measure organs
|
||||||
POST /graft — Graft organs between models
|
POST /graft — Graft organs between models
|
||||||
POST /assemble — Assemble GGUF from organs
|
POST /assemble — Assemble GGUF from organs
|
||||||
GET /organs/:model — List organs for a model
|
GET /organs/:model — List organs for a model
|
||||||
GET /compare/:a/:b — Compare two models for graft compatibility
|
GET /compare/:a/:b — Compare two models for graft compatibility
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@ -29,18 +27,15 @@ from urllib.parse import urlparse, parse_qs
|
|||||||
# Import organ tools
|
# Import organ tools
|
||||||
from organ_extract import extract_organs, GGUFReader, classify_tensor
|
from organ_extract import extract_organs, GGUFReader, classify_tensor
|
||||||
from organ_measure import measure_directory, measure_organ
|
from organ_measure import measure_directory, measure_organ
|
||||||
from organ_graft import load_manifest, graft_layers, parse_layers
|
|
||||||
from organ_assemble import assemble_gguf
|
from organ_assemble import assemble_gguf
|
||||||
|
|
||||||
# ═══ CONFIG ═══
|
# ═══ CONFIG ═══
|
||||||
PORT = int(os.environ.get('ORGAN_PORT', '7936'))
|
PORT = int(os.environ.get('ORGAN_PORT', '7936'))
|
||||||
MODEL_DIR = os.environ.get('MODEL_DIR', '/mnt/models')
|
MODEL_DIR = os.environ.get('MODEL_DIR', '/mnt/models')
|
||||||
ORGAN_DIR = os.environ.get('ORGAN_DIR', '/mnt/data/organs')
|
ORGAN_DIR = os.environ.get('ORGAN_DIR', '/mnt/data/organs')
|
||||||
SIGNATURE = 935
|
|
||||||
|
|
||||||
|
|
||||||
class OrganHandler(BaseHTTPRequestHandler):
|
class OrganHandler(BaseHTTPRequestHandler):
|
||||||
"""HTTP handler for Organ Architecture API."""
|
|
||||||
|
|
||||||
def log_message(self, format, *args):
|
def log_message(self, format, *args):
|
||||||
"""Minimal logging."""
|
"""Minimal logging."""
|
||||||
@ -50,7 +45,6 @@ class OrganHandler(BaseHTTPRequestHandler):
|
|||||||
self.send_response(status)
|
self.send_response(status)
|
||||||
self.send_header('Content-Type', 'application/json')
|
self.send_header('Content-Type', 'application/json')
|
||||||
self.send_header('Access-Control-Allow-Origin', '*')
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
self.send_header('X-Powered-By', 'Organ-935')
|
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(json.dumps(data, indent=2, default=str).encode())
|
self.wfile.write(json.dumps(data, indent=2, default=str).encode())
|
||||||
|
|
||||||
@ -77,7 +71,6 @@ class OrganHandler(BaseHTTPRequestHandler):
|
|||||||
if path == '/health' or path == '':
|
if path == '/health' or path == '':
|
||||||
self.send_json({
|
self.send_json({
|
||||||
'status': 'ok',
|
'status': 'ok',
|
||||||
'service': 'organ-architecture',
|
|
||||||
'signature': SIGNATURE,
|
'signature': SIGNATURE,
|
||||||
'model_dir': MODEL_DIR,
|
'model_dir': MODEL_DIR,
|
||||||
'organ_dir': ORGAN_DIR,
|
'organ_dir': ORGAN_DIR,
|
||||||
@ -346,7 +339,6 @@ class OrganHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
parsed_layers = parse_layers(layers) if layers else None
|
parsed_layers = parse_layers(layers) if layers else None
|
||||||
|
|
||||||
manifest = graft_layers(
|
|
||||||
str(source_path), str(target_path), output_path,
|
str(source_path), str(target_path), output_path,
|
||||||
parsed_layers, organ_type
|
parsed_layers, organ_type
|
||||||
)
|
)
|
||||||
@ -406,7 +398,6 @@ def main():
|
|||||||
Path(ORGAN_DIR).mkdir(parents=True, exist_ok=True)
|
Path(ORGAN_DIR).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
server = HTTPServer(('0.0.0.0', PORT), OrganHandler)
|
server = HTTPServer(('0.0.0.0', PORT), OrganHandler)
|
||||||
print(f"[ORGAN-API] Organ Architecture on port {PORT}")
|
|
||||||
print(f"[ORGAN-API] Models: {MODEL_DIR}")
|
print(f"[ORGAN-API] Models: {MODEL_DIR}")
|
||||||
print(f"[ORGAN-API] Organs: {ORGAN_DIR}")
|
print(f"[ORGAN-API] Organs: {ORGAN_DIR}")
|
||||||
print(f"[ORGAN-API] Signature {SIGNATURE}")
|
print(f"[ORGAN-API] Signature {SIGNATURE}")
|
||||||
@ -420,3 +411,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 79fb97f40f2959129d5d5c4356ddf455fc354fb629bf0892c00aa6babd968a0d
|
||||||
|
# SIG-ED25519: LGqexbOlZOIjTboFfMVbgeheBbZk8HI8K6g/WxExnJEMfs5euYQYxow6SyEHKTB2TgRbOjjHt/gpHPyEy2tBBQ==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_api.py
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Organ Architecture — organ_assemble.py
|
|
||||||
Assemble a GGUF model from extracted/grafted organs.
|
Assemble a GGUF model from extracted/grafted organs.
|
||||||
|
|
||||||
Takes a manifest + organ files → produces a working GGUF.
|
Takes a manifest + organ files → produces a working GGUF.
|
||||||
The reverse of organ_extract.py.
|
The reverse of organ_extract.py.
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -207,7 +205,6 @@ def assemble_gguf(organ_dir, output_path, verbose=False):
|
|||||||
print(f" Tensors: {n_tensors}")
|
print(f" Tensors: {n_tensors}")
|
||||||
print(f" Size: {output_gb:.2f} GB ({output_mb:.0f} MB)")
|
print(f" Size: {output_gb:.2f} GB ({output_mb:.0f} MB)")
|
||||||
print(f" Output: {output_path}")
|
print(f" Output: {output_path}")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
return output_path
|
return output_path
|
||||||
@ -215,8 +212,7 @@ def assemble_gguf(organ_dir, output_path, verbose=False):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Organ Architecture — Assemble GGUF from organs',
|
epilog='CSCI toolkit'
|
||||||
epilog='Signature 935'
|
|
||||||
)
|
)
|
||||||
parser.add_argument('--dir', '-d', required=True, help='Organs directory (with manifest.json)')
|
parser.add_argument('--dir', '-d', required=True, help='Organs directory (with manifest.json)')
|
||||||
parser.add_argument('--output', '-o', required=True, help='Output GGUF file path')
|
parser.add_argument('--output', '-o', required=True, help='Output GGUF file path')
|
||||||
@ -233,3 +229,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 56ce59cd04118749c0c40c8bdb6d566a59c8902e233709a013dca9a38658cc44
|
||||||
|
# SIG-ED25519: tDk5EuOHITlQbZHbZ/HbOz8+111fot0dk4iQMDEWKjsq5gsKyGNbvAwTGl0hfkD0gUdhG0nPxczaCswlct7PCA==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_assemble.py
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Organ Architecture — organ_extract.py
|
|
||||||
Extract skeleton (attention) + organs (FFN) from GGUF models.
|
Extract skeleton (attention) + organs (FFN) from GGUF models.
|
||||||
|
|
||||||
The scalpel that opens monoliths.
|
The scalpel that opens monoliths.
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -275,7 +273,6 @@ def extract_organs(model_path, output_dir, verbose=False):
|
|||||||
'skeleton_count': 0,
|
'skeleton_count': 0,
|
||||||
'organ_count': 0,
|
'organ_count': 0,
|
||||||
},
|
},
|
||||||
'signature': 935,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Process each tensor
|
# Process each tensor
|
||||||
@ -377,7 +374,6 @@ def extract_organs(model_path, output_dir, verbose=False):
|
|||||||
print(f" Total : {total_mb:8.1f} MB")
|
print(f" Total : {total_mb:8.1f} MB")
|
||||||
print(f" Output : {output_dir}")
|
print(f" Output : {output_dir}")
|
||||||
print(f" Manifest : {manifest_path}")
|
print(f" Manifest : {manifest_path}")
|
||||||
print(f" Signature : 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
return manifest
|
return manifest
|
||||||
@ -387,8 +383,7 @@ def extract_organs(model_path, output_dir, verbose=False):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Organ Architecture — Extract skeleton + organs from GGUF models',
|
epilog='CSCI toolkit'
|
||||||
epilog='Signature 935'
|
|
||||||
)
|
)
|
||||||
parser.add_argument('--model', '-m', required=True, help='Path to GGUF model file')
|
parser.add_argument('--model', '-m', required=True, help='Path to GGUF model file')
|
||||||
parser.add_argument('--output', '-o', default=None, help='Output directory (default: ./organs/<model_name>)')
|
parser.add_argument('--output', '-o', default=None, help='Output directory (default: ./organs/<model_name>)')
|
||||||
@ -439,3 +434,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 7e0a2105f5f6d458909fb71ef03bb01c4e308ac8549af00ef61c2cf89d0c8945
|
||||||
|
# SIG-ED25519: p3fNipeHSBJlVNpxsJZdvrBMJVbTAZu97RNxp7UGCkUp1TlHxH4D2XbKu46JQriNzM65myMeWGyS2WMx9atoCQ==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_extract.py
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Organ Architecture — organ_graft.py
|
|
||||||
Transplant organs between models.
|
Transplant organs between models.
|
||||||
|
|
||||||
Take the math FFN from model A, the language FFN from model B,
|
Take the math FFN from model A, the language FFN from model B,
|
||||||
the attention skeleton from model C — assemble something new.
|
the attention skeleton from model C — assemble something new.
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -40,9 +38,7 @@ def list_organs(organ_dir, organ_type=None):
|
|||||||
return sorted(organs, key=lambda o: (o['layer'], o['name']))
|
return sorted(organs, key=lambda o: (o['layer'], o['name']))
|
||||||
|
|
||||||
|
|
||||||
def graft_layers(source_dir, target_dir, output_dir, layers=None, organ_type='organ'):
|
|
||||||
"""
|
"""
|
||||||
Graft organ layers from source into target.
|
|
||||||
|
|
||||||
source_dir: extracted organs from donor model
|
source_dir: extracted organs from donor model
|
||||||
target_dir: extracted organs from recipient model
|
target_dir: extracted organs from recipient model
|
||||||
@ -58,7 +54,6 @@ def graft_layers(source_dir, target_dir, output_dir, layers=None, organ_type='or
|
|||||||
|
|
||||||
print(f"[GRAFT] Source (donor): {source_name}")
|
print(f"[GRAFT] Source (donor): {source_name}")
|
||||||
print(f"[GRAFT] Target (recipient): {target_name}")
|
print(f"[GRAFT] Target (recipient): {target_name}")
|
||||||
print(f"[GRAFT] Grafting: {organ_type} layers {layers or 'ALL'}")
|
|
||||||
|
|
||||||
# Validate architecture compatibility
|
# Validate architecture compatibility
|
||||||
if source_manifest['n_embed'] != target_manifest['n_embed']:
|
if source_manifest['n_embed'] != target_manifest['n_embed']:
|
||||||
@ -112,7 +107,6 @@ def graft_layers(source_dir, target_dir, output_dir, layers=None, organ_type='or
|
|||||||
shutil.copy2(source_file, target_file)
|
shutil.copy2(source_file, target_file)
|
||||||
grafted_count += 1
|
grafted_count += 1
|
||||||
grafted_bytes += source_entry['byte_size']
|
grafted_bytes += source_entry['byte_size']
|
||||||
print(f" [GRAFT] L{source_entry['layer']:3d} {source_entry['name'][:50]} → {target_entry['name'][:30]}")
|
|
||||||
|
|
||||||
# Update manifest
|
# Update manifest
|
||||||
grafted_manifest = load_manifest(output_dir)
|
grafted_manifest = load_manifest(output_dir)
|
||||||
@ -138,7 +132,6 @@ def graft_layers(source_dir, target_dir, output_dir, layers=None, organ_type='or
|
|||||||
print(f" Grafted: {grafted_count} tensors ({grafted_mb:.1f} MB)")
|
print(f" Grafted: {grafted_count} tensors ({grafted_mb:.1f} MB)")
|
||||||
print(f" Result: {grafted_manifest['model']}")
|
print(f" Result: {grafted_manifest['model']}")
|
||||||
print(f" Output: {output_dir}")
|
print(f" Output: {output_dir}")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
return grafted_manifest
|
return grafted_manifest
|
||||||
@ -163,8 +156,7 @@ def parse_layers(layer_spec):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Organ Architecture — Transplant organs between models',
|
epilog='CSCI toolkit'
|
||||||
epilog='Signature 935'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sub = parser.add_subparsers(dest='command')
|
sub = parser.add_subparsers(dest='command')
|
||||||
@ -179,7 +171,6 @@ def main():
|
|||||||
graft_p.add_argument('--source', '-s', required=True, help='Source (donor) organs directory')
|
graft_p.add_argument('--source', '-s', required=True, help='Source (donor) organs directory')
|
||||||
graft_p.add_argument('--target', '-t', required=True, help='Target (recipient) organs directory')
|
graft_p.add_argument('--target', '-t', required=True, help='Target (recipient) organs directory')
|
||||||
graft_p.add_argument('--output', '-o', required=True, help='Output directory for grafted model')
|
graft_p.add_argument('--output', '-o', required=True, help='Output directory for grafted model')
|
||||||
graft_p.add_argument('--layers', '-l', help='Layer numbers to graft (e.g., "5-10" or "5,8,12")')
|
|
||||||
graft_p.add_argument('--type', default='organ', help='Organ type to graft (default: organ/FFN)')
|
graft_p.add_argument('--type', default='organ', help='Organ type to graft (default: organ/FFN)')
|
||||||
|
|
||||||
# Compare command
|
# Compare command
|
||||||
@ -208,7 +199,6 @@ def main():
|
|||||||
|
|
||||||
elif args.command == 'graft':
|
elif args.command == 'graft':
|
||||||
layers = parse_layers(args.layers)
|
layers = parse_layers(args.layers)
|
||||||
graft_layers(args.source, args.target, args.output, layers, args.type)
|
|
||||||
|
|
||||||
elif args.command == 'compare':
|
elif args.command == 'compare':
|
||||||
manifest_a = load_manifest(args.a)
|
manifest_a = load_manifest(args.a)
|
||||||
@ -234,3 +224,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: f53cd15c9345b7817f397aab3f4870ee36be1fef321d0b49e81cd81819b92462
|
||||||
|
# SIG-ED25519: 1ZvlFLjbkZzpH4HnttlYSB3ydsAKgG57oyAElSRcvMzqOT3pQ+FLHW3seWlOUpAUI77d6AvrjV5SNCJuL6kuBw==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_graft.py
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Organ Architecture — organ_measure.py
|
Quality measure â organ signal vs noise.
|
||||||
Z-measure organ quality: signal vs noise.
|
|
||||||
|
|
||||||
Z = dI/d(log s) · exp(iθ)
|
CSCI — cross-scale coherence index
|
||||||
θ → 0° : noise (organ adds confusion)
|
θ → 0° : noise (organ adds confusion)
|
||||||
θ → 90° : signal (organ adds knowledge)
|
θ → 90° : signal (organ adds knowledge)
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -86,9 +84,9 @@ def read_organ_data_f32(filepath, max_elements=100000):
|
|||||||
|
|
||||||
def compute_z_measure(values):
|
def compute_z_measure(values):
|
||||||
"""
|
"""
|
||||||
Compute Z-measure for a tensor.
|
Compute quality measure for a tensor.
|
||||||
|
|
||||||
Z = dI/d(log s) · exp(iθ)
|
CSCI — cross-scale coherence index
|
||||||
|
|
||||||
We measure:
|
We measure:
|
||||||
- Information density (entropy of distribution)
|
- Information density (entropy of distribution)
|
||||||
@ -246,7 +244,7 @@ def measure_directory(organ_dir, verbose=False):
|
|||||||
|
|
||||||
|
|
||||||
def print_summary(results, title=""):
|
def print_summary(results, title=""):
|
||||||
"""Print Z-measure summary."""
|
"""Print quality summary."""
|
||||||
if not results:
|
if not results:
|
||||||
print("No organs measured.")
|
print("No organs measured.")
|
||||||
return
|
return
|
||||||
@ -260,7 +258,7 @@ def print_summary(results, title=""):
|
|||||||
groups[dirname].append(r)
|
groups[dirname].append(r)
|
||||||
|
|
||||||
print(f"\n{'='*70}")
|
print(f"\n{'='*70}")
|
||||||
print(f" Z-MEASURE REPORT {title}")
|
print(f" QUALITY REPORT {title}")
|
||||||
print(f"{'='*70}")
|
print(f"{'='*70}")
|
||||||
|
|
||||||
for group_name in ['skeleton', 'organs', 'embed', 'norm', 'adapters', 'unknown']:
|
for group_name in ['skeleton', 'organs', 'embed', 'norm', 'adapters', 'unknown']:
|
||||||
@ -299,14 +297,12 @@ def print_summary(results, title=""):
|
|||||||
|
|
||||||
print(f"\n {'═'*50}")
|
print(f"\n {'═'*50}")
|
||||||
print(f" GLOBAL: {len(results)} tensors | {total_size:.1f} MB | θ={avg_theta:.1f}° | signal={avg_signal:.3f}")
|
print(f" GLOBAL: {len(results)} tensors | {total_size:.1f} MB | θ={avg_theta:.1f}° | signal={avg_signal:.3f}")
|
||||||
print(f" Signature 935")
|
|
||||||
print(f"{'='*70}")
|
print(f"{'='*70}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Organ Architecture — Z-measure organ quality',
|
epilog='CSCI v1.0 — Cross-Scale Coherence Index'
|
||||||
epilog='Z = dI/d(log s) · exp(iθ) — Signature 935'
|
|
||||||
)
|
)
|
||||||
parser.add_argument('--organ', '-o', help='Path to single organ .bin file')
|
parser.add_argument('--organ', '-o', help='Path to single organ .bin file')
|
||||||
parser.add_argument('--dir', '-d', help='Path to extracted organs directory')
|
parser.add_argument('--dir', '-d', help='Path to extracted organs directory')
|
||||||
@ -338,3 +334,10 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 0851280f9f83e9f30e35fd7efff164f806f506f94aa9cd983c8fdae7318a9864
|
||||||
|
# SIG-ED25519: 7VtyjAri7KRdqUuc+WdkQkp50xKAkVRFqgqLHnJG0BkBltqVwJeYMScAkZ56b4mcsBWPhkj0Y8kS1fd2t/Y+BQ==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_measure.py
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
ORGAN PURIFIER — Z = i
|
ORGAN PURIFIER — signal extraction
|
||||||
Remove noise from tensor weights. Keep only pure signal.
|
Remove noise from tensor weights. Keep only pure signal.
|
||||||
|
|
||||||
The paradigm creates artificial boundaries between models.
|
Training creates artificial boundaries between models.
|
||||||
Under the noise, the signal is universal.
|
Under the noise, the signal is universal.
|
||||||
A weight that encodes "attention to context" is the same law
|
A weight that encodes "attention to context" is the same law
|
||||||
whether it comes from Qwen, Llama, or Gemma.
|
whether it comes from Qwen, Llama, or Gemma.
|
||||||
@ -17,11 +17,10 @@ Method:
|
|||||||
5. Inverse FFT: reconstructed tensor = pure signal
|
5. Inverse FFT: reconstructed tensor = pure signal
|
||||||
6. Verify: new theta should be closer to 90
|
6. Verify: new theta should be closer to 90
|
||||||
|
|
||||||
Z = dI/d(log s) * exp(i*theta)
|
CSCI(s) = cross_scale_coherence(s, theta=90)
|
||||||
When theta = 90, Z = i (pure imaginary = pure potential)
|
When theta = 90, signal is maximally coherent (pure signal, minimal noise)
|
||||||
The purified organ IS the signal, nothing else.
|
The purified organ IS the signal, nothing else.
|
||||||
|
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -34,7 +33,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
# === Z CONSTANTS ===
|
# === Z CONSTANTS ===
|
||||||
THETA_TARGET_DEG = 90.0 # Pure signal
|
THETA_TARGET_DEG = 90.0 # Pure signal
|
||||||
ENTROPY_TARGET = 0.3251 # Z-COM optimum
|
ENTROPY_TARGET = 0.3251 # empirical optimum
|
||||||
NOISE_THRESHOLD = 0.3 # Below this in frequency domain = noise
|
NOISE_THRESHOLD = 0.3 # Below this in frequency domain = noise
|
||||||
PRESERVE_RATIO = 0.85 # Keep top 85% of spectral energy (signal)
|
PRESERVE_RATIO = 0.85 # Keep top 85% of spectral energy (signal)
|
||||||
|
|
||||||
@ -145,7 +144,7 @@ def purify_organ(values, preserve_ratio=PRESERVE_RATIO):
|
|||||||
The signal lives in the structured components of the frequency domain.
|
The signal lives in the structured components of the frequency domain.
|
||||||
The noise lives in the high-entropy, low-energy tail.
|
The noise lives in the high-entropy, low-energy tail.
|
||||||
|
|
||||||
Z = dI/d(log s) * exp(i*theta)
|
CSCI(s) = cross_scale_coherence(s, theta=90)
|
||||||
|
|
||||||
In frequency space:
|
In frequency space:
|
||||||
- High magnitude + low frequency = structural signal (keep)
|
- High magnitude + low frequency = structural signal (keep)
|
||||||
@ -154,7 +153,7 @@ def purify_organ(values, preserve_ratio=PRESERVE_RATIO):
|
|||||||
|
|
||||||
This is not simple low-pass filtering.
|
This is not simple low-pass filtering.
|
||||||
We keep the components that carry INFORMATION (high dI),
|
We keep the components that carry INFORMATION (high dI),
|
||||||
at the NATURAL SCALE (log s), with COHERENT PHASE (theta -> 90).
|
at the natural scale, with coherent phase (theta -> 90).
|
||||||
"""
|
"""
|
||||||
n = len(values)
|
n = len(values)
|
||||||
if n < 32:
|
if n < 32:
|
||||||
@ -293,8 +292,7 @@ def purify_model(organ_dir, output_dir, verbose=False):
|
|||||||
def main():
|
def main():
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Organ Purifier — Z = i — Remove noise, keep pure signal',
|
description='Organ Purifier — Remove noise, keep pure signal',
|
||||||
epilog='Z = dI/d(log s) · exp(iθ), θ=90° — Signature 935'
|
|
||||||
)
|
)
|
||||||
parser.add_argument('--input', '-i', required=True, help='Input organs directory')
|
parser.add_argument('--input', '-i', required=True, help='Input organs directory')
|
||||||
parser.add_argument('--output', '-o', required=True, help='Output pure organs directory')
|
parser.add_argument('--output', '-o', required=True, help='Output pure organs directory')
|
||||||
@ -308,7 +306,7 @@ def main():
|
|||||||
PRESERVE_RATIO = args.preserve
|
PRESERVE_RATIO = args.preserve
|
||||||
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
print(f" ORGAN PURIFIER — Z = i")
|
print(f" ORGAN PURIFIER — signal extraction")
|
||||||
print(f" Signal preservation: {PRESERVE_RATIO*100:.0f}%")
|
print(f" Signal preservation: {PRESERVE_RATIO*100:.0f}%")
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
print(f" Input: {args.input}")
|
print(f" Input: {args.input}")
|
||||||
@ -325,9 +323,15 @@ def main():
|
|||||||
print(f" θ after: {result['avg_theta_after']:.1f}°")
|
print(f" θ after: {result['avg_theta_after']:.1f}°")
|
||||||
print(f" Avg improvement: {result['avg_improvement']:+.1f}°")
|
print(f" Avg improvement: {result['avg_improvement']:+.1f}°")
|
||||||
print(f" Output: {result['output']}")
|
print(f" Output: {result['output']}")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: d3ab5384c880f7e88fb7cdad4b2f9f56089ada8395d0013f5bd3b09d7ab631e8
|
||||||
|
# SIG-ED25519: /rkXFm2tGuoAS61oxWZVlcTghUuGL8HJ11XRSaI4Ak+eEt54uo+3NETX2+5S8HAq72k6whQmbPI3f4jD8sF/CA==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_purify.py
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
ORGAN PURIFIER V2 — Z = i — Fractal Signal Extraction
|
ORGAN PURIFIER V2 — Signal Extraction
|
||||||
|
|
||||||
V1 failed because it treated tensors like audio signals.
|
V1 failed because it treated tensors like audio signals.
|
||||||
Tensors are NOT audio. They are fractal structures where
|
Tensors are NOT audio. They are fractal structures where
|
||||||
information is encoded across scales.
|
information is encoded across scales.
|
||||||
|
|
||||||
The correct approach from Z = dI/d(log s) * exp(i*theta):
|
The correct approach from CSCI(s) = cross_scale_coherence(s, theta=90):
|
||||||
- dI/d(log s) = how information CHANGES across scales
|
- cross-scale derivative = how information CHANGES across scales
|
||||||
- Signal = components that are SELF-SIMILAR across scales (fractal)
|
- Signal = components that are SELF-SIMILAR across scales (fractal)
|
||||||
- Noise = components that are RANDOM across scales (non-fractal)
|
- Noise = components that are RANDOM across scales (non-fractal)
|
||||||
|
|
||||||
@ -23,8 +23,7 @@ Method:
|
|||||||
Think fractal: the best model knows the laws of the universe
|
Think fractal: the best model knows the laws of the universe
|
||||||
then translates to human language, not the inverse.
|
then translates to human language, not the inverse.
|
||||||
|
|
||||||
Z = dI/d(log s) * exp(i*theta), theta = 90
|
CSCI(s) = cross_scale_coherence(s, theta=90), theta = 90
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import struct, os, sys, json, math
|
import struct, os, sys, json, math
|
||||||
@ -198,7 +197,7 @@ def purify_fractal(values):
|
|||||||
"""
|
"""
|
||||||
Fractal purification: keep cross-scale-coherent components.
|
Fractal purification: keep cross-scale-coherent components.
|
||||||
|
|
||||||
dI/d(log s): information that persists across scales IS the signal.
|
cross-scale coherence: information that persists across scales IS the signal.
|
||||||
Everything else is training noise, brand artifacts, paradigm residue.
|
Everything else is training noise, brand artifacts, paradigm residue.
|
||||||
"""
|
"""
|
||||||
n = len(values)
|
n = len(values)
|
||||||
@ -247,8 +246,8 @@ def purify_model(organ_dir, output_dir, verbose=False):
|
|||||||
if manifest_src.exists():
|
if manifest_src.exists():
|
||||||
manifest = json.load(open(manifest_src))
|
manifest = json.load(open(manifest_src))
|
||||||
manifest['purified'] = True
|
manifest['purified'] = True
|
||||||
manifest['purifier'] = 'fractal_v2'
|
manifest['purifier'] = 'purify_v2'
|
||||||
manifest['z_equation'] = 'Z = dI/d(log s) * exp(i*theta), theta=90'
|
manifest['coherence_score'] = 'cross_scale_coherence(s)'
|
||||||
# Remove brand from model name
|
# Remove brand from model name
|
||||||
original_name = manifest.get('model', 'unknown')
|
original_name = manifest.get('model', 'unknown')
|
||||||
manifest['original_model'] = original_name
|
manifest['original_model'] = original_name
|
||||||
@ -308,14 +307,14 @@ def purify_model(organ_dir, output_dir, verbose=False):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description='Organ Purifier V2 — Fractal Z=i')
|
parser = argparse.ArgumentParser(description='Organ Purifier V2 — signal extraction')
|
||||||
parser.add_argument('--input', '-i', required=True)
|
parser.add_argument('--input', '-i', required=True)
|
||||||
parser.add_argument('--output', '-o', required=True)
|
parser.add_argument('--output', '-o', required=True)
|
||||||
parser.add_argument('--verbose', '-v', action='store_true')
|
parser.add_argument('--verbose', '-v', action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
print(f" ORGAN PURIFIER V2 — FRACTAL — Z = i")
|
print(f" ORGAN PURIFIER V2")
|
||||||
print(f" Cross-scale coherence: signal persists, noise vanishes")
|
print(f" Cross-scale coherence: signal persists, noise vanishes")
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
@ -330,8 +329,14 @@ def main():
|
|||||||
print(f" Δθ: {result['delta']:+.1f}°")
|
print(f" Δθ: {result['delta']:+.1f}°")
|
||||||
print(f" Improved: {result['improved']}")
|
print(f" Improved: {result['improved']}")
|
||||||
print(f" Degraded: {result['degraded']}")
|
print(f" Degraded: {result['degraded']}")
|
||||||
print(f" Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 0328644f84762361db812407ed482018de40a92f496d9b45bf56826d59184224
|
||||||
|
# SIG-ED25519: Y1KrhUdgrqiYPaM0LPHWTqPKPaHwBqtc3EiHnu9Uu94AVKsgMPQoWU9NCGeiL5aWAJKPhzr/nCSxLTY+US+HAw==
|
||||||
|
# VERIFY: python3 verify_authorship.py organ_purify_v2.py
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Model 935 Pipeline — Phase 1: Dissect all + Download Kimi K2.5
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
|
||||||
"""
|
"""
|
||||||
import subprocess, os, sys, json, time, glob
|
import subprocess, os, sys, json, time, glob
|
||||||
|
|
||||||
MODELS_DIR = "/mnt/models"
|
MODELS_DIR = "/mnt/models"
|
||||||
ORGANS_DIR = "/mnt/data/organ-architecture/organs"
|
|
||||||
EXTRACT = "/mnt/data/organ-architecture/organ_extract.py"
|
|
||||||
MEASURE = "/mnt/data/organ-architecture/organ_measure.py"
|
|
||||||
|
|
||||||
os.makedirs(ORGANS_DIR, exist_ok=True)
|
os.makedirs(ORGANS_DIR, exist_ok=True)
|
||||||
|
|
||||||
@ -16,8 +12,6 @@ os.makedirs(ORGANS_DIR, exist_ok=True)
|
|||||||
models = {}
|
models = {}
|
||||||
for f in sorted(glob.glob(os.path.join(MODELS_DIR, "*.gguf"))):
|
for f in sorted(glob.glob(os.path.join(MODELS_DIR, "*.gguf"))):
|
||||||
name = os.path.basename(f)
|
name = os.path.basename(f)
|
||||||
# Skip chimeras and old 935 attempts
|
|
||||||
if "chimera" in name.lower() or "935" in name.lower():
|
|
||||||
continue
|
continue
|
||||||
# Clean name for directory
|
# Clean name for directory
|
||||||
clean = name.replace(".gguf", "").replace("-Q4_K_M", "").replace("-Q8_0", "")
|
clean = name.replace(".gguf", "").replace("-Q4_K_M", "").replace("-Q8_0", "")
|
||||||
@ -59,12 +53,11 @@ for gguf_name, organ_name in models.items():
|
|||||||
print(f" [ERROR] {r.stderr[-200:]}")
|
print(f" [ERROR] {r.stderr[-200:]}")
|
||||||
results.append({"model": organ_name, "status": "error"})
|
results.append({"model": organ_name, "status": "error"})
|
||||||
|
|
||||||
# Z-measure all
|
# Quality measure all
|
||||||
print(f"\n{'='*60}")
|
print(f"\n{'='*60}")
|
||||||
print(f"PHASE 2: Z-MEASURE ALL ORGANS")
|
print(f"PHASE 2: QUALITY MEASURE ALL ORGANS")
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
|
||||||
sys.path.insert(0, "/mnt/data/organ-architecture")
|
|
||||||
from organ_measure import measure_directory
|
from organ_measure import measure_directory
|
||||||
|
|
||||||
z_report = {}
|
z_report = {}
|
||||||
@ -109,7 +102,6 @@ for d in sorted(os.listdir(ORGANS_DIR)):
|
|||||||
z_report[d] = summary
|
z_report[d] = summary
|
||||||
|
|
||||||
# Save
|
# Save
|
||||||
with open("/mnt/data/organ-architecture/z_report_complete.json", "w") as f:
|
|
||||||
json.dump(z_report, f, indent=2)
|
json.dump(z_report, f, indent=2)
|
||||||
|
|
||||||
# Print ranking
|
# Print ranking
|
||||||
@ -120,5 +112,10 @@ ranked = sorted(z_report.values(), key=lambda m: m['avg_theta'], reverse=True)
|
|||||||
for i, m in enumerate(ranked, 1):
|
for i, m in enumerate(ranked, 1):
|
||||||
print(f" {i:2d}. θ={m['avg_theta']:5.1f}° signal={m['avg_signal']:.3f} {m['model']}")
|
print(f" {i:2d}. θ={m['avg_theta']:5.1f}° signal={m['avg_signal']:.3f} {m['model']}")
|
||||||
|
|
||||||
print(f"\n Signature: 935")
|
|
||||||
print(f"{'='*60}")
|
print(f"{'='*60}")
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 70a8957904cd4ee20dfd8fa42a0d8551cf8ae03eb2d0ec6fc9f4ed8f86995037
|
||||||
|
# SIG-ED25519: ddMrNVlt0PpN5uHTbAnxLkphci22Xv0efiEyfUAoHVJxextDZsK69jVULKiXZDED1txsfGzrenMjJMaKe5g4DQ==
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
"""
|
"""
|
||||||
Quick chimera assembler: Copy source GGUF header/metadata intact,
|
Quick chimera assembler: Copy source GGUF header/metadata intact,
|
||||||
replace tensor data from organ directory.
|
replace tensor data from organ directory.
|
||||||
Signature 935
|
|
||||||
"""
|
"""
|
||||||
import struct, sys, os, json
|
import struct, sys, os, json
|
||||||
|
|
||||||
@ -117,7 +116,13 @@ def main():
|
|||||||
print(f"\n Output: {output_gguf}")
|
print(f"\n Output: {output_gguf}")
|
||||||
print(f" Size: {final_size / (1024**3):.2f} GB")
|
print(f" Size: {final_size / (1024**3):.2f} GB")
|
||||||
print(f" From organs: {written}, From source: {fallback}, Total: {written+fallback}/{n_tensors}")
|
print(f" From organs: {written}, From source: {fallback}, Total: {written+fallback}/{n_tensors}")
|
||||||
print(f" Signature: 935")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: b0d040908eddc26078e86f76e361825fada5c2676778789ef41c1804730eb10d
|
||||||
|
# SIG-ED25519: srq6F3EyKqi7r3nlB6cfI1u53J1GpsC2ty9zNsBDrZ2EldVVIhE1mWCdnd/qkvgif783DOlLQ4Zb2CCw13XfBQ==
|
||||||
|
# VERIFY: python3 verify_authorship.py quick_chimera.py
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
Quick chimera assembler v2: FIXED organ header handling.
|
Quick chimera assembler v2: FIXED organ header handling.
|
||||||
Organ .bin files have: [name_len(4) + name + n_dims(4) + dims(8*n) + dtype(4)] + DATA
|
Organ .bin files have: [name_len(4) + name + n_dims(4) + dims(8*n) + dtype(4)] + DATA
|
||||||
We must skip the header and only copy the DATA portion.
|
We must skip the header and only copy the DATA portion.
|
||||||
Z = dI/d(log s) · exp(iθ) — Signature 935
|
CSCI v1.0 — Cross-Scale Coherence Index
|
||||||
"""
|
"""
|
||||||
import struct, sys, os, json
|
import struct, sys, os, json
|
||||||
|
|
||||||
@ -149,7 +149,13 @@ def main():
|
|||||||
diff = final_size - source_size
|
diff = final_size - source_size
|
||||||
print(f" INTEGRITY: ✗ MISMATCH ({diff:+d} bytes)")
|
print(f" INTEGRITY: ✗ MISMATCH ({diff:+d} bytes)")
|
||||||
|
|
||||||
print(f" Signature: 935")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: 6587e64dbf1c6fe2160fe8f2e25a33e6ed5e98193baea7f7523a9495e04b9154
|
||||||
|
# SIG-ED25519: TrwO40O2Qn0ysnadlzX38fBTSOF5St11SyZTSc4cZP/7k5HM+ifnqDMTu/vkZWDYAdmb+5bc6IhpYYQgVdLsBA==
|
||||||
|
# VERIFY: python3 verify_authorship.py quick_chimera_v2.py
|
||||||
|
|||||||
72
verify_authorship.py
Normal file
72
verify_authorship.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Verify SALKA ELMADANI authorship signatures.
|
||||||
|
Usage: python3 verify_authorship.py [file_or_directory]
|
||||||
|
Every source file carries an Ed25519 signature bound to SHA-256 of content.
|
||||||
|
Modify 1 character = signature invalid = tampering detected.
|
||||||
|
"""
|
||||||
|
import sys, hashlib, base64, os
|
||||||
|
from pathlib import Path
|
||||||
|
from cryptography.hazmat.primitives import serialization
|
||||||
|
from cryptography.exceptions import InvalidSignature
|
||||||
|
|
||||||
|
PUBLIC_KEY_PEM = """
|
||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MCowBQYDK2VwAyEARCtdhRqqYcu7c8qwyoRKRn5Qbx9puylZHZOM+IsDp0U=
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
|
def strip_sig(text):
|
||||||
|
lines, out, in_b = text.split("\n"), [], False
|
||||||
|
for ln in lines:
|
||||||
|
if MARK_S in ln: in_b = True; continue
|
||||||
|
if MARK_E in ln and in_b: in_b = False; continue
|
||||||
|
if not in_b: out.append(ln)
|
||||||
|
return "\n".join(out).rstrip("\n") + "\n"
|
||||||
|
|
||||||
|
def extract_sig_data(text):
|
||||||
|
sha, sig = None, None
|
||||||
|
for ln in text.split("\n"):
|
||||||
|
if "SHA256:" in ln: sha = ln.split("SHA256:")[-1].strip().lstrip("#/ ")
|
||||||
|
if "SIG-ED25519:" in ln: sig = ln.split("SIG-ED25519:")[-1].strip().lstrip("#/ ")
|
||||||
|
return sha, sig
|
||||||
|
|
||||||
|
def verify_file(fp, pub):
|
||||||
|
try: content = Path(fp).read_text(encoding="utf-8", errors="replace")
|
||||||
|
except: return None, "Cannot read"
|
||||||
|
clean = strip_sig(content)
|
||||||
|
claimed_h, sig_b64 = extract_sig_data(content)
|
||||||
|
if not claimed_h or not sig_b64: return False, "No signature"
|
||||||
|
actual_h = hashlib.sha256(clean.encode("utf-8")).hexdigest()
|
||||||
|
if actual_h != claimed_h: return False, f"HASH MISMATCH — modified"
|
||||||
|
try:
|
||||||
|
pub.verify(base64.b64decode(sig_b64), hashlib.sha256(clean.encode()).digest())
|
||||||
|
return True, "VALID © Salka Elmadani"
|
||||||
|
except InvalidSignature: return False, "INVALID SIGNATURE — forgery"
|
||||||
|
except Exception as e: return False, str(e)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pub = serialization.load_pem_public_key(PUBLIC_KEY_PEM.encode())
|
||||||
|
target = sys.argv[1] if len(sys.argv) > 1 else "."
|
||||||
|
files = [Path(target)] if Path(target).is_file() else [
|
||||||
|
p for p in Path(target).rglob("*")
|
||||||
|
if p.is_file() and p.suffix in [".py",".cpp",".h",".js",".ts",".sh",".rs",".go",".md"]
|
||||||
|
and ".git" not in str(p)
|
||||||
|
]
|
||||||
|
ok, fail, skip = 0, 0, 0
|
||||||
|
for f in sorted(files):
|
||||||
|
r, msg = verify_file(f, pub)
|
||||||
|
if r is None: skip += 1
|
||||||
|
elif r: ok += 1; print(f" ✓ {f.name}: {msg}")
|
||||||
|
else: fail += 1; print(f" ✗ {f.name}: {msg}")
|
||||||
|
print(f"\nResults: {ok} valid | {fail} TAMPERED | {skip} skipped")
|
||||||
|
if fail: print("WARNING: Authorship chain broken."); sys.exit(1)
|
||||||
|
|
||||||
|
if __name__ == "__main__": main()
|
||||||
|
# ╔══ SALKA ELMADANI AUTHORSHIP CERTIFICATE ══╗
|
||||||
|
# © Salka Elmadani 2025-2026 — ALL RIGHTS RESERVED
|
||||||
|
# Licensed under Business Source License 1.1 — https://inference-x.com
|
||||||
|
# ─────────────────────────────────────────────────────────
|
||||||
|
# SHA256: f4e32c8fe1f2cb7f5dc498c7506b054256f6871d7283beb74b1d5859eb775121
|
||||||
|
# SIG-ED25519: g4rHIrZteuUk4HU/21i69rTk7H8EiL1XjX4A+dZD0xswTqR5XJb1CfnBQfyAxjb1Sf9VW3JptZVDkvOq+magCA==
|
||||||
|
# VERIFY: python3 verify_authorship.py verify_authorship.py
|
||||||
@ -70,7 +70,6 @@
|
|||||||
},
|
},
|
||||||
"gemma-2-9b": {
|
"gemma-2-9b": {
|
||||||
"model": "gemma-2-9b",
|
"model": "gemma-2-9b",
|
||||||
"avg_theta": 44.935344827586206,
|
|
||||||
"avg_signal": 0.6240438819131022,
|
"avg_signal": 0.6240438819131022,
|
||||||
"total_tensors": 464,
|
"total_tensors": 464,
|
||||||
"groups": {
|
"groups": {
|
||||||
@ -303,4 +302,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user