I save the last hidden layer of Bert for my following process using pickle on GPU.
# output is the last hidden layer of bert, transformed on GPU
with open(filename, 'wb') as f:
pk.dump(output, f)
Is it possible to load it on my person laptop without GPU? I tried following code, but all failed.
# 1st try
with open(filename, 'rb') as f:
torch.load(f, map_location='cpu')
# 2nd
torch.load(filename, map_location=torch.device('cpu'))
All get 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=torch.device('cpu') to map your storages to the CPU.
Is it possible to load the file on my laptop?