nx_genrole.nx
buildroot/runtime/nx_genrole.nx
about
nx_genrole.nx -- THE single answer to "what is this file". One classifier, three consumers.
This exists because the rule had already been written twice: nx_gen_modelid's main() and
nx_gen_zoo's zo_classify() each carried their own copy of the tensor-name probes. The zoo's own
header even claimed it "reuses nx_gen_modelid's probes rather than re-deriving them, because two
copies of a classification rule drift and the drift is silent" -- and then re-derived them.
★★★★★ A COMMENT ASSERTING DRY IS NOT DRY. The second copy was already missing the adapter-family
resolution (kohya vs peft prefixes) that modelid had learned, so a LoRA the front door named
"z-image" the zoo named only "adapter-lora(kohya)". They had ALREADY drifted.
★ FILENAME AND EXTENSION ARE CLAIMS; THE TENSOR NAMES ARE EVIDENCE. Probing names is the only
honest signature: a .safetensors DiT can be Z-Image or FLUX, a .gguf can be a DiT or an LLM, and
a file sitting in the diffusion/ folder can be an adapter that is not a model at all.
It REFUSES to guess. UNKNOWN is a verdict, never defaulted to the family we happen to support --
a wrong family runs to completion and produces a wrong picture with no error anywhere.
license_tier: ORIGINAL
dependencies 9 imports · 4 importers
imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f16.nxnx_strconv.nxnx_genweights.nxnx_genarch.nx
imported by: nx_gen_modelid.nxnx_gen_pipecheck.nxnx_gen_zoo.nxnx_genpipe.nx
structs
| none |
consts
| 30 | const ROLE_UNKNOWN: i64 = 0 |
| 31 | const ROLE_DIT: i64 = 1 |
| 32 | const ROLE_VAE_DEC: i64 = 2 |
| 33 | const ROLE_TEXTENC: i64 = 3 |
| 34 | const ROLE_ADAPTER: i64 = 4 |
| 36 | const FAM_UNKNOWN: i64 = 0 |
| 37 | const FAM_ZIMAGE: i64 = 1 |
| 38 | const FAM_FLUX: i64 = 2 |
| 39 | const FAM_TAESD: i64 = 3 |
| 40 | const FAM_SDVAE: i64 = 4 |
| 41 | const FAM_LLMGGUF: i64 = 5 |
| 43 | const ADK_NONE: i64 = 0 |
| 44 | const ADK_KOHYA: i64 = 1 |
| 45 | const ADK_PEFT: i64 = 2 |
| 46 | const ADK_LOKR: i64 = 3 |
| 49 | const RL_ROLE: i64 = 0 |
| 50 | const RL_FAMILY: i64 = 1 |
| 51 | const RL_RUNNABLE: i64 = 2 |
| 52 | const RL_ADKIND: i64 = 3 |
| 53 | const RL_SLOTS: i64 = 8 |
functions
| 55 | func _rl_len(s: *u8) -> i64 called by 1: nx_role_has |
| 60 | func nx_role_has(gw: *i64, name: *u8) -> i64 |
| 65 | func nx_role_name(r: i64) -> *u8 |
| 72 | func nx_family_name(f: i64) -> *u8 |
| 80 | func nx_adkind_name(k: i64) -> *u8 |
| 92 | func _rl_adapter_family(gw: *i64) -> i64 |
| 102 | func nx_role_probe(gw: *i64, out: *i64) -> i64 |
| 171 | func nx_role_blocker(out: *i64) -> *u8 |