perf: --eager-load to pre-load params at model-load time (#1687)

This commit is contained in:
fszontagh
2026-06-22 16:10:09 +02:00
committed by GitHub
parent b12098f5d0
commit 787d229d84
6 changed files with 34 additions and 1 deletions

View File

@@ -147,6 +147,17 @@ bool ModelManager::register_param_tensors(const std::string& desc,
return true;
}
bool ModelManager::load_all_params_eagerly() {
std::vector<TensorState*> all_states;
all_states.reserve(tensor_states_.size());
for (const auto& s : tensor_states_) {
if (s != nullptr) {
all_states.push_back(s.get());
}
}
return load_tensors_to_params_backend(all_states);
}
bool ModelManager::validate_registered_tensors() {
bool ok = true;
for (const auto& state : tensor_states_) {