core: bound the loader's layer index to the table it fills, and log the file's own count

The direction table is indexed by layer (row 0 unused) and sized n_layers, so a
file carrying direction.<n_layers> passed the range check and then wrote one
row past `dir`, and a package JSON whose range ended at n_layers read one past
`scales`. Both bounds are exclusive now, and cvec_test covers each: direction.48
of a 48-layer model, and a JSON range 4..48 on the same model.

The startup line printed `n_layers - 1` as the direction count -- the published
file's count, but wrong for a file carrying fewer directions; the loader records
what it read and the line prints that. Also drops an unused <cstring>.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent f3979aa538
commit d09d733b07
4 files changed
+23 -9

No files matched your search

+1 -1
View File
@@ -1106,7 +1106,7 @@ int Engine::declare() {
RAD_INFO("control vectors: %s: %lld directions of %lld, layers %d..%d, scale %.3f -- "
"off until a request asks for it (the dashboard's switch, or a request's `control_vector` "
"field)",
cvec_.path.c_str(), (long long) (cvec_.n_layers > 0 ? cvec_.n_layers - 1 : 0),
cvec_.path.c_str(), (long long) cvec_.n_dirs,
(long long) cvec_.n_embd, cvec_.first, cvec_.last, (double) cvec_.user_scale);
decide("control vectors", cvec_.path,
"found beside the container, in its directory, or in $RADIANCE_HOME/vectors; "