MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / prepare_imatrix

Function prepare_imatrix

tools/quantize/quantize.cpp:364–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364static int prepare_imatrix(const std::string & imatrix_file,
365 std::vector<std::string> & imatrix_dataset,
366 const std::vector<std::string> & included_weights,
367 const std::vector<std::string> & excluded_weights,
368 std::unordered_map<std::string, std::vector<float>> & imatrix_data) {
369 int m_last_call = -1;
370 if (!imatrix_file.empty()) {
371 m_last_call = load_imatrix(imatrix_file, imatrix_dataset, imatrix_data);
372 }
373 if (imatrix_data.empty()) {
374 return m_last_call;
375 }
376 if (!excluded_weights.empty()) {
377 for (const auto & name : excluded_weights) {
378 for (auto it = imatrix_data.begin(); it != imatrix_data.end();) {
379 auto pos = it->first.find(name);
380 if (pos != std::string::npos) {
381 it = imatrix_data.erase(it);
382 } else {
383 ++it;
384 }
385 }
386 }
387 }
388 if (!included_weights.empty()) {
389 std::unordered_map<std::string, std::vector<float>> tmp;
390 for (const auto & name : included_weights) {
391 for (auto & e : imatrix_data) {
392 auto pos = e.first.find(name);
393 if (pos != std::string::npos) {
394 tmp.emplace(std::move(e));
395 }
396 }
397 }
398 imatrix_data = std::move(tmp);
399 }
400 if (!imatrix_data.empty()) {
401 printf("%s: have %d importance matrix entries\n", __func__, int(imatrix_data.size()));
402 }
403 return m_last_call;
404}
405
406static ggml_type parse_ggml_type(const char * arg) {
407 for (int i = 0; i < GGML_TYPE_COUNT; ++i) {

Callers 1

mainFunction · 0.85

Calls 6

load_imatrixFunction · 0.85
endMethod · 0.80
findMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected