未验证 提交 618c2c75 编写于 作者: L lujun 提交者: GitHub

[cherry pick] update load_error_info (#18256)

Repair error prompt: Users are prompted to check whether the model or parameter files are damaged when loading parameters are wrong.

* cherry pick 18000, test=release/1.5
上级 6125a588
...@@ -65,7 +65,10 @@ class LoadCombineOpKernel : public framework::OpKernel<T> { ...@@ -65,7 +65,10 @@ class LoadCombineOpKernel : public framework::OpKernel<T> {
auto *tensor = out_vars[i]->GetMutable<framework::LoDTensor>(); auto *tensor = out_vars[i]->GetMutable<framework::LoDTensor>();
// Error checking // Error checking
PADDLE_ENFORCE(static_cast<bool>(*buffer), "Cannot read more"); PADDLE_ENFORCE(
static_cast<bool>(*buffer),
"There is a problem with loading model parameters. "
"Please check whether the model file is complete or damaged. ");
// Get data from fin to tensor // Get data from fin to tensor
DeserializeFromStream(*buffer, tensor, dev_ctx); DeserializeFromStream(*buffer, tensor, dev_ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册