Enforce tensor structure when aggregating multiple imatrix files
This commit is contained in:
parent
a2b86d7fd9
commit
658c6a8303
|
|
@ -1043,15 +1043,22 @@ bool IMatrixCollector::load_imatrix(const char * file_name) {
|
|||
int64_t nval = ggml_nelements(in_sum2);
|
||||
if (e.values.empty()) {
|
||||
e.values.resize(nval, 0.0f);
|
||||
if (in_sum != nullptr) {
|
||||
e.activations.resize(nval, 0.0f);
|
||||
}
|
||||
} else if ((size_t) nval != e.values.size()) {
|
||||
LOG_ERR("%s: mismatched sums size for %s: %zu != %zu\n", __func__, name.c_str(), (size_t) nval, e.values.size());
|
||||
gguf_free(ctx_gguf);
|
||||
ggml_free(ctx);
|
||||
return false;
|
||||
}
|
||||
if (in_sum != nullptr) {
|
||||
if (e.activations.empty()) {
|
||||
e.activations.resize(nval, 0.0f);
|
||||
} else if ((size_t) nval != e.activations.size()) {
|
||||
LOG_ERR("%s: mismatched activations size for %s: %zu != %zu\n", __func__, name.c_str(), (size_t) nval, e.activations.size());
|
||||
gguf_free(ctx_gguf);
|
||||
ggml_free(ctx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t ncounts = ggml_nelements(counts);
|
||||
if (e.counts.empty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue