Add delete_bpw_state()

This commit is contained in:
Ed Addario 2025-10-05 20:19:03 +01:00
parent 02c3073b81
commit 74c62ed4e6
No known key found for this signature in database
GPG Key ID: E7875815A3230993
1 changed files with 13 additions and 0 deletions

View File

@ -848,6 +848,19 @@ static std::unordered_map<std::string, ggml_type> target_bpw_type(
return out;
};
auto delete_bpw_state = [&] {
LLAMA_LOG_INFO("%s: deleting %s\n", func, checkpoint_file.c_str());
std::remove(checkpoint_file.c_str());
};
auto check_signal_handler = [&](const std::vector<tensor_info> & all_vec) {
if (bpw_stop.load(std::memory_order_relaxed)) {
LLAMA_LOG_INFO("\n%s: saving bpw progress for %lu tensors to %s\n", func, all_vec.size(), checkpoint_file.c_str());
save_bpw_state(all_vec);
throw std::runtime_error("user interrupted the process");
}
};
// Estimate error for a given type using a sampled subset of rows
auto estimate_error = [&](const ggml_tensor * t,
const ggml_type quant_type,