interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

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 <outdir> */
4#include <stdio.h>
5#include <stdlib.h>
6#include <stdint.h>
7extern void dequantize_row_q4_K(const void*, float*, int64_t);
8extern void dequantize_row_q6_K(const void*, float*, int64_t);
9static 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);}
17int 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;}