train; define is_valid_file only once in utils