You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you're casting the numpy int64s to integers, presumably so they can be used as indexes?
In any case, the cluster keys remain np.int64. This means the whole dict cannot be serialized (as json doesn't know how to handle numpy data types).
My suggestion would be to int() the keys as well to make this a bit less perplexing. But I'm not sure if you rely on the indexes being np.int64 in some other place?
The text was updated successfully, but these errors were encountered:
Thank you for finding this! Did you encounter any issues with saving the model due to keeping the cluster keys as np.int64? Or was there another use case for which this is an issue?
Hi, I've simply tried to json.dump() the cluster keys in an attempt to store all the gritty details from the analysis to inspect and save for later. What surprised me was that even default=str failed to convince json to serialize the dict. That's when I found out that the default apparently (and somewhat sensibly) only applies to values, and having np.int64 as keys is not within the json spec.
Ah, right, that makes sense! I am not entirely sure but I do not think it should be any problem to cast them as regular int in that specific function. It seems that cluster in representative_images[cluster] is derived from items in self.cluster_labels which I think can be regular int.
Hi, thanks for your awesome libraries.
Just a short question: In this line:
Concept/concept/_model.py
Line 304 in d270607
you're casting the numpy int64s to integers, presumably so they can be used as indexes?
In any case, the cluster keys remain np.int64. This means the whole dict cannot be serialized (as json doesn't know how to handle numpy data types).
My suggestion would be to int() the keys as well to make this a bit less perplexing. But I'm not sure if you rely on the indexes being np.int64 in some other place?
The text was updated successfully, but these errors were encountered: