TransformerLensOrg / CircuitsVis

Mechanistic Interpretability Visualizations using React
https://alan-cooney.github.io/CircuitsVis/
MIT License
192 stars 29 forks source link

Props cannot be NumPy floats #48

Open neelnanda-io opened 1 year ago

neelnanda-io commented 1 year ago

convert_props({"a": np.float32(1.)}) gives the error TypeError: Object of type float32 is not JSON serializable

This is an issue if you take eg max_value=array.max() for some numpy array, as this returns a np.float32 object not float. This can likely be fixed with a quick hack to cast types like this to a float. I may add this myself at some point.