Leveraging free energy in pretraining model selection for improved fine-tuning