Normalize non-finite metric export to null
Browse files
code/rr_label_study/oven_study.py
CHANGED
|
@@ -2896,12 +2896,12 @@ def run_study(
|
|
| 2896 |
with result_path.joinpath(f"{episode_dir.name}.metrics.json").open(
|
| 2897 |
"w", encoding="utf-8"
|
| 2898 |
) as handle:
|
| 2899 |
-
json.dump(artifacts.metrics, handle, indent=2)
|
| 2900 |
episode_metrics.append(artifacts.metrics)
|
| 2901 |
|
| 2902 |
summary = _aggregate_summary(episode_metrics)
|
| 2903 |
with result_path.joinpath("summary.json").open("w", encoding="utf-8") as handle:
|
| 2904 |
-
json.dump(summary, handle, indent=2)
|
| 2905 |
return summary
|
| 2906 |
|
| 2907 |
|
|
@@ -2960,7 +2960,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
| 2960 |
independent_replay=args.independent_replay,
|
| 2961 |
per_episode_templates=args.per_episode_templates,
|
| 2962 |
)
|
| 2963 |
-
print(json.dumps(summary, indent=2))
|
| 2964 |
return 0
|
| 2965 |
|
| 2966 |
|
|
|
|
| 2896 |
with result_path.joinpath(f"{episode_dir.name}.metrics.json").open(
|
| 2897 |
"w", encoding="utf-8"
|
| 2898 |
) as handle:
|
| 2899 |
+
json.dump(_json_safe(artifacts.metrics), handle, indent=2, allow_nan=False)
|
| 2900 |
episode_metrics.append(artifacts.metrics)
|
| 2901 |
|
| 2902 |
summary = _aggregate_summary(episode_metrics)
|
| 2903 |
with result_path.joinpath("summary.json").open("w", encoding="utf-8") as handle:
|
| 2904 |
+
json.dump(_json_safe(summary), handle, indent=2, allow_nan=False)
|
| 2905 |
return summary
|
| 2906 |
|
| 2907 |
|
|
|
|
| 2960 |
independent_replay=args.independent_replay,
|
| 2961 |
per_episode_templates=args.per_episode_templates,
|
| 2962 |
)
|
| 2963 |
+
print(json.dumps(_json_safe(summary), indent=2, allow_nan=False))
|
| 2964 |
return 0
|
| 2965 |
|
| 2966 |
|