Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

run_text: TOKENS=1 env to dump generated token ids for path A/B comparison

woolcoxme56d483a151a
diff --git a/c/glm.c b/c/glm.c
index c75fcf25..5880f19a 100644
--- a/c/glm.c
+++ b/c/glm.c
@@ -3916,6 +3916,14 @@ static void run_text(Model *m, const char *snap, const char *prompt, int ngen){
for(int i=0;i<4;i++) printf(" %-42s %5.1f%% (%lld/%lld)\n", nm[i],
la_tot[i]?100.0*la_hit[i]/la_tot[i]:0.0, (long long)la_hit[i], (long long)la_tot[i]);
}
+ /* TOKENS=1: dump the generated token ids (newline-separated) to stderr,
+ * for exact A/B comparison across decode paths (e.g. resident vs CPU).
+ * The ids are all[np .. np+produced-1]. */
+ if(getenv("TOKENS") && atoi(getenv("TOKENS"))){
+ fprintf(stderr,"[TOKENS] %d generated:",produced);
+ for(int i=np;i<np+produced;i++) fprintf(stderr," %d",all[i]);
+ fprintf(stderr,"\n");
+ }
free(pids); free(all);
usage_save(m);
}