I had same error and struggled with that for a while.
At the end, I figured out my solution for this error.
In my case, RuntimeError: max_pool2d_with_indices_out_cuda_frame failed with error code 0 error occured, because of the input data was allocated in ‘cpu’.
I allocated it to ‘cuda’ and the problem has been fixed now.
So, if you are using GPU, I guess you can try allocating your input data to ‘gpu device’ like below.
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
...
labels = torch.from_numpy(np.reshape(labels, (-1, 1)))
labels = labels.type(torch.float)
labels = labels.to(device)

train = list(zip(sequences, labels))

I hope this works.