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

chore(glm53): standardize user-facing diagnostics in English

trigger2k2058498af5b67c
diff --git a/c/glm53.c b/c/glm53.c
index 3af0f2cd..ca89372f 100644
--- a/c/glm53.c
+++ b/c/glm53.c
@@ -291,8 +291,8 @@ static void load_cfg(Cfg *c, const char *snap) {
} else {
jval *kinds = json_get(tc, "mlp_layer_types");
if (!kinds || kinds->t != J_ARR) {
- fprintf(stderr, "config.json: serve first_k_dense_replace "
- "oppure mlp_layer_types\n");
+ fprintf(stderr, "config.json: requires first_k_dense_replace "
+ "or mlp_layer_types\n");
exit(1);
}
c->first_dense = kinds->len;
@@ -724,9 +724,9 @@ static const float *load_f32(GModel *m, const char *fmt, ...) {
char name[512];
va_list args; va_start(args, fmt); vsnprintf(name, sizeof(name), fmt, args); va_end(args);
st_tensor *t = st_find(&m->S, name);
- if (!t) { fprintf(stderr, "manca il tensore %s\n", name); exit(1); }
+ if (!t) { fprintf(stderr, "missing tensor %s\n", name); exit(1); }
float *buffer = malloc((size_t)t->numel * sizeof(float));
- if (!buffer) { fprintf(stderr, "OOM su %s\n", name); exit(1); }
+ if (!buffer) { fprintf(stderr, "OOM on %s\n", name); exit(1); }
st_read_f32_cap(&m->S, name, buffer, t->numel, 0);
return buffer;
}
@@ -741,7 +741,7 @@ static int glm53_dense_bits(void) {
const char *setting = getenv("GLM53_BITS");
cached = setting ? atoi(setting) : 4;
if (cached != 4 && cached != 8 && cached != 32) {
- fprintf(stderr, "GLM53_BITS=%s: valori ammessi 4, 8, 32\n", setting);
+ fprintf(stderr, "GLM53_BITS=%s: allowed values are 4, 8, 32\n", setting);
exit(1);
}
return cached;
@@ -792,7 +792,7 @@ static Mat quantize_loaded(float *buffer, int rows, int columns) {
const int groups = columns / 64;
uint8_t *packed = malloc((size_t)rows * ((columns + 1) / 2));
float *step = malloc((size_t)rows * groups * sizeof(float));
- if (!packed || !step) { fprintf(stderr, "OOM quantizzando %dx%d\n", rows, columns); exit(1); }
+ if (!packed || !step) { fprintf(stderr, "OOM quantizing %dx%d\n", rows, columns); exit(1); }
quantize_i4_grouped(buffer, packed, step, rows, columns, 64);
free(buffer);
mat.fmt = 4; mat.q4 = packed; mat.s = step; mat.gs = 64;
@@ -802,7 +802,7 @@ static Mat quantize_loaded(float *buffer, int rows, int columns) {
* di 64, che capita sulle proiezioni piccole dell'indexer. */
int8_t *level = malloc((size_t)rows * columns);
float *step = malloc((size_t)rows * sizeof(float));
- if (!level || !step) { fprintf(stderr, "OOM quantizzando %dx%d\n", rows, columns); exit(1); }
+ if (!level || !step) { fprintf(stderr, "OOM quantizing %dx%d\n", rows, columns); exit(1); }
quantize_rows(buffer, level, step, rows, columns, 8);
free(buffer);
mat.fmt = 1; mat.q8 = level; mat.s = step;
@@ -833,16 +833,16 @@ static void absorb_kvb(GModel *m, GLayer *l, const char *name) {
const Cfg *c = &m->c;
const int H = c->n_heads, QK = c->qk_nope, V = c->v_head, L = c->kv_lora;
st_tensor *t = st_find(&m->S, name);
- if (!t) { fprintf(stderr, "manca %s\n", name); exit(1); }
+ if (!t) { fprintf(stderr, "missing %s\n", name); exit(1); }
if (t->numel != (int64_t)H * (QK + V) * L) {
- fprintf(stderr, "%s: %lld valori, attesi %lld per %d teste\n", name,
+ fprintf(stderr, "%s: %lld values, expected %lld for %d heads\n", name,
(long long)t->numel, (long long)H * (QK + V) * L, H);
exit(1);
}
float *whole = malloc((size_t)t->numel * sizeof(float));
float *kt = malloc((size_t)H * L * QK * sizeof(float));
float *vv = malloc((size_t)H * V * L * sizeof(float));
- if (!whole || !kt || !vv) { fprintf(stderr, "OOM su %s\n", name); exit(1); }
+ if (!whole || !kt || !vv) { fprintf(stderr, "OOM on %s\n", name); exit(1); }
st_read_f32_cap(&m->S, name, whole, t->numel, 1);
for (int h = 0; h < H; h++) {
@@ -864,7 +864,7 @@ static Mat load_mat(GModel *m, const char *fmt, ...) {
char name[512];
va_list args; va_start(args, fmt); vsnprintf(name, sizeof(name), fmt, args); va_end(args);
st_tensor *t = st_find(&m->S, name);
- if (!t) { fprintf(stderr, "manca la matrice %s\n", name); exit(1); }
+ if (!t) { fprintf(stderr, "missing matrix %s\n", name); exit(1); }
Mat mat; memset(&mat, 0, sizeof(mat));
/* Gia' quantizzato nel checkpoint: si prende com'e', senza passare per
@@ -875,7 +875,7 @@ static Mat load_mat(GModel *m, const char *fmt, ...) {
snprintf(scales, sizeof(scales), "%s.qs", name);
st_tensor *qs = st_find(&m->S, scales);
if (!qs) {
- fprintf(stderr, "%s e' int4 ma manca %s\n", name, scales);
+ fprintf(stderr, "%s e' int4 ma missing %s\n", name, scales);
exit(1);
}
/* Il contenitore e' piatto: 4.194.304 byte di nibble e 131.072 scale,
@@ -891,33 +891,33 @@ static Mat load_mat(GModel *m, const char *fmt, ...) {
* la strada e' quella di kimi_k3: la forma la passa il chiamante. */
const int64_t values = qs->numel * 64;
if (t->nbytes * 2 != values) {
- fprintf(stderr, "%s: %lld byte e %lld scale non sono un int4 gs64\n",
+ fprintf(stderr, "%s: %lld bytes and %lld scales do not form int4 gs64\n",
name, (long long)t->nbytes, (long long)qs->numel);
exit(1);
}
if (t->rank != 2) {
- fprintf(stderr, "%s: contenitore int4 piatto fuori dagli esperti; "
- "la forma non e' nel file e non si indovina\n", name);
+ fprintf(stderr, "%s: flat int4 container outside routed experts; "
+ "the shape is not stored in the file and cannot be inferred\n", name);
exit(1);
}
mat.rows = (int)t->shape[0];
mat.columns = (int)(values / t->shape[0]);
if (mat.columns % 64) {
- fprintf(stderr, "%s: %d colonne non sono multiple di 64\n", name, mat.columns);
+ fprintf(stderr, "%s: %d columns are not multiples of 64\n", name, mat.columns);
exit(1);
}
uint8_t *packed = malloc((size_t)t->nbytes);
float *step = malloc((size_t)qs->numel * sizeof(float));
- if (!packed || !step) { fprintf(stderr, "OOM su %s\n", name); exit(1); }
+ if (!packed || !step) { fprintf(stderr, "OOM on %s\n", name); exit(1); }
st_read_raw(&m->S, name, packed, 1);
st_read_f32_cap(&m->S, scales, step, qs->numel, 1);
mat.fmt = 4; mat.q4 = packed; mat.s = step; mat.gs = 64; mat.resident = 1;
return mat;
}
- if (t->rank != 2) { fprintf(stderr, "%s: rank %d, attesa 2\n", name, t->rank); exit(1); }
+ if (t->rank != 2) { fprintf(stderr, "%s: rank %d, expected 2\n", name, t->rank); exit(1); }
float *buffer = malloc((size_t)t->numel * sizeof(float));
- if (!buffer) { fprintf(stderr, "OOM su %s\n", name); exit(1); }
+ if (!buffer) { fprintf(stderr, "OOM on %s\n", name); exit(1); }
st_read_f32_cap(&m->S, name, buffer, t->numel, 1);
mat.rows = (int)t->shape[0];
mat.columns = (int)t->shape[1];
@@ -1120,7 +1120,7 @@ static void mla_layer(const Cfg *c, const GLayer *l, const float *x, int tokens,
if (coli_sparse_index_select_range(selected, iq, ik, gates, head_w, l->ikpa, valid,
seen, IH, ID, c->index_kpool, c->index_topk,
c->index_kpool_tail, base, seen)) {
- fprintf(stderr, "selezione indexer fallita\n"); exit(1);
+ fprintf(stderr, "indexer selection failed\n"); exit(1);
}
/* GLM53_DUMP_INDEX=1 stampa le righe scelte dall'indexer: e' il primo
* posto da guardare quando il motore diverge solo su certe lunghezze. */
@@ -1240,7 +1240,7 @@ static void expert_table_init(GModel *m) {
"down_proj.weight", "down_proj.weight.qs",
};
m->eref = calloc((size_t)c->n_layers * c->n_experts, sizeof(*m->eref));
- if (!m->eref) { fprintf(stderr, "OOM sulla tabella degli esperti\n"); exit(1); }
+ if (!m->eref) { fprintf(stderr, "OOM allocating expert table\n"); exit(1); }
const int from = c->first_dense > m->layer_begin ? c->first_dense : m->layer_begin;
for (int i = from; i < m->layer_end; i++) {
@@ -1251,9 +1251,9 @@ static void expert_table_init(GModel *m) {
snprintf(name, sizeof(name), "%slayers.%d.mlp.experts.%d.%s",
m->prefix, i, e, piece[p]);
st_tensor *t = st_find(&m->S, name);
- if (!t) { fprintf(stderr, "manca %s\n", name); exit(1); }
+ if (!t) { fprintf(stderr, "missing %s\n", name); exit(1); }
if (t->nbytes != m->e_len[p]) {
- fprintf(stderr, "%s: %lld byte, attesi %lld\n", name,
+ fprintf(stderr, "%s: %lld bytes, expected %lld\n", name,
(long long)t->nbytes, (long long)m->e_len[p]);
exit(1);
}
@@ -1298,7 +1298,7 @@ static void expert_cache_init(GModel *m) {
budget = free_now - 3.0;
if (budget < 1.0) budget = 1.0;
if (getenv("GLM53_VERBOSE"))
- fprintf(stderr, "budget esperti: %.1f GB (%.1f disponibili, 3 di margine)\n",
+ fprintf(stderr, "expert budget: %.1f GB (%.1f available, 3 GB reserved)\n",
budget, free_now);
}
const int from = c->first_dense > m->layer_begin ? c->first_dense : m->layer_begin;
@@ -1310,17 +1310,17 @@ static void expert_cache_init(GModel *m) {
if (cap > c->n_experts) cap = c->n_experts;
m->ecache = calloc((size_t)c->n_layers, sizeof(*m->ecache));
- if (!m->ecache) { fprintf(stderr, "OOM sulla cache degli esperti\n"); exit(1); }
+ if (!m->ecache) { fprintf(stderr, "OOM allocating expert cache\n"); exit(1); }
for (int i = from; i < m->layer_end; i++) {
LCache *cache = &m->ecache[i];
cache->cap = cap;
cache->s = calloc((size_t)cap, sizeof(*cache->s));
- if (!cache->s) { fprintf(stderr, "OOM sugli slot del layer %d\n", i); exit(1); }
+ if (!cache->s) { fprintf(stderr, "OOM allocating slots for layer %d\n", i); exit(1); }
for (int j = 0; j < cap; j++) cache->s[j].eid = -1;
}
if (getenv("GLM53_VERBOSE"))
- fprintf(stderr, "esperti: slot da %.1f MB, %d per layer su %d layer sparsi "
- "(%.1f GB residenti)\n",
+ fprintf(stderr, "experts: %.1f MB slots, %d per layer across %d sparse layers "
+ "(%.1f GB resident)\n",
m->e_slot / 1e6, cap, sparse, (double)cap * sparse * m->e_slot / 1e9);
}
@@ -1369,8 +1369,8 @@ static void expert_read(GModel *m, int layer, int eid, Slot *slot) {
slot->own = (uint8_t *)p;
slot->own_len = need;
if (!slot->own) {
- fprintf(stderr, "OOM su uno slot esperto (%.1f MB): la cache esperti non ci sta "
- "in memoria; riduci con --ram N o GLM53_EXPERT_GB=N (#1375)\n",
+ fprintf(stderr, "OOM allocating expert slot (%.1f MB): the expert cache does not fit "
+ "in memory; reduce it with --ram N or GLM53_EXPERT_GB=N (#1375)\n",
m->e_slot / 1e6);
exit(1);
}
@@ -1471,7 +1471,7 @@ static void ffn_layer(GModel *m, const GLayer *l, int index, const float *x,
int *chosen = malloc((size_t)tokens * topk * sizeof(int));
float *weight = malloc((size_t)tokens * topk * sizeof(float));
float *score = malloc((size_t)c->n_experts * sizeof(float));
- if (!chosen || !weight || !score) { fprintf(stderr, "OOM nel router\n"); exit(1); }
+ if (!chosen || !weight || !score) { fprintf(stderr, "OOM in router\n"); exit(1); }
/* --- primo tempo: il router, per ogni token --- */
for (int t = 0; t < tokens; t++) {
@@ -1522,7 +1522,7 @@ static void ffn_layer(GModel *m, const GLayer *l, int index, const float *x,
float *sg = malloc((size_t)wide * sizeof(float));
float *su = malloc((size_t)wide * sizeof(float));
float *tmp = malloc((size_t)c->hidden * sizeof(float));
- if (!sg || !su || !tmp) { fprintf(stderr, "OOM nel MoE\n"); exit(1); }
+ if (!sg || !su || !tmp) { fprintf(stderr, "OOM in MoE\n"); exit(1); }
/* l'esperto condiviso e' sempre attivo e non passa dalla cache */
for (int t = 0; t < tokens; t++)
@@ -1546,7 +1546,7 @@ static void ffn_layer(GModel *m, const GLayer *l, int index, const float *x,
/* unione dei distinti, nell'ordine in cui compaiono */
int *union_ids = malloc((size_t)tokens * topk * sizeof(int));
int n_union = 0;
- if (!union_ids) { fprintf(stderr, "OOM sull'unione\n"); exit(1); }
+ if (!union_ids) { fprintf(stderr, "OOM building expert union\n"); exit(1); }
for (int i = 0; i < tokens * topk; i++) {
int seen = 0;
for (int j = 0; j < n_union; j++) if (union_ids[j] == chosen[i]) { seen = 1; break; }
@@ -1557,7 +1557,7 @@ static void ffn_layer(GModel *m, const GLayer *l, int index, const float *x,
const int block = cache->cap;
int *slot_of = malloc((size_t)block * sizeof(int));
int *to_read = malloc((size_t)block * sizeof(int));
- if (!slot_of || !to_read) { fprintf(stderr, "OOM sugli slot\n"); exit(1); }
+ if (!slot_of || !to_read) { fprintf(stderr, "OOM allocating slots\n"); exit(1); }
for (int base = 0; base < n_union; base += block) {
const int here = base + block <= n_union ? block : n_union - base;
@@ -1734,7 +1734,7 @@ static void model_load_range(GModel *m, const char *dir, int layer_begin,
snprintf(first, sizeof(first), "%slayers.%d.mlp.experts.0.gate_proj.weight",
P, probe_layer);
st_tensor *probe_expert = st_find(&m->S, first);
- if (!probe_expert) { fprintf(stderr, "manca %s\n", first); exit(1); }
+ if (!probe_expert) { fprintf(stderr, "missing %s\n", first); exit(1); }
m->streaming = probe_expert->dtype == 3;
}
if (m->streaming) {
@@ -1837,8 +1837,8 @@ static void model_load_range(GModel *m, const char *dir, int layer_begin,
if (getenv("COLI_METAL") && atoi(getenv("COLI_METAL"))) {
g_metal_ready = coli_metal_init() && coli_metal_available();
fprintf(stderr, g_metal_ready
- ? "Metal: attivo sulle matrici residenti\n"
- : "Metal: nessun device utilizzabile, resto su CPU\n");
+ ? "Metal: active for resident matrices\n"
+ : "Metal: no usable device, falling back to CPU\n");
}
#endif
#ifdef COLI_VULKAN
@@ -1855,8 +1855,8 @@ static void model_load_range(GModel *m, const char *dir, int layer_begin,
else snprintf(spv, sizeof(spv), "%s/qmatmul.spv", given ? given : "shaders");
g_vk_ready = coli_vk_init(spv) && coli_vk_available();
fprintf(stderr, g_vk_ready
- ? "Vulkan: attivo sulle matrici residenti\n"
- : "Vulkan: nessun device utilizzabile (%s), resto su CPU\n", spv);
+ ? "Vulkan: active for resident matrices\n"
+ : "Vulkan: no usable device (%s), falling back to CPU\n", spv);
}
#endif
/* La cache si dimensiona qui, non prima: quanto si puo' spendere dipende
@@ -1898,7 +1898,7 @@ static void vision_load(GModel *m) {
m->vision.merger_down = load_f32(m, "%smerger.down_proj.weight", V);
m->vblocks = calloc((size_t)c->vis_layers, sizeof(*m->vblocks));
- if (!m->vblocks) { fprintf(stderr, "OOM sui blocchi vision\n"); exit(1); }
+ if (!m->vblocks) { fprintf(stderr, "OOM allocating vision blocks\n"); exit(1); }
for (int b = 0; b < c->vis_layers; b++) {
ColiVisionBlock *vb = &m->vblocks[b];
vb->norm1 = load_f32(m, "%sblocks.%d.norm1.weight", V, b);
@@ -1929,19 +1929,19 @@ static void vision_load(GModel *m) {
static float *vision_encode(GModel *m, const float *patches,
int grid_h, int grid_w, int *out_tokens) {
if (!m->has_vision) {
- fprintf(stderr, "questo checkpoint non porta la torre vision\n");
+ fprintf(stderr, "this checkpoint does not include the vision tower\n");
exit(1);
}
const int tokens = coli_vision_output_tokens(&m->vision.config, grid_h, grid_w);
if (tokens <= 0) {
- fprintf(stderr, "griglia %dx%d non divisibile per merge %d\n",
+ fprintf(stderr, "grid %dx%d is not divisible by merge size %d\n",
grid_h, grid_w, m->vision.config.merge);
exit(1);
}
float *out = malloc((size_t)tokens * m->vision.config.out_hidden * sizeof(float));
- if (!out) { fprintf(stderr, "OOM sugli embedding vision\n"); exit(1); }
+ if (!out) { fprintf(stderr, "OOM allocating vision embeddings\n"); exit(1); }
if (coli_vision_forward(out, &m->vision, patches, grid_h, grid_w) != 0) {
- fprintf(stderr, "la torre vision ha rifiutato l'ingresso\n");
+ fprintf(stderr, "vision tower rejected the input\n");
exit(1);
}
/* La torre esce a out_hidden; il flusso testuale vuole hidden. Il
@@ -1961,10 +1961,10 @@ static float *vision_encode(GModel *m, const float *patches,
static GSession *session_open(const GModel *m, int cap) {
const Cfg *c = &m->c;
GSession *s = calloc(1, sizeof(*s));
- if (!s) { fprintf(stderr, "OOM sulla sessione\n"); exit(1); }
+ if (!s) { fprintf(stderr, "OOM allocating session\n"); exit(1); }
s->cap = cap;
s->layer = calloc((size_t)c->n_layers, sizeof(*s->layer));
- if (!s->layer) { fprintf(stderr, "OOM sugli stati di layer\n"); exit(1); }
+ if (!s->layer) { fprintf(stderr, "OOM allocating layer states\n"); exit(1); }
if (c->kda_proj)
s->kda_scratch = malloc((size_t)coli_kda_scratch_floats(c->kda_heads, c->kda_hd,
c->kda_hd) * sizeof(float));
@@ -1975,14 +1975,14 @@ static GSession *session_open(const GModel *m, int cap) {
st->ikeys = malloc((size_t)cap * c->index_hd * sizeof(float));
st->igates = malloc((size_t)cap * c->index_hd * sizeof(float));
if (!st->latent || !st->ikeys || !st->igates) {
- fprintf(stderr, "OOM sulla cache del layer %d\n", i); exit(1);
+ fprintf(stderr, "OOM allocating cache for layer %d\n", i); exit(1);
}
} else if (c->kda_proj) {
st->kda_state = calloc((size_t)c->kda_heads * c->kda_hd * c->kda_hd,
sizeof(float));
st->kda_window = calloc((size_t)3 * c->kda_proj * c->conv_k, sizeof(float));
if (!st->kda_state || !st->kda_window) {
- fprintf(stderr, "OOM sullo stato KDA del layer %d\n", i); exit(1);
+ fprintf(stderr, "OOM allocating KDA state for layer %d\n", i); exit(1);
}
}
}
@@ -1990,8 +1990,8 @@ static GSession *session_open(const GModel *m, int cap) {
int full = 0;
for (int i = 0; i < c->n_layers; i++) if (c->is_full[i]) full++;
const double per_token = (double)full * (c->kv_lora + 2 * c->index_hd) * sizeof(float);
- fprintf(stderr, "cache: %.1f KB per token su %d layer DSA "
- "(%.2f GB a %d posizioni)\n",
+ fprintf(stderr, "cache: %.1f KB per token across %d DSA layers "
+ "(%.2f GB at %d positions)\n",
per_token / 1024.0, full, per_token * cap / 1e9, cap);
}
return s;
@@ -2026,7 +2026,7 @@ static float *run_layers(GModel *m, GSession *s, float *streams, float *next,
float *post = malloc((size_t)n * H * sizeof(float));
float *comb = malloc((size_t)n * H * H * sizeof(float));
if (!collapsed || !normed || !branch || !post || !comb) {
- fprintf(stderr, "OOM nei temporanei del passaggio\n"); exit(1);
+ fprintf(stderr, "OOM allocating forward-pass temporaries\n"); exit(1);
}
for (int i = begin; i < end; i++) {
@@ -2171,7 +2171,7 @@ static float *forward_span(GModel *m, GSession *s, const int *tokens, int n,
const int H = c->hc_mult;
const int start = s->filled; /* NON 'base': nel ciclo dei layer e' gia' preso */
if (start + n > s->cap) {
- fprintf(stderr, "contesto esaurito: %d posizioni su %d\n", start + n, s->cap);
+ fprintf(stderr, "context exhausted: %d positions of %d\n", start + n, s->cap);
exit(1);
}
const int D = c->hidden;
@@ -2185,14 +2185,14 @@ static float *forward_span(GModel *m, GSession *s, const int *tokens, int n,
/* Un id fuori dal vocabolario legge oltre la tabella degli embedding.
* Da CLI sarebbe un errore di battitura; da server e' input di rete. */
if (tokens[t] < 0 || tokens[t] >= c->vocab) {
- fprintf(stderr, "token %d fuori dal vocabolario (0..%d)\n",
+ fprintf(stderr, "token %d is outside the vocabulary (0..%d)\n",
tokens[t], c->vocab - 1);
exit(1);
}
if (vision && c->image_token >= 0 && tokens[t] == c->image_token) {
if (consumed >= n_vision) {
- fprintf(stderr, "il prompt ha piu' token immagine (%d+) degli "
- "embedding forniti (%d)\n", consumed + 1, n_vision);
+ fprintf(stderr, "prompt has more image tokens (%d+) than "
+ "provided embeddings (%d)\n", consumed + 1, n_vision);
exit(1);
}
row = vision + (size_t)consumed++ * D;
@@ -2206,8 +2206,8 @@ static float *forward_span(GModel *m, GSession *s, const int *tokens, int n,
* modello un'immagine diversa da quella che il chiamante crede di aver
* passato: e' un errore, non un caso limite. */
if (consumed != n_vision) {
- fprintf(stderr, "%d embedding vision forniti ma solo %d token immagine "
- "nel prompt\n", n_vision, consumed);
+ fprintf(stderr, "%d vision embeddings provided but only %d image tokens "
+ "are present in the prompt\n", n_vision, consumed);
exit(1);
}
@@ -2265,7 +2265,7 @@ static float *forward_prefill(GModel *m, GSession *s, const int *tokens, int n,
if (chunk > n) chunk = n;
float *all = keep_all ? malloc((size_t)n * c->vocab * sizeof(float)) : NULL;
- if (keep_all && !all) { fprintf(stderr, "OOM sui logit del prefill\n"); exit(1); }
+ if (keep_all && !all) { fprintf(stderr, "OOM allocating prefill logits\n"); exit(1); }
float *last = NULL;
int used_vision = 0;
@@ -2292,7 +2292,7 @@ static float *forward_prefill(GModel *m, GSession *s, const int *tokens, int n,
if (here > 1) {
/* si tiene solo l'ultima riga */
float *tail = malloc((size_t)c->vocab * sizeof(float));
- if (!tail) { fprintf(stderr, "OOM sui logit\n"); exit(1); }
+ if (!tail) { fprintf(stderr, "OOM allocating logits\n"); exit(1); }
memcpy(tail, last + (size_t)(here - 1) * c->vocab,
(size_t)c->vocab * sizeof(float));
free(last);
@@ -2301,7 +2301,7 @@ static float *forward_prefill(GModel *m, GSession *s, const int *tokens, int n,
}
}
if (vision && used_vision != n_vision) {
- fprintf(stderr, "%d embedding vision forniti ma %d segnaposto nel prompt\n",
+ fprintf(stderr, "%d vision embeddings provided but %d placeholders are present in the prompt\n",
n_vision, used_vision);
exit(1);
}
@@ -2406,7 +2406,7 @@ static int sample_token(const float *logits, int vocab) {
probability = realloc(probability, (size_t)vocab * sizeof(float));
order = realloc(order, (size_t)vocab * sizeof(int));
room = vocab;
- if (!probability || !order) { fprintf(stderr, "OOM nel campionamento\n"); exit(1); }
+ if (!probability || !order) { fprintf(stderr, "OOM in sampling\n"); exit(1); }
}
float top = -INFINITY;
for (int i = 0; i < vocab; i++) if (logits[i] > top) top = logits[i];
@@ -2471,7 +2471,7 @@ static void slots_init(const GModel *m) {
g_slot_context = context ? atoi(context) : 8192;
if (g_slot_context < 64) g_slot_context = 64;
if (getenv("GLM53_VERBOSE"))
- fprintf(stderr, "slot KV: %d da %d posizioni\n", g_n_slots, g_slot_context);
+ fprintf(stderr, "KV slots: %d with %d positions each\n", g_n_slots, g_slot_context);
(void)m;
}
@@ -2492,7 +2492,7 @@ static int slot_shared(const KVSlot *slot, const int *tokens, int n) {
static void slot_remember(KVSlot *slot, const int *tokens, int n) {
if (n > slot->cap) {
slot->tokens = realloc(slot->tokens, (size_t)n * sizeof(int));
- if (!slot->tokens) { fprintf(stderr, "OOM sulla storia dello slot\n"); exit(1); }
+ if (!slot->tokens) { fprintf(stderr, "OOM allocating slot history\n"); exit(1); }
slot->cap = n;
}
memcpy(slot->tokens, tokens, (size_t)n * sizeof(int));
@@ -2547,9 +2547,9 @@ static void arm_stops(const char *dir, Tok *tokenizer, int batched) {
for (int i = 0; i < g_nstop; i++) if (g_stop[i] == id) seen = 1;
if (!seen) g_stop[g_nstop++] = id;
}
- fprintf(stderr, "[stop] %d token di stop:", g_nstop);
+ fprintf(stderr, "[stop] %d stop tokens:", g_nstop);
for (int i = 0; i < g_nstop; i++) fprintf(stderr, " %d", g_stop[i]);
- fprintf(stderr, "%s\n", batched ? " (modalita' batch: solo fine testo)" : "");
+ fprintf(stderr, "%s\n", batched ? " (batch mode: end-of-text only)" : "");
}
static int is_stop(int token) {
@@ -3014,7 +3014,7 @@ int main(int argc, char **argv) {
* openai_server.py. */
if (getenv("SERVE")) {
const char *snap = getenv("SNAP");
- if (!snap) { fprintf(stderr, "SERVE senza SNAP: non so quale modello aprire\n"); return 2; }
+ if (!snap) { fprintf(stderr, "SERVE requires SNAP to select a model\n"); return 2; }
GModel served;
memset(&served, 0, sizeof(served));
model_load(&served, snap);
@@ -3033,17 +3033,17 @@ int main(int argc, char **argv) {
}
if (!dir || (!ids && !prompt_text)) {
- fprintf(stderr, "uso: %s --model DIR (--prompt TESTO | --ids a,b,c)\n"
+ fprintf(stderr, "usage: %s --model DIR (--prompt TEXT | --ids a,b,c)\n"
" [--greedy N] [--logits] [--patches FILE.f32 --grid HxW]\n",
argv[0]);
return 2;
}
if (ids && prompt_text) {
- fprintf(stderr, "--prompt e --ids sono due modi di dire la stessa cosa\n");
+ fprintf(stderr, "--prompt and --ids are mutually exclusive\n");
return 2;
}
if (!!patch_file != (grid_h > 0 && grid_w > 0)) {
- fprintf(stderr, "--patches e --grid vanno insieme\n");
+ fprintf(stderr, "--patches and --grid must be used together\n");
return 2;
}
int capacity = 1024, count = 0;
@@ -3069,7 +3069,7 @@ int main(int argc, char **argv) {
p = (*end == ',') ? end + 1 : end;
}
}
- if (!count) { fprintf(stderr, "nessun token nel prompt\n"); return 2; }
+ if (!count) { fprintf(stderr, "no tokens in prompt\n"); return 2; }
GModel model;
memset(&model, 0, sizeof(model)); /* contatori e puntatori opzionali */
@@ -3084,20 +3084,20 @@ int main(int argc, char **argv) {
if (patch_file) {
const ColiVisionConfig *vc = &model.vision.config;
if (!model.has_vision) {
- fprintf(stderr, "--patches ma il checkpoint non porta la torre vision\n");
+ fprintf(stderr, "--patches requested but this checkpoint does not include the vision tower\n");
return 2;
}
const size_t per_patch = (size_t)vc->in_channels * vc->temporal * vc->patch * vc->patch;
const size_t wanted = (size_t)grid_h * grid_w * per_patch;
FILE *f = fopen(patch_file, "rb");
- if (!f) { fprintf(stderr, "non apro %s\n", patch_file); return 2; }
+ if (!f) { fprintf(stderr, "cannot open %s\n", patch_file); return 2; }
float *patches = malloc(wanted * sizeof(float));
- if (!patches) { fprintf(stderr, "OOM sulle patch\n"); return 2; }
+ if (!patches) { fprintf(stderr, "OOM allocating patches\n"); return 2; }
size_t got = fread(patches, sizeof(float), wanted, f);
/* Una patch corta darebbe comunque un'uscita, con la coda letta da
* memoria non inizializzata: meglio fermarsi e dire di quanto. */
if (got != wanted) {
- fprintf(stderr, "%s: %zu float su %zu attesi per una griglia %dx%d\n",
+ fprintf(stderr, "%s: got %zu floats, expected %zu for a %dx%d grid\n",
patch_file, got, wanted, grid_h, grid_w);
return 2;
}
@@ -3113,7 +3113,7 @@ int main(int argc, char **argv) {
const double prefill_start = now_s();
float *logits = forward_prefill(&model, session, tokens, count, vision, n_vision, 1);
if (getenv("GLM53_VERBOSE"))
- fprintf(stderr, "caricamento %.1fs, prefill %d token in %.1fs\n",
+ fprintf(stderr, "load %.1fs, prefill %d tokens in %.1fs\n",
load_seconds, count, now_s() - prefill_start);
printf("teacher_forcing");
for (int t = 0; t < count; t++)
diff --git a/c/tests/test_glm53_vulkan.py b/c/tests/test_glm53_vulkan.py
index 1ddda245..5005ffc5 100644
--- a/c/tests/test_glm53_vulkan.py
+++ b/c/tests/test_glm53_vulkan.py
@@ -62,7 +62,7 @@ def main() -> int:
# Un traceback su un file che manca fa sembrare rotto il
# motore; chi arriva per la prima volta non puo' distinguere
# le due cose. Il generatore vuole transformers 5.16.1.
- print(f"SKIP: manca {arguments.fixture}; generalo con\n"
+ print(f"SKIP: missing {arguments.fixture}; generate it with\n"
f" python3 tools/make_glm53_multimodal_tiny.py --output <dir>")
return 0
binary = os.path.abspath(arguments.binary)
@@ -71,10 +71,10 @@ def main() -> int:
cpu, _ = run(binary, arguments.fixture, reference, False, arguments.shaders)
gpu, notes = run(binary, arguments.fixture, reference, True, arguments.shaders)
- if "attivo" not in notes:
- reason = ("il binario non e' costruito con VK=1"
- if "Vulkan:" not in notes else "nessun device Vulkan utilizzabile")
- print(f"SKIP: {reason}; il percorso Vulkan non e' stato verificato")
+ if "Vulkan: active for resident matrices" not in notes:
+ reason = ("binary was not built with VK=1"
+ if "Vulkan:" not in notes else "no usable Vulkan device")
+ print(f"SKIP: {reason}; Vulkan path was not verified")
return 0
device = next((line for line in notes.splitlines() if "[VK] ready:" in line), "")
@@ -83,8 +83,8 @@ def main() -> int:
print(f"FAIL {field}\n CPU: {cpu.get(field)}\n Vulkan: {gpu.get(field)}")
return 1
- print(f"PASS GLM-5.3 Vulkan: stessi token della CPU su "
- f"{len(cpu['teacher_forcing'])} posizioni e {len(cpu['greedy'])} passi greedy"
+ print(f"PASS GLM-5.3 Vulkan: same tokens as CPU across "
+ f"{len(cpu['teacher_forcing'])} positions and {len(cpu['greedy'])} greedy steps"
f"{' — ' + device.split('ready:')[1].split(',')[0].strip() if device else ''}")
return 0