"...composable_kernel.git" did not exist on "e9d4e893e589ca2e2588365bee4ff3fe59408ce6"
Unverified Commit 6e885d66 authored by Haodong Duan's avatar Haodong Duan Committed by GitHub
Browse files

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

parent 3fe5ee09
...@@ -42,7 +42,7 @@ class VotekRetriever(TopkRetriever): ...@@ -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: ...@@ -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: ...@@ -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)}')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment