Yes, it will work. You should also save the state_dict of the optimizer, if it stores any running stats (e.g. Adam).
As a workaround this should work for the moment, even though this error shouldn’t occur, if the training batches have the same number of samples etc.
Could you try that and report, if your code gets an OOM error on the “second epoch”?