Archived
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:
1 parent
f3979aa538
commit
d09d733b07
4 files changed
+23
-9
No files matched your search
@@ -48,6 +48,7 @@ struct ControlVector {
|
||||
std::vector<float> scales;
|
||||
int64_t n_embd = 0;
|
||||
int64_t n_layers = 0;
|
||||
int64_t n_dirs = 0; /* directions the file carried (47 for the published one) */
|
||||
int first = -1, last = -1; /* inclusive layer range */
|
||||
float user_scale = 1.0f;
|
||||
std::string path;
|
||||
|
||||
Reference in new issue
Block a user