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

c_tf_idf_ is None when using zero shot topic modeling. #2003

Open
ishansuryan opened this issue May 22, 2024 · 1 comment
Open

c_tf_idf_ is None when using zero shot topic modeling. #2003

ishansuryan opened this issue May 22, 2024 · 1 comment

Comments

@ishansuryan
Copy link

I am using zero shot topic modeling using bertopic and i also want hierarchical topic representation but When i run the model.hierarchical_topics(array of strings) the following errors is what i get:

TypeError: 'NoneType' object is not subscriptable

TypeError Traceback (most recent call last)
File , line 1
----> 1 model.hierarchical_topics(array of strings)

File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.10/site-packages/bertopic/bertopic.py:975, in BERTopic.hierarchical_topics(self, docs, linkage_function, distance_function)
972 linkage_function = lambda x: sch.linkage(x, 'ward', optimal_ordering=True)
974 # Calculate distance
--> 975 embeddings = self.c_tf_idf
[self._outliers:]
976 X = distance_function(embeddings)
977 X = validate_distance_matrix(X, embeddings.shape[0])

TypeError: 'NoneType' object is not subscriptable

@MaartenGr
Copy link
Owner

This is in essence the same issue as #1999 where you can find a temporary fix. A more permanent fix will follow but that needs to be discussed still.

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

2 participants