force utf-8 encoding for all non-dataset fileios (#97)

This commit is contained in:
Haodong Duan 2023-07-25 10:06:01 +08:00 committed by GitHub
parent 3fe5ee096c
commit 6e885d668b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class VotekRetriever(TopkRetriever):
vote_file=None):
n = len(embeddings)
if vote_file is not None and os.path.isfile(vote_file):
with open(vote_file) as f:
with open(vote_file, encoding='utf-8') as f:
vote_stat = json.load(f)
else:
vote_stat = defaultdict(list)

View File

@ -205,7 +205,7 @@ class Summarizer:
output_dir = osp.split(output_path)[0]
mmengine.mkdir_or_exist(output_dir)
with open(output_path, 'w') as f:
with open(output_path, 'w', encoding='utf-8') as f:
f.write(time_str + '\n')
f.write('tabulate format\n')
f.write('^' * 128 + '\n')
@ -228,6 +228,6 @@ class Summarizer:
content += f'详细评测汇总已输出至 {osp.abspath(output_path)}'
self.lark_reporter.post(content)
with open(output_csv_path, 'w') as f:
with open(output_csv_path, 'w', encoding='utf-8') as f:
f.write('\n'.join([','.join(row) for row in table]) + '\n')
self.logger.info(f'write csv to {osp.abspath(output_csv_path)}')