BobXWu / FASTopic

A Fast, Adaptive, Stable, and Transferable Topic Model
https://pypi.org/project/fastopic/
Apache License 2.0
28 stars 3 forks source link

Installing `fastopic` using `pip` causes errors due to outdated `topmost` code #2

Closed s-jse closed 3 months ago

s-jse commented 3 months ago

I installed fastopic by running pip install fastopic

Then the example from README:

from fastopic import FASTopic
from sklearn.datasets import fetch_20newsgroups
from topmost.preprocessing import Preprocessing

docs = fetch_20newsgroups(subset='all',  remove=('headers', 'footers', 'quotes'))['data']

preprocessing = Preprocessing(vocab_size=10000)

model = FASTopic(50, preprocessing)
topic_top_words, doc_topic_dist = model.fit_transform(docs)
print(topic_top_words)
print(doc_topic_dist)

Gives this error:

  File "/home/user/fastopic/test.py", line 11, in <module>
    topic_top_words, doc_topic_dist = model.fit_transform(docs)
  File "/home/user/anaconda3/envs/fastopic/lib/python3.10/site-packages/fastopic/FASTopic.py", line 81, in fit_transform
    dataset = RawDatasetHandler(docs, self.preprocessing, device=self.device, as_tensor=True, pretrained_WE=False)
TypeError: RawDatasetHandler.__init__() got an unexpected keyword argument 'pretrained_WE'

System

s-jse commented 3 months ago

Follow up: Installing topmost from its main branch (instead of the latest released version on Pypi) resolved this issue.

BobXWu commented 3 months ago

Thank you. We've released a new version of topmost.