Skip to content

fix: make NumPy object arrays JSON-safe - #24

Open
danielgaskins wants to merge 1 commit into
generative-computing:mainfrom
danielgaskins:fix/issue-23-numpy-json
Open

fix: make NumPy object arrays JSON-safe#24
danielgaskins wants to merge 1 commit into
generative-computing:mainfrom
danielgaskins:fix/issue-23-numpy-json

Conversation

@danielgaskins

Copy link
Copy Markdown

Summary

to_jsonable() returned the result of ndarray.tolist() without converting its nested values. NumPy object arrays could therefore leave Path, set, and similar objects in benchmark profiles, causing checkpoint writes to fail in json.dump().

Pass the resulting list through the existing recursive converter. Numeric arrays keep producing ordinary lists, while nested objects are converted using the same rules as other sequences.

Closes #23

Tests

  • pytest -q tests/core/test_evaluation_utils.py tests/core/test_benchmark.py
    • 84 passed
    • 8 skipped
  • Changed-file pre-commit checks, including detect-secrets and isort
  • git diff --check

The repository-wide pre-commit run also scans unchanged notebooks and currently reports existing high-entropy outputs and formatting changes outside this pull request. Those unrelated changes are not included.

Signed-off-by: Daniel Gaskins <danielgaskins99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark checkpoints fail for nested objects inside NumPy arrays

1 participant