MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Warmup

Method Warmup

serving/processor/serving/model_instance.cc:353–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353Status LocalSessionInstance::Warmup(
354 ModelSession* warmup_session) {
355 if (warmup_file_name_.empty() &&
356 !ShouldWarmup(model_signature_.second)) {
357 return Status::OK();
358 }
359
360 LOG(INFO) << "Try to warmup model: " << warmup_file_name_;
361 Status s;
362 Call call;
363 if (warmup_file_name_.empty()) {
364 s = CreateWarmupParams(model_signature_.second, &call);
365 } else {
366 s = CreateWarmupParams(model_signature_.second,
367 warmup_file_name_, &call,
368 parser_, signature_info_);
369 }
370 if (!s.ok()) {
371 LOG(ERROR) << "Create warmup params failed, warmup will be canceled.";
372 return s;
373 }
374
375 int left_try_count = WARMUP_COUNT;
376 while (left_try_count > 0) {
377 if (warmup_session) {
378 s = warmup_session->Warmup(
379 call.request, call.response);
380 } else {
381 s = session_mgr_->Warmup(
382 call.request, call.response);
383 }
384 if (!s.ok()) return s;
385
386 --left_try_count;
387 call.response.outputs.clear();
388 }
389 LOG(INFO) << "Warmup model successful: " << warmup_file_name_;
390
391 return Status::OK();
392}
393
394std::string LocalSessionInstance::DebugString() {
395 return model_json_signature_;

Callers 2

InitMethod · 0.45
CreateInstancesMethod · 0.45

Calls 5

ShouldWarmupFunction · 0.85
CreateWarmupParamsFunction · 0.85
emptyMethod · 0.45
okMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected