mtmd: fix mtmd_get_memory_usage (#24867)

This commit is contained in:
Xuan-Son Nguyen
2026-06-21 14:12:15 +02:00
committed by GitHub
parent bf533823cd
commit 0d135df48c
3 changed files with 37 additions and 32 deletions

View File

@@ -926,13 +926,15 @@ private:
// optionally get the memory usage of mmproj
if (has_mmproj && params_base.fit_params) {
int64_t t_start = ggml_time_us();
auto mmproj_mem = mtmd_get_memory_usage(mmproj_path.c_str(), mparams);
int64_t t_elapsed = ggml_time_us() - t_start;
if (!mmproj_mem.empty()) {
size_t total = 0;
for (auto & [dev, size] : mmproj_mem) {
total += size;
}
SRV_INF("[mtmd] estimated worst-case memory usage of mmproj is %.2f MiB\n", total / (1024.0 * 1024.0));
SRV_INF("[mtmd] estimated worst-case memory usage of mmproj is %.2f MiB (took %.2f ms)\n", total / (1024.0 * 1024.0), t_elapsed / 1000.0);
GGML_ASSERT(!params_base.fit_params_target.empty());
for (auto & [dev, size] : mmproj_mem) {
for (size_t i = 0; i < ggml_backend_dev_count(); i++) {