Or use transformers.utils.set_seed if the old and new implementations are in the same framework.