Nonequilibrium thermodynamics of self-supervised learning