make generate_predictions.py parsing more robust