Open Echo0117 opened 3 years ago
Hi, I'm trying to transfer the labert model to pytorch, I used the code online :
path="./chinese_labert-base-std-512/" tf_checkpoint_path = path + "model.ckpt/"#自己BERT模型文件夹下的ckpt文件(共3个一组) bert_config_file = path + "labert_config.json" #自己BERT模型文件夹下的config pytorch_dump_path = path + "pytorch_model.bin" def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_path): # Initialise PyTorch model config = BertConfig.from_json_file(bert_config_file) print(f"Building PyTorch model from configuration: {config}") model = BertForPreTraining(config) # Load weights from tf checkpoint load_tf_weights_in_bert(model, config, tf_checkpoint_path) # Save pytorch-model print(f"Save PyTorch model to {pytorch_dump_path}") torch.save(model.state_dict(), pytorch_dump_path) convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_path)
But I got this:
Does anyone know if there's a way to make it work?Thanks a lot!!
same
Hi, I'm trying to transfer the labert model to pytorch, I used the code online :
But I got this:
Does anyone know if there's a way to make it work?Thanks a lot!!