Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/crates/aienos-infer/tests/fixtures/gen/gen.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / crates / aienos-infer / tests / fixtures / gen / gen.c` 19 lines ยท 1216 bytes Raw Blame History 1 /* Regenerates ../q4k.* and ../q6k.* : blocks cut from the real GGUF plus the 2 * output of ggml dequantize_row_q4_K/q6_K. Run via ../../../tools or `make -C gen`. 3 * Usage: gen */ 4 #include 5 #include 6 #include 7 extern void dequantize_row_q4_K(const void*, float*, int64_t); 8 extern void dequantize_row_q6_K(const void*, float*, int64_t); 9 static void go(const char*f,int q6,long offs[2],const char*pfx){ 10 int bs=q6?210:144; int nb=4; char n[256]; 11 snprintf(n,256,"%s.bin",pfx); FILE*o=fopen(n,"wb"); 12 snprintf(n,256,"%s.f32",pfx); FILE*r=fopen(n,"wb"); 13 FILE*in=fopen(f,"rb"); 14 for(int t=0;t<2;t++){ fseek(in,offs[t],SEEK_SET); unsigned char*buf=malloc(bs*nb); fread(buf,bs,nb,in); fwrite(buf,bs,nb,o); 15 float*y=malloc(256*nb*4); if(q6)dequantize_row_q6_K(buf,y,256*nb); else dequantize_row_q4_K(buf,y,256*nb); fwrite(y,4,256*nb,r);} 16 fclose(o);fclose(r);fclose(in);} 17 int main(int argc,char**argv){const char*d=argc>1?argv[1]:".";const char*f=argc>2?argv[2]:"Llama-3.2-1B-Instruct-Q4_K_M.gguf"; 18 long a[2]={`223309856`,`798257184`}, b[2]={`228626464`,`775049248`}; 19 char p4[300],p6[300];snprintf(p4,300,"%s/q4k",d);snprintf(p6,300,"%s/q6k",d);go(f,0,a,p4);go(f,1,b,p6);return 0;}