[Evaluation] Improve patch apply in SWE-Bench (#2684)

* add newline after patch to fix patch apply

* only add newline if not empty
This commit is contained in:
Xingyao Wang 2024-06-29 14:11:07 +08:00 committed by GitHub
parent 7d31057904
commit e8cb6803df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,9 @@ model_name = os.path.basename(os.path.dirname(args.od_output_file))
def convert_row_to_swebench_format(row):
return {
'instance_id': row['instance_id'],
'model_patch': row['git_patch'].replace('\r\n', '\n'),
'model_patch': row['git_patch'].replace('\r\n', '\n').rstrip() + '\n'
if row['git_patch'].strip()
else '',
'model_name_or_path': model_name,
}