If you’ve added these lines at the beginning of the script, the order or calls to the pseudo random number generator might still be different in your two use cases.
E.g. initializing the random indices in the DataLoader will change the following call to the PRNG for the parameter initialization in your model.