diff options
author | slaren <slarengh@gmail.com> | 2024-06-07 08:01:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 09:01:29 +0300 |
commit | c9ee7118d5644dd3df70ea6878b36a9761616aab (patch) | |
tree | 96464f12935cf86174a4e47ba184236ee771905a /llama.cpp | |
parent | ee459f40f65810a810151b24eba5b8bd174ceffe (diff) |
check for nans in imatrix and quantize (#7807)
* imatrix : detect nan/inf values
* quantize : check imatrix for nan/inf values
Diffstat (limited to 'llama.cpp')
-rw-r--r-- | llama.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -15237,6 +15237,14 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s if (imatrix_data) { LLAMA_LOG_INFO("================================ Have weights data with %d entries\n",int(imatrix_data->size())); qs.has_imatrix = true; + // check imatrix for nans or infs + for (const auto & kv : *imatrix_data) { + for (float f : kv.second) { + if (!std::isfinite(f)) { + throw std::runtime_error(format("imatrix contains non-finite value %f\n", f)); + } + } + } } } |