Repository navigation
fix(statistics): accept finite NumPy scalar measurements - #651
harshitethic wants to merge 2 commits into
Conversation
|
| from dataclasses import dataclass | ||
| from itertools import pairwise | ||
|
|
||
| import numpy as np |
There was a problem hiding this comment.
The existing utility test runs Python without site-packages and imports hflow.statistics. This new numpy import raises ModuleNotFoundError, so the test fails before its checks run. Keep that import working without site-packages, or change the test and the documented standard-library-only promise together.
| if isinstance(value, np.generic): | ||
| value = value.item() | ||
| if isinstance(value, bool) or not isinstance(value, (int, float)): |
There was a problem hiding this comment.
np.longdouble(1).item() does not become a Python int or float. The next check therefore makes WeightedValue(np.longdouble(1), 1) raise ValueError, even though the measurement is finite. Callers using that NumPy scalar type still cannot use these summaries; accept finite real NumPy scalars without relying on .item() to return a built-in number.
|
Thanks for this. #647 was assigned to chiruu12, and their fix in #649 has now merged, so I'm closing this one. Issues with an assignee are taken; everything else is fair game. If you want another, exercising HFlow against a real corpus such as Egocentric-10K on Hugging Face and reporting what breaks or is slow is high-value work right now. |
Summary
.item()before numeric validationnp.float32,np.int64, andnp.bool_Fixes #647.