A 2.78-trillion-parameter Kimi K3 running inference on a single CPU in 8.24 GB of RAM. Portable C99: no BLAS, no framework, no GPU.
C avx2c99cpu-inferencedeep-learningfrom-scratchinference-enginekimi-k3linear-attentionllmllm-inferencemachine-learningmemory-efficientmixture-of-expertsmoemxfp4quantizationsimdsystems-programmingtransformerzero-dependencies
fix(io): say which file is missing when a tensor is not found
Fareed Khane52d766e51bc
diff --git a/src/io/k3_load.c b/src/io/k3_load.cindex 7741061..ec991b9 100644--- a/src/io/k3_load.c+++ b/src/io/k3_load.c@@ -24,10 +24,10 @@ int k3_expert_ref(const K3St *s, int layer, int expert, K3ExpertRef *r)for (int i = 0; i < 3; i++) {snprintf(name, sizeof name, EXPERT_FMT, layer, expert, W[i], "weight_packed");pk[i] = k3_st_find(s, name);- if (!pk[i]) { fprintf(stderr, "k3_load: missing %s\n", name); return -1; }+ if (!pk[i]) { fprintf(stderr, "k3_load: missing %s\n", name); k3_st_note_missing(s, name); return -1; }snprintf(name, sizeof name, EXPERT_FMT, layer, expert, W[i], "weight_scale");sc[i] = k3_st_find(s, name);- if (!sc[i]) { fprintf(stderr, "k3_load: missing %s\n", name); return -1; }+ if (!sc[i]) { fprintf(stderr, "k3_load: missing %s\n", name); k3_st_note_missing(s, name); return -1; }if (pk[i]->dtype != K3_DT_U8 || sc[i]->dtype != K3_DT_U8) {fprintf(stderr, "k3_load: L%d expert %d %s is not U8\n", layer, expert, W[i]);diff --git a/src/io/k3_st.c b/src/io/k3_st.cindex bb9f800..7bb0af9 100644--- a/src/io/k3_st.c+++ b/src/io/k3_st.c@@ -28,9 +28,53 @@#include <unistd.h>#include "k3_st.h"+#include "json.h" /* model.safetensors.index.json, on the failure path only *//* ------------------------------------------------------------------ helpers */+/* model.safetensors.index.json is read lazily and only to explain a miss: a clean open+ * never pays the parse (the released index maps 497,220 names), and a directory without+ * one still gets the filename-based triage. */+struct K3StIndex {+ int tried; /* looked for the file already */+ int explained; /* k3_st_note_missing has printed its one paragraph */+ jval *root;+ jval *map; /* the "weight_map" object, or NULL */+};++static const char *base_name_(const char *p)+{+ const char *b = strrchr(p, '/');+#ifdef _WIN32+ const char *b2 = strrchr(p, '\\');+ if (b2 && (!b || b2 > b)) b = b2;+#endif+ return b ? b + 1 : p;+}++/* The shard layout is model-NNNNN-of-MMMMM.safetensors. Returns 1 and the two numbers+ * when a basename is of that form. width and twidth are the digit counts of the two+ * fields, kept separately because they differ in the released checkpoint, whose files+ * are model-00001-of-000096.safetensors: five digits, then six. A missing file is named+ * with exactly the padding the present ones use, so the name can be fetched as printed. */+static int shard_numbers(const char *base, int *idx, int *tot, int *width, int *twidth)+{+ const char *of = strstr(base, "-of-");+ if (!of) return 0;+ const char *p = of;+ while (p > base && p[-1] >= '0' && p[-1] <= '9') p--;+ if (p == of || p == base || p[-1] != '-') return 0;+ char *end;+ long i = strtol(p, &end, 10);+ if (end != of) return 0;+ long t = strtol(of + 4, &end, 10);+ if (end == of + 4 || strcmp(end, ".safetensors") != 0) return 0;+ if (i < 1 || t < 1 || i > t || t > 1000000) return 0;+ *idx = (int)i; *tot = (int)t; *width = (int)(of - p);+ if (twidth) *twidth = (int)(end - (of + 4));+ return 1;+}+int k3_st_elemsize(K3Dtype d){switch (d) {@@ -503,12 +547,51 @@ int k3_st_open(K3St *s, const char *dir)s->path = files; s->nshard = nf;s->fd = (int *)malloc(nf * sizeof(int));s->dfd = (int *)malloc(nf * sizeof(int));+ s->dir = strdup(dir);+ s->ix = (struct K3StIndex *)calloc(1, sizeof *s->ix);/* k3_st_close, not free(files): s->path was aliased to `files` two lines above, so* freeing it here leaves s->path dangling and k3_st_close would free it a second* time. Let the one function that owns the teardown do all of it. */- if (!s->fd || !s->dfd) { k3_st_close(s); return -1; }+ if (!s->fd || !s->dfd || !s->dir || !s->ix) { k3_st_close(s); return -1; }for (int i = 0; i < nf; i++) { s->fd[i] = -1; s->dfd[i] = -1; }+ /* What the filenames declare. Saying "1 of 96 shards missing" here, before a single+ * header is read, is the earliest the download script's warning ("a partial+ * checkpoint does not fail loudly") can be made loud; the miss that follows names+ * the file (k3_st_explain_missing). The open still succeeds: a subset directory is+ * a legitimate thing to inspect. */+ for (int i = 0; i < nf; i++) {+ int idx, tot, width;+ if (!shard_numbers(base_name_(files[i]), &idx, &tot, &width, NULL)) continue;+ if (tot > s->declared) s->declared = tot;+ s->numbered++;+ }+ if (s->declared > s->numbered) {+ char first[128] = "";+ int gaps = 0;+ for (int want = 1; want <= s->declared; want++) {+ int here = 0;+ for (int i = 0; i < nf && !here; i++) {+ int idx, tot, width;+ here = shard_numbers(base_name_(files[i]), &idx, &tot, &width, NULL) && idx == want;+ }+ if (here) continue;+ if (!gaps) {+ int width = 5, twidth = 5;+ for (int i = 0; i < nf; i++) {+ int idx, tot;+ if (shard_numbers(base_name_(files[i]), &idx, &tot, &width, &twidth)) break;+ }+ snprintf(first, sizeof first, "model-%0*d-of-%0*d.safetensors",+ width, want, twidth, s->declared);+ }+ gaps++;+ }+ fprintf(stderr, "k3_st: note: the shard filenames in %s declare %d shards but only "+ "%d are here; %d missing, the first is %s\n",+ dir, s->declared, s->numbered, gaps, first);+ }+Build b; memset(&b, 0, sizeof b);for (int i = 0; i < nf; i++) {if (scan_shard(s, &b, i, files[i]) < 0) {@@ -550,10 +633,134 @@ void k3_st_close(K3St *s)if (s->fd) { for (int i = 0; i < s->nshard; i++) if (s->fd[i] >= 0) close(s->fd[i]); free(s->fd); }if (s->dfd) { for (int i = 0; i < s->nshard; i++) if (s->dfd[i] >= 0) close(s->dfd[i]); free(s->dfd); }if (s->path) { for (int i = 0; i < s->nshard; i++) free(s->path[i]); free(s->path); }+ if (s->ix) { json_free_tree(s->ix->root); free(s->ix); }+ free(s->dir);free(s->t); free(s->bucket); free(s->strpool);memset(s, 0, sizeof *s);}+/* ------------------------------------------------------------------ triage */++static void index_load(const K3St *s)+{+ struct K3StIndex *ix = s->ix;+ if (!ix || ix->tried) return;+ ix->tried = 1;+ char path[4096];+ if (snprintf(path, sizeof path, "%s/model.safetensors.index.json", s->dir) >= (int)sizeof path)+ return;+ FILE *f = fopen(path, "rb");+ if (!f) return;+ if (fseek(f, 0, SEEK_END) != 0) { fclose(f); return; }+ long sz = ftell(f);+ /* The released index is ~50 MB. Anything past 256 MB is not an index. */+ if (sz <= 0 || sz > (256L << 20) || fseek(f, 0, SEEK_SET) != 0) { fclose(f); return; }+ char *txt = (char *)malloc((size_t)sz + 1);+ if (!txt) { fclose(f); return; }+ if (fread(txt, 1, (size_t)sz, f) != (size_t)sz) { free(txt); fclose(f); return; }+ fclose(f);+ txt[sz] = '\0';+ ix->root = json_parse(txt, NULL);+ free(txt);+ jval *map = ix->root ? json_get(ix->root, "weight_map") : NULL;+ if (!map || map->t != J_OBJ) {+ fprintf(stderr, "k3_st: note: %s has no usable weight_map; ignoring it\n", path);+ json_free_tree(ix->root); ix->root = NULL;+ return;+ }+ ix->map = map;+}++/* The shard basename the index declares for name: NULL when there is no index or the+ * name is not listed (*listed tells the two apart). One linear pass over the map: this+ * runs once, on the failure path. */+static const char *index_shard(const K3St *s, const char *name, int *listed)+{+ *listed = 0;+ index_load(s);+ if (!s->ix || !s->ix->map) return NULL;+ jval *v = json_get(s->ix->map, name);+ if (!v) return NULL;+ *listed = 1;+ return v->t == J_STR ? v->str : NULL;+}++K3StMiss k3_st_explain_missing(const K3St *s, const char *name, char *buf, size_t cap)+{+ int listed = 0;+ const char *auth = index_shard(s, name, &listed);+ const int have_index = s->ix && s->ix->map;+ char count[96];+ if (s->declared > 0)+ snprintf(count, sizeof count, "%d of %d declared shards are here", s->numbered, s->declared);+ else+ snprintf(count, sizeof count, "%d shard file(s) here, none numbered -of-", s->nshard);++ if (auth) {+ int present = 0;+ for (int i = 0; i < s->nshard && !present; i++)+ present = !strcmp(base_name_(s->path[i]), auth);+ if (!present) {+ snprintf(buf, cap, "model.safetensors.index.json puts it in %s, which is not in "+ "%s (%s): the download is incomplete; fetch that file", auth, s->dir, count);+ return K3_ST_MISS_SHARD_ABSENT;+ }+ snprintf(buf, cap, "model.safetensors.index.json puts it in %s, which is here but "+ "whose header does not declare it: that file is not the one the index "+ "describes (truncated, or from another revision); re-fetch it", auth);+ return K3_ST_MISS_SHARD_MISMATCH;+ }+ if (have_index) {+ snprintf(buf, cap, "model.safetensors.index.json does not list it (%s): this "+ "checkpoint never had a tensor by that name, so the engine and the "+ "checkpoint disagree, not the download", count);+ return K3_ST_MISS_NOT_IN_CHECKPOINT;+ }+ if (s->declared > s->numbered) {+ /* No index: name the absent files from the numbering instead. */+ int width = 5, twidth = 5, n = 0;+ for (int i = 0; i < s->nshard; i++) {+ int idx, tot;+ if (shard_numbers(base_name_(s->path[i]), &idx, &tot, &width, &twidth)) break;+ }+ int w = snprintf(buf, cap, "no model.safetensors.index.json here; the filenames "+ "declare %d shards and %d are here, missing:", s->declared, s->numbered);+ for (int want = 1; want <= s->declared && w >= 0 && (size_t)w < cap; want++) {+ int here = 0;+ for (int i = 0; i < s->nshard && !here; i++) {+ int idx, tot, wd;+ here = shard_numbers(base_name_(s->path[i]), &idx, &tot, &wd, NULL) && idx == want;+ }+ if (here) continue;+ if (n < 4)+ w += snprintf(buf + w, cap - (size_t)w, " model-%0*d-of-%0*d.safetensors",+ width, want, twidth, s->declared);+ else if (n == 4)+ w += snprintf(buf + w, cap - (size_t)w, " ...");+ n++;+ }+ if (w >= 0 && (size_t)w < cap)+ snprintf(buf + w, cap - (size_t)w, " (%d file%s); the tensor is in one of them",+ n, n == 1 ? "" : "s");+ return K3_ST_MISS_SHARD_ABSENT;+ }+ snprintf(buf, cap, "no model.safetensors.index.json here, and %s, so every file a full "+ "download would have is present: this checkpoint has no tensor by that name",+ count);+ return K3_ST_MISS_NOT_IN_CHECKPOINT;+}++void k3_st_note_missing(const K3St *s, const char *name)+{+ if (!s->ix || s->ix->explained) return;+ s->ix->explained = 1;+ char why[1024];+ k3_st_explain_missing(s, name, why, sizeof why);+ fprintf(stderr, "k3_st: %s is missing: %s\n"+ " (later misses in this run are reported by name only; they share this cause)\n",+ name, why);+}+const K3Tensor *k3_st_find(const K3St *s, const char *name){if (!s->bucket) return NULL;diff --git a/src/io/k3_st.h b/src/io/k3_st.hindex 495e10f..61d8c96 100644--- a/src/io/k3_st.h+++ b/src/io/k3_st.h@@ -48,6 +48,8 @@ typedef struct {/* O_DIRECT alignment. Offset, length and buffer must all be multiples of this. */#define K3_ST_ALIGN 4096+struct K3StIndex; /* model.safetensors.index.json, read only to explain a miss */+typedef struct {int *fd; /* one open descriptor per shard */int *dfd; /* the same shards opened O_DIRECT, or -1 */@@ -62,9 +64,20 @@ typedef struct {char *strpool; /* all names, one allocation */size_t strcap, strlen_;++ /* What the shard FILENAMES say about completeness. The released layout is+ * model-NNNNN-of-MMMMM.safetensors, so the directory itself declares how many shards+ * a full download has; `declared` is that MMMMM (0 when no file is named that way)+ * and `numbered` how many such files are actually here. */+ char *dir;+ int declared, numbered;+ struct K3StIndex *ix; /* lazily read; owned by k3_st_close */} K3St;-/* Open every *.safetensors in dir and index every tensor. Returns 0 on success. */+/* Open every *.safetensors in dir and index every tensor. Returns 0 on success. A+ * directory whose filenames declare more shards than are present still opens (a subset+ * is a legitimate thing to inspect) but says so on stderr, and every later miss is+ * explained by k3_st_explain_missing. */int k3_st_open(K3St *s, const char *dir);void k3_st_close(K3St *s);@@ -72,6 +85,28 @@ void k3_st_close(K3St *s);* silently missing weight reads as zeros and the model still runs, plausibly wrong. */const K3Tensor *k3_st_find(const K3St *s, const char *name);+/* WHY A MISS IS TRIAGED+ * "missing language_model.model.layers.40.mlp.down_proj.weight" is the whole message a+ * partial download used to get, and it looks exactly like a wrong --model directory or+ * an engine bug. The directory can say more than that: the filenames declare the shard+ * count, so a missing shard can be NAMED; and model.safetensors.index.json, when the+ * checkpoint shipped one, says which file should carry the tensor and whether the+ * tensor exists in this checkpoint at all -- the case a file count gets exactly wrong+ * (every shard present, and the name was never there). */+typedef enum {+ K3_ST_MISS_SHARD_ABSENT, /* the file that carries it is not in the directory */+ K3_ST_MISS_SHARD_MISMATCH, /* the index names a file that is here but lacks it */+ K3_ST_MISS_NOT_IN_CHECKPOINT/* every declared shard is here (or the index says no) */+} K3StMiss;++/* Explain why `name` is absent, in one line written to buf. The index is read on the+ * first call only, and only on this failure path: a clean open never pays for it. */+K3StMiss k3_st_explain_missing(const K3St *s, const char *name, char *buf, size_t cap);++/* Print that explanation to stderr ONCE per K3St, for the first miss a loader hits: a+ * missing shard is thousands of missing tensors and one cause. */+void k3_st_note_missing(const K3St *s, const char *name);+/* Raw bytes, exactly as stored. buf must hold t->nbytes. Returns bytes read. */int64_t k3_st_read(const K3St *s, const K3Tensor *t, void *buf);diff --git a/src/model/k3_bind.c b/src/model/k3_bind.cindex 39289e0..7c15c4c 100644--- a/src/model/k3_bind.c+++ b/src/model/k3_bind.c@@ -80,6 +80,7 @@ static int64_t plan_resolve(Plan *p, const K3St *s)q->t = k3_st_find(s, q->name);if (!q->t) {fprintf(stderr, "k3_bind: missing tensor %s\n", q->name);+ k3_st_note_missing(s, q->name); /* names the file, once per open */p->bad++;continue;}@@ -517,6 +518,7 @@ static int model_matrix(const K3St *s, const char *name, int rows, int cols,const K3Tensor *t = k3_st_find(s, name);if (!t) {fprintf(stderr, "k3_model_stream: missing tensor %s\n", name);+ k3_st_note_missing(s, name);return -1;}if (t->ndim != 2 || t->shape[0] != rows || t->shape[1] != cols) {diff --git a/tests/unit/test_st_faults.c b/tests/unit/test_st_faults.cindex 05b1c37..d7bb102 100644--- a/tests/unit/test_st_faults.c+++ b/tests/unit/test_st_faults.c@@ -111,6 +111,41 @@ static int make_case(const char *src, const char *dst, const char *mutname,return found || !mutname ? 0 : -1;}+/* Copy every .safetensors from src to dst EXCEPT `skip` (which must exist): the+ * incomplete-download shape, one shard never arrived. */+static int copy_shards(const char *src, const char *dst, const char *skip)+{+ mkdir(dst, 0755);+ DIR *d = opendir(src);+ if (!d) return -1;+ struct dirent *e;+ int skipped = 0;+ while ((e = readdir(d)) != NULL) {+ if (!endswith(e->d_name, ".safetensors")) continue;+ if (skip && strcmp(e->d_name, skip) == 0) { skipped = 1; continue; }+ char sp[1024], dp[1024];+ if (snprintf(sp, sizeof sp, "%s/%s", src, e->d_name) >= (int)sizeof sp ||+ snprintf(dp, sizeof dp, "%s/%s", dst, e->d_name) >= (int)sizeof dp) {+ closedir(d); return -1;+ }+ size_t n = 0;+ unsigned char *b = slurp(sp, &n);+ if (!b) { closedir(d); return -1; }+ const int rc = writeall(dp, b, n);+ free(b);+ if (rc != 0) { closedir(d); return -1; }+ }+ closedir(d);+ return (skip && !skipped) ? -1 : 0;+}++static int write_text(const char *dir, const char *file, const char *text)+{+ char p[2048];+ if (snprintf(p, sizeof p, "%s/%s", dir, file) >= (int)sizeof p) return -1;+ return writeall(p, (const unsigned char *)text, strlen(text));+}+static uint64_t rdle64(const unsigned char *b){uint64_t v = 0;@@ -323,6 +358,122 @@ int main(int argc, char **argv)rc == -99 ? "harness" : (rc != 0 ? "refused" : (nt != 3 ? "wrong tensor count" : "")));}+ /* ---- missing-tensor triage: a miss must say WHICH FILE, not just which name ----+ * The fixture is model-0000{1,2}-of-00002, so the filenames declare two shards.+ * Removing the second is exactly the incomplete download the download script warns+ * "does not fail loudly". The reader must still open the subset, count 1 of 2, and+ * explain the first miss by naming the absent file; with an index it must name the+ * file the index maps the tensor to, and tell a never-existed name apart from an+ * absent shard. */+ static const char SHARD2[] = "model-00002-of-00002.safetensors";+ static const char SHARD1[] = "model-00001-of-00002.safetensors";++ /* M5: one shard absent, no index: the filenames name the file. */+ {+ char d[1024], why[1024] = "";+ snprintf(d, sizeof d, "%s/m5", work);+ K3St s; memset(&s, 0, sizeof s);+ const int ok = copy_shards(fix, d, SHARD2) == 0 && k3_st_open(&s, d) == 0;+ const int absent = ok && k3_st_find(&s, "second.shard.f32") == NULL;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "second.shard.f32", why, sizeof why) : -1;+ ck(ok && s.declared == 2 && s.numbered == 1,+ "1 of 2 declared shards opens, counted", "");+ ck(absent && kind == K3_ST_MISS_SHARD_ABSENT && strstr(why, SHARD2) != NULL+ && strstr(why, "declare 2 shards and 1 are here") != NULL,+ "miss names the absent shard from the filenames", why);+ ck(ok && k3_st_find(&s, "plain.f32.2d") != NULL,+ "tensors of the present shard still resolve", "");+ if (ok) k3_st_close(&s);+ }++ /* M6: one shard absent, and an index that maps the name to it. */+ {+ char d[1024], why[1024] = "";+ snprintf(d, sizeof d, "%s/m6", work);+ K3St s; memset(&s, 0, sizeof s);+ const int ok = copy_shards(fix, d, SHARD2) == 0+ && write_text(d, "model.safetensors.index.json",+ "{\"metadata\":{\"total_size\":1},\"weight_map\":{"+ "\"second.shard.f32\":\"model-00002-of-00002.safetensors\","+ "\"plain.f32.2d\":\"model-00001-of-00002.safetensors\"}}\n") == 0+ && k3_st_open(&s, d) == 0;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "second.shard.f32", why, sizeof why) : -1;+ ck(ok && kind == K3_ST_MISS_SHARD_ABSENT+ && strstr(why, "index.json puts it in model-00002-of-00002.safetensors") != NULL,+ "index names the absent shard for the miss", why);+ if (ok) k3_st_close(&s);+ }++ /* M7: every shard present; the index maps a name to a shard that lacks it. */+ {+ char d[1024], why[1024] = "";+ snprintf(d, sizeof d, "%s/m7", work);+ K3St s; memset(&s, 0, sizeof s);+ const int ok = copy_shards(fix, d, NULL) == 0+ && write_text(d, "model.safetensors.index.json",+ "{\"weight_map\":{\"ghost.tensor\":\"model-00001-of-00002.safetensors\"}}") == 0+ && k3_st_open(&s, d) == 0;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "ghost.tensor", why, sizeof why) : -1;+ ck(ok && kind == K3_ST_MISS_SHARD_MISMATCH && strstr(why, SHARD1) != NULL+ && strstr(why, "does not declare it") != NULL,+ "index names a present shard that lacks the tensor", why);+ if (ok) k3_st_close(&s);+ }++ /* M8: every shard present; the index does not list the name at all. */+ {+ char d[1024], why[1024] = "";+ snprintf(d, sizeof d, "%s/m8", work);+ K3St s; memset(&s, 0, sizeof s);+ const int ok = copy_shards(fix, d, NULL) == 0+ && write_text(d, "model.safetensors.index.json",+ "{\"weight_map\":{\"plain.f32.2d\":\"model-00001-of-00002.safetensors\"}}") == 0+ && k3_st_open(&s, d) == 0;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "ghost.tensor", why, sizeof why) : -1;+ ck(ok && kind == K3_ST_MISS_NOT_IN_CHECKPOINT && strstr(why, "does not list it") != NULL,+ "index says the checkpoint never had the name", why);+ if (ok) k3_st_close(&s);+ }++ /* M9: every shard present, no index: complete by the filenames, so never existed. */+ {+ char d[1024], why[1024] = "";+ snprintf(d, sizeof d, "%s/m9", work);+ K3St s; memset(&s, 0, sizeof s);+ const int ok = copy_shards(fix, d, NULL) == 0 && k3_st_open(&s, d) == 0;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "ghost.tensor", why, sizeof why) : -1;+ ck(ok && s.declared == 2 && s.numbered == 2 && kind == K3_ST_MISS_NOT_IN_CHECKPOINT+ && strstr(why, "2 of 2 declared shards are here") != NULL,+ "complete shard set: the name never existed", why);+ if (ok) k3_st_close(&s);+ }++ /* M10: the released checkpoint names its files model-00001-of-000096.safetensors,+ * five digits then six. Padding the missing name with the index's width alone gave+ * model-00002-of-00003, a file that does not exist anywhere, so a user told to fetch+ * it would get a 404. One fixture shard is published here under that naming scheme,+ * declaring three, and the missing files must be named exactly. */+ {+ char d[1024], src[1024], dst[1100], why[1024] = "";+ int ok = snprintf(d, sizeof d, "%s/m10", work) < (int)sizeof d+ && snprintf(src, sizeof src, "%s/%s", fix, SHARD1) < (int)sizeof src+ && snprintf(dst, sizeof dst, "%s/model-00001-of-000003.safetensors", d)+ < (int)sizeof dst;+ mkdir(d, 0755);+ size_t n = 0;+ unsigned char *b = ok ? slurp(src, &n) : NULL;+ ok = ok && b && writeall(dst, b, n) == 0;+ free(b);+ K3St s; memset(&s, 0, sizeof s);+ ok = ok && k3_st_open(&s, d) == 0;+ const int kind = ok ? (int)k3_st_explain_missing(&s, "ghost.tensor", why, sizeof why) : -1;+ ck(ok && s.declared == 3 && s.numbered == 1 && kind == K3_ST_MISS_SHARD_ABSENT+ && strstr(why, "model-00002-of-000003.safetensors") != NULL+ && strstr(why, "model-00003-of-000003.safetensors") != NULL,+ "5+6 digit names: the missing files are named as they exist", why);+ if (ok) k3_st_close(&s);+ }+printf("\n%s\n", g_fail ? "ST-FAULT TESTS FAILED" : "ST-FAULT TESTS PASSED");return g_fail ? 1 : 0;}