预测部分代码从aistudio上复制到本地,在Aistudio上可以正常运行,本地一直报错
self.exe.run(self.startup_prog)
init_checkpoint(
self.exe,
args.init_checkpoint,
main_program=self.test_prog,
use_fp16=False)
def init_checkpoint(exe, init_checkpoint_path, main_program, use_fp16=False):
assert os.path.exists(
init_checkpoint_path), "[%s] cann't be found." % init_checkpoint_path
def existed_persitables(var):
path = os.path.join(init_checkpoint_path, var.name)
return os.path.exists(path)
fluid.io.load_vars(
exe,
init_checkpoint_path,
main_program=main_program,
predicate=existed_persitables)
print("Load model from {}".format(init_checkpoint_path))
if use_fp16:
cast_fp32_to_fp16(exe, main_program)
报错信息:
Error: Cannot open file G:\大四\大四上\网页\model\finetuned_model\encoder_layer_11_multi_head_att_output_fc.b_0 for load op at (D:\1.6.2\paddle\paddle/fluid/operators/load_op.h:37)
[operator < load > error]