def benchmark_score_from_local(benchmark_id, training_dir):
spec = gym.benchmark_spec(benchmark_id)
directories = []
for name, _, files in os.walk(training_dir):
manifests = gym.monitoring.detect_training_manifests(name, files=files)
if manifests:
directories.append(name)
benchmark_results = defaultdict(list)
for training_dir in directories:
results = gym.monitoring.load_results(training_dir)
env_id = results['env_info']['env_id']
benchmark_result = spec.score_evaluation(env_id, results['data_sources'], results['initial_reset_timestamps'], results['episode_lengths'], results['episode_rewards'], results['episode_types'], results['timestamps'])
# from pprint import pprint
# pprint(benchmark_result)
benchmark_results[env_id].append(benchmark_result)
return gym.benchmarks.scoring.benchmark_aggregate_score(spec, benchmark_results)
评论列表
文章目录