What is the standard way to halt a script when it has converged?

what is the standard way to detect if a model has converged. I was going to record 5 losses with 95 confidence intervals and if they all agreed then I’d halt the script. I assume this must be implemented already in pytorch or pytorch lightning somewhere. I don’t need a perfect solution just the standard way to do this automatically halt when converged.