Proposed fix for 'Model predict with forward will fail if PIL image does not have filename attribute' #2702