code wiki / (root) / nx_genrole.nx

nx_genrole.nx

buildroot/runtime/nx_genrole.nx

7948 B183 linesdepth 8pulls 19 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f16.nx nx_strconv.nx nx_genweights.nx nx_genarch.nx nx_genrole.nx nx_gen_modelid.nx nx_gen_pipecheck.nx nx_gen_zoo.nx nx_genpipe.nx

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

30const ROLE_UNKNOWN: i64 = 0
31const ROLE_DIT: i64 = 1
32const ROLE_VAE_DEC: i64 = 2
33const ROLE_TEXTENC: i64 = 3
34const ROLE_ADAPTER: i64 = 4
36const FAM_UNKNOWN: i64 = 0
37const FAM_ZIMAGE: i64 = 1
38const FAM_FLUX: i64 = 2
39const FAM_TAESD: i64 = 3
40const FAM_SDVAE: i64 = 4
41const FAM_LLMGGUF: i64 = 5
43const ADK_NONE: i64 = 0
44const ADK_KOHYA: i64 = 1
45const ADK_PEFT: i64 = 2
46const ADK_LOKR: i64 = 3
49const RL_ROLE: i64 = 0
50const RL_FAMILY: i64 = 1
51const RL_RUNNABLE: i64 = 2
52const RL_ADKIND: i64 = 3
53const RL_SLOTS: i64 = 8

functions

55func _rl_len(s: *u8) -> i64
called by 1: nx_role_has
60func nx_role_has(gw: *i64, name: *u8) -> i64
65func nx_role_name(r: i64) -> *u8
72func nx_family_name(f: i64) -> *u8
80func nx_adkind_name(k: i64) -> *u8
called by 2: mainzo_classify
92func _rl_adapter_family(gw: *i64) -> i64
called by 1: nx_role_probe calls 1: nx_role_has
102func nx_role_probe(gw: *i64, out: *i64) -> i64
171func nx_role_blocker(out: *i64) -> *u8