I fine-tuned the pytorch_model.bin on a GPU machine (google cloud) but need to use it on my home computer (no GPU). When I tried to open it using model = BertForMaskedLM.from_pretrained(bert_version) I got the following error:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available()
is False. If you are running on a CPU-only machine, please use torch.load with map_location='cpu'
to map your storages to the CPU.
Perhaps you can add an option into from_pretrained() such as cpu=True which will then call
torch.load(weights_path, map_location=lambda storage, location: 'cpu')