Skip to content

Commit 2eb08ff

Browse files
committed
Pretty_progress model loading
1 parent 9578fdc commit 2eb08ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

model.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,9 +1695,11 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, ggml_backend
16951695
}
16961696
return true;
16971697
};
1698-
1698+
int tensor_count = 0;
1699+
int64_t t1 = ggml_time_ms();
16991700
for (auto& tensor_storage : processed_tensor_storages) {
17001701
if (tensor_storage.file_index != file_index) {
1702+
++tensor_count;
17011703
continue;
17021704
}
17031705
ggml_tensor* dst_tensor = NULL;
@@ -1709,6 +1711,7 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, ggml_backend
17091711
}
17101712

17111713
if (dst_tensor == NULL) {
1714+
++tensor_count;
17121715
continue;
17131716
}
17141717

@@ -1775,6 +1778,9 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, ggml_backend
17751778
ggml_backend_tensor_set(dst_tensor, convert_buffer.data(), 0, ggml_nbytes(dst_tensor));
17761779
}
17771780
}
1781+
int64_t t2 = ggml_time_ms();
1782+
pretty_progress(++tensor_count, processed_tensor_storages.size(), (t2 - t1) / 1000.0f);
1783+
t1 = t2;
17781784
}
17791785

17801786
if (zip != NULL) {

0 commit comments

Comments
 (0)