Have a look at what shape your arrays are. In particular, is your Val data being read in as a different shape to your Train data?    If they come in as the same, are you processing them in a way that changes them?
If you find an array of the wrong shape, you might need a command something like this
input_ids = torch.cat(input_ids, dim=0)