Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raptor/cluster_utils.py line 111 AttributeError: 'bool' object has no attribute 'all' #56

Open
bogolese opened this issue Sep 11, 2024 · 1 comment

Comments

@bogolese
Copy link

These lines:

        indices = np.where(
            (embeddings == local_cluster_embeddings_[:, None]).all(-1)
        )[1]

are producing this error:

AttributeError: 'bool' object has no attribute 'all'

Background:

both embeddings and local_cluster_embeddings_ are of type numpy.ndarray
embeddings.shape: (507362, 768)
local_cluster_embeddings.shape: (749, 768)
local_cluster_embeddings[:, None].shape: (749, 1, 768)

so an apparent shape mis-match?

embeddings == local_cluster_embeddings_[:, None]: False
(embeddings == local_cluster_embeddings_[:, None]): False

so no all(), hence

(embeddings == local_cluster_embeddings_[:, None]).all(-1): ERROR!

If I knew what this was supposed to do (i.e., get the indices of the nodes in the local cluster maybe?) I could maybe work around this. But right now I'm flubbered as to what is going wrong and what it's supposed to do!

@bogolese
Copy link
Author

I think this may have something to do with the size of the dataset. I ran through a subset of the data (50K vs 500K entries) and this incomprehensible (me me anyway!) line of code works as advertised. Apparently it is capturing the indices of the entries within embeddings that match the entries in local_cluster_embeddings_. I have NO idea WHY this works (the two arrays have a different shape!), but it seems to do so. Oh, and a comment would have been nice. :)

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

No branches or pull requests

1 participant