#!/usr/bin/env python3 """ Reads source GGUF header intact, replaces tensor data from organ bins (stripping the organ header that organ_extract added) CSCI v1.0 — Cross-Scale Coherence Index """ import struct, os, sys, json f = open(source_gguf, "rb") # Read GGUF header magic = struct.unpack(" filepath (strip organ bin header to get raw data) organ_map = {} for category in ["skeleton", "organs", "embed", "norm", "adapters", "unknown"]: cat_dir = os.path.join(organs_dir, category) if os.path.isdir(cat_dir): for fname in os.listdir(cat_dir): if fname.endswith(".bin"): tname = fname[:-4] # remove .bin organ_map[tname] = os.path.join(cat_dir, fname) print(f" Organ files: {len(organ_map)}") def read_organ_raw_data(filepath): """Read organ bin, skip the header, return only raw tensor data.""" with open(filepath, "rb") as of: # Skip organ header: name_len(4) + name + ndims(4) + dims(8*ndims) + dtype(4) name_len = struct.unpack("