fix bug for convert scripts

This commit is contained in:
qujianwei 2021-02-03 17:51:44 +08:00
parent cbfba95ad0
commit 8b7d6b3b67
2 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ def load_weights(model_path, use_fp16_weight):
param_name = msname
if "down_sample_layer.0" in param_name:
param_name = param_name.replace("down_sample_layer.0", "conv_down_sample")
if "down_sample-layer.1" in param_name:
if "down_sample_layer.1" in param_name:
param_name = param_name.replace("down_sample_layer.1", "bn_down_sample")
weights[param_name] = ms_ckpt[msname].data.asnumpy()
if use_fp16_weight:
@ -60,5 +60,5 @@ def load_weights(model_path, use_fp16_weight):
return param_list
if __name__ == "__main__":
parameter_list = load_weights(args_opt.ckpt_file, use_fp16_weight=True)
parameter_list = load_weights(args_opt.ckpt_file, use_fp16_weight=False)
save_checkpoint(parameter_list, "resnet50_backbone.ckpt")

View File

@ -44,7 +44,7 @@ def load_weights(model_path, use_fp16_weight):
param_name = msname
if "down_sample_layer.0" in param_name:
param_name = param_name.replace("down_sample_layer.0", "conv_down_sample")
if "down_sample-layer.1" in param_name:
if "down_sample_layer.1" in param_name:
param_name = param_name.replace("down_sample_layer.1", "bn_down_sample")
weights[param_name] = ms_ckpt[msname].data.asnumpy()
if use_fp16_weight: