From 13bf0d4659f633a118ca75f4f8b3291e0e0ffc05 Mon Sep 17 00:00:00 2001 From: thomwolf Date: Sun, 9 Dec 2018 16:17:11 -0500 Subject: [PATCH] fixing Adam weights skip in TF convert script --- pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py b/pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py index 20fdd8c0d6..79b5f41adc 100755 --- a/pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py +++ b/pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py @@ -50,7 +50,7 @@ def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytor name = name.split('/') # adam_v and adam_m are variables used in AdamWeightDecayOptimizer to calculated m and v # which are not required for using pretrained model - if name[-1] in ["adam_v", "adam_m"]: + if any(n in ["adam_v", "adam_m"] for n in name): print("Skipping {}".format("/".join(name))) continue pointer = model