Fix Bug:Fix GAIA datasets lint error

This commit is contained in:
Deadwalk 2025-04-26 11:30:24 +08:00
parent 8c5b04947f
commit e373a2bbcf
2 changed files with 7 additions and 7 deletions

View File

@ -49,9 +49,9 @@ from .ds1000_interpreter import * # noqa: F401, F403
from .eprstmt import * # noqa: F401, F403 from .eprstmt import * # noqa: F401, F403
from .FinanceIQ import * # noqa: F401, F403 from .FinanceIQ import * # noqa: F401, F403
from .flores import * # noqa: F401, F403 from .flores import * # noqa: F401, F403
from .gaia import * # noqa: F401, F403
from .game24 import * # noqa: F401, F403 from .game24 import * # noqa: F401, F403
from .gaokao_math import * # noqa: F401, F403 from .gaokao_math import * # noqa: F401, F403
from .gaia import * # noqa: F401, F403
from .GaokaoBench import * # noqa: F401, F403 from .GaokaoBench import * # noqa: F401, F403
from .generic import * # noqa: F401, F403 from .generic import * # noqa: F401, F403
from .govrepcrs import * # noqa: F401, F403 from .govrepcrs import * # noqa: F401, F403

View File

@ -1,11 +1,10 @@
import json import json
from os import environ
import os import os
from os import environ
from datasets import Dataset from datasets import Dataset
from opencompass.registry import LOAD_DATASET from opencompass.registry import LOAD_DATASET
from opencompass.utils import get_data_path
from opencompass.utils.datasets_info import DATASETS_MAPPING from opencompass.utils.datasets_info import DATASETS_MAPPING
from .base import BaseDataset from .base import BaseDataset
@ -33,7 +32,7 @@ class GAIADataset(BaseDataset):
'level': item['Level'] 'level': item['Level']
}) })
except Exception as e: except Exception as e:
print(f"Error loading local file: {e}") print(f'Error loading local file: {e}')
else: else:
# 从本地读取 # 从本地读取
compass_data_cache = os.environ.get('COMPASS_DATA_CACHE') compass_data_cache = os.environ.get('COMPASS_DATA_CACHE')
@ -49,12 +48,13 @@ class GAIADataset(BaseDataset):
'file_name': line['file_name'], 'file_name': line['file_name'],
'level': line['Level'] 'level': line['Level']
} }
# 只有在file_name不为空时设置file_path # 只有在file_name不为空时设置file_path
if line['file_name']: if line['file_name']:
row_data['file_path'] = f'{local_path}/{line["file_name"]}' file_name = line['file_name']
row_data['file_path'] = f'{local_path}/{file_name}'
else: else:
row_data['file_path'] = '' row_data['file_path'] = ''
rows.append(row_data) rows.append(row_data)
return Dataset.from_list(rows) return Dataset.from_list(rows)