

TITLE
Can not convert the the custom trained BERT model to pytorch model for further use which should give me .bin file

COMMENTS
3

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
# 📚 Migration

## Information

I pre trained a bert model from scratch with custom corpus and now want to use that model for further purpose like Qand A, masked word prediction etc. After pre- training I got below files:

bert_config.json bert_model.ckpt.data-00000-of-00001 bert_model.ckpt.index vocab.txt bert_model.ckpt.meta

Now , I need to convert the the model to pytorch model for further use which will give me .bin file . I am running below :+1: 



%cd /content/drive/My Drive/Anirban_test_pytorch/
!python convert_bart_original_pytorch_checkpoint_to_pytorch.py  "/content/drive/My Drive/Anirban_test_pytorch/model.ckpt.index" "/content/sample_data"\


But getting below error:

  File "convert_bart_original_pytorch_checkpoint_to_pytorch.py", line 75, in load_xsum_checkpoint
    sd = torch.load(checkpoint_path, map_location="cpu")
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 585, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 755, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\x00'.

Please help me to fix the same.



