The model is copied using deepcopy, stored in a dictionary with other information required to run the model, and pickled (Code below). I’ll try using the state_dict instead of storing the entire, see if that fixes the issue.
Out of curiosity, why is saving only the state_dict recommend?
Here is storage part of the code:
        if best_test_acc <= (test_correct/test_total):
            print("Best model saved")
            bestModel = deepcopy(model)
            best_test_acc = (test_correct/test_total)
    checkpoint_data = {
            "vocab": vocab,
            "model" : bestModel,
            "processor" : processor,
            "test_acc" : best_test_acc
            }
    return checkpoint_data


Here is the pickling, the code above returns the variable checkpoint.
        checkpoint = train(args)
        with open(args.checkpoint, 'wb+') as pk_fh:
            pickle.dump(checkpoint, pk_fh)