Fine-Tuning Generative Models as an Inference Method for Robotic Tasks