-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Closed
Description
Trying to convert BERT checkpoints to pytorch checkpoints. It worked for default uncased bert_model.ckpt. However, after we did a custom training of tensorflow version and then tried to convert TF checkpoints to pytorch, it is giving error: 'BertPreTrainingHeads' object has no attribute 'squad'
When printed
elif l[0] == 'output_bias' or l[0] == 'beta':
pointer = getattr(pointer, 'bias')
elif l[0] == 'output_weights':
pointer = getattr(pointer, 'weight')
else:
print("--> ", str(l)) ############### printed this
print("==> ", str(pointer)) ################# printed this
pointer = getattr(pointer, l[0])
output:
--> ['squad']
==> BertPreTrainingHeads(
(predictions): BertLMPredictionHead(
(transform): BertPredictionHeadTransform(
(dense): Linear(in_features=768, out_features=768, bias=True)
(LayerNorm): BertLayerNorm()
)
(decoder): Linear(in_features=768, out_features=30522, bias=False)
)
(seq_relationship): Linear(in_features=768, out_features=2, bias=True)
)
- Can you please tell us what is happening? Does tensorflow add something during finetuning? Not sure from where squad word got into tensorflow ckpt file.
- And, what needs to be done to fix this?
- Are you planning to fix this and release updated code?
Metadata
Metadata
Assignees
Labels
No labels