The physics of energy-based models