mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
Update
This commit is contained in:
parent
af9ee506c3
commit
3ba4455ee6
@ -135,17 +135,17 @@ class NumWorkerPartitioner(BasePartitioner):
|
|||||||
dataset_abbr = dataset_abbr_from_cfg(dataset)
|
dataset_abbr = dataset_abbr_from_cfg(dataset)
|
||||||
test_range = dataset.reader_cfg.get('test_range', '')
|
test_range = dataset.reader_cfg.get('test_range', '')
|
||||||
|
|
||||||
# 如果不强制重建且缓存中有数据,则使用缓存
|
# If not forcing rebuild and data exists in cache, use the cache
|
||||||
if not self.force_rebuild and dataset_abbr in self.dataset_size:
|
if not self.force_rebuild and dataset_abbr in self.dataset_size:
|
||||||
actual_size = eval('len(range(self.dataset_size[dataset_abbr])'
|
actual_size = eval('len(range(self.dataset_size[dataset_abbr])'
|
||||||
f'{test_range})')
|
f'{test_range})')
|
||||||
return actual_size
|
return actual_size
|
||||||
|
|
||||||
# 否则重新构建数据集获取大小
|
# Otherwise, rebuild the dataset to get its size
|
||||||
dataset = build_dataset_from_cfg(dataset)
|
dataset = build_dataset_from_cfg(dataset)
|
||||||
self.dataset_size[dataset_abbr] = len(dataset.test)
|
self.dataset_size[dataset_abbr] = len(dataset.test)
|
||||||
|
|
||||||
# 保存到缓存文件
|
# Save to cache file
|
||||||
if self.dataset_size_path:
|
if self.dataset_size_path:
|
||||||
mmengine.mkdir_or_exist('.cache/')
|
mmengine.mkdir_or_exist('.cache/')
|
||||||
mmengine.dump(self.dataset_size,
|
mmengine.dump(self.dataset_size,
|
||||||
|
@ -84,7 +84,7 @@ class FilterDuplicateMessage(logging.Filter):
|
|||||||
|
|
||||||
|
|
||||||
def pretty_print_config(cfg):
|
def pretty_print_config(cfg):
|
||||||
"""使用rich库美化配置输出."""
|
"""Pretty print config using the rich library."""
|
||||||
console = Console()
|
console = Console()
|
||||||
config_str = cfg.pretty_text
|
config_str = cfg.pretty_text
|
||||||
syntax = Syntax(config_str,
|
syntax = Syntax(config_str,
|
||||||
|
Loading…
Reference in New Issue
Block a user