mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
force utf-8 encoding for all non-dataset fileios (#97)
This commit is contained in:
parent
3fe5ee096c
commit
6e885d668b
@ -42,7 +42,7 @@ class VotekRetriever(TopkRetriever):
|
|||||||
vote_file=None):
|
vote_file=None):
|
||||||
n = len(embeddings)
|
n = len(embeddings)
|
||||||
if vote_file is not None and os.path.isfile(vote_file):
|
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)
|
vote_stat = json.load(f)
|
||||||
else:
|
else:
|
||||||
vote_stat = defaultdict(list)
|
vote_stat = defaultdict(list)
|
||||||
|
@ -205,7 +205,7 @@ class Summarizer:
|
|||||||
|
|
||||||
output_dir = osp.split(output_path)[0]
|
output_dir = osp.split(output_path)[0]
|
||||||
mmengine.mkdir_or_exist(output_dir)
|
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(time_str + '\n')
|
||||||
f.write('tabulate format\n')
|
f.write('tabulate format\n')
|
||||||
f.write('^' * 128 + '\n')
|
f.write('^' * 128 + '\n')
|
||||||
@ -228,6 +228,6 @@ class Summarizer:
|
|||||||
content += f'详细评测汇总已输出至 {osp.abspath(output_path)}'
|
content += f'详细评测汇总已输出至 {osp.abspath(output_path)}'
|
||||||
self.lark_reporter.post(content)
|
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')
|
f.write('\n'.join([','.join(row) for row in table]) + '\n')
|
||||||
self.logger.info(f'write csv to {osp.abspath(output_csv_path)}')
|
self.logger.info(f'write csv to {osp.abspath(output_csv_path)}')
|
||||||
|
Loading…
Reference in New Issue
Block a user