Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
olmoe: reject quant_bits outside 2..8 (fixes degenerate output, #134) + correct ref.json to OLMoE-0125-Instruct oracle (#133)
JustVugg1f0e1b7076a6
diff --git a/c/olmoe.c b/c/olmoe.cindex 641f1d9c..882e1957 100644--- a/c/olmoe.c+++ b/c/olmoe.c@@ -39,7 +39,7 @@ typedef struct { Slot *slots; int n, cap; } LCache;typedef struct {Cfg c;shards S;- int quant_bits; /* bit di quantizzazione degli expert (2..8); 16 = f32 */+ int quant_bits; /* bit di quantizzazione degli expert (2..8); storage int8, niente f32 (#134) */float *embed, *lm_head, *final_norm;Layer *L;LCache *cache; /* [n_layers] */@@ -360,6 +360,10 @@ int main(int argc, char **argv) {if (!snap) { fprintf(stderr, "set SNAP=<snapshot directory>\n"); return 1; }int cap = argc > 1 ? atoi(argv[1]) : 16;int bits = argc > 2 ? atoi(argv[2]) : 8;+ if (bits < 2 || bits > 8) { /* expert storage is int8_t: bits>8 truncates in quantize_rows (#134). f32 mode is not implemented here — int8 is already token-exact vs the oracle. */+ fprintf(stderr, "quant_bits must be 2..8 (got %d); OLMoE experts are int8-backed, no f32 mode\n", bits);+ return 1;+ }const char *refpath = argc > 3 ? argv[3] : "ref.json";FILE *f = fopen(refpath, "rb"); if(!f){perror(refpath);return 1;}diff --git a/ref.json b/ref.jsonindex 7c236abc..432e29b4 100644--- a/ref.json+++ b/ref.json@@ -1 +1,30 @@-{"prompt": "The capital of France is", "prompt_ids": [510, 5347, 273, 6181, 310], "full_ids": [510, 5347, 273, 6181, 310, 7785, 15, 187, 187, 510, 5347, 273, 253, 1986, 2077, 310, 5041], "text": "The capital of France is Paris.\n\nThe capital of the United States is Washington"}\ No newline at end of file+{+ "prompt": "The capital of France is",+ "prompt_ids": [+ 510,+ 5347,+ 273,+ 6181,+ 310+ ],+ "full_ids": [+ 510,+ 5347,+ 273,+ 6181,+ 310,+ 7785,+ 15,+ 187,+ 187,+ 510,+ 3565,+ 3448,+ 273,+ 6181,+ 310,+ 5112,+ 15+ ],+ "text": "The capital of France is Paris.\n\nThe official language of France is French."+}