hyintell / topicx Goto Github PK
View Code? Open in Web Editor NEWModel zoo for topic models, neural topic models, contextual embeddings for topic models ...
License: MIT License
Model zoo for topic models, neural topic models, contextual embeddings for topic models ...
License: MIT License
Hi, I am trying to train CETopic and BERTopic on a custom dataset consisting around 400K English tweets. The models train successfully on a very small subset of the same dataset, but training fails on the full dataset.
dataset = Dataset()
dataset.load_custom_dataset_from_folder(dataset_path)
tm = CETopicTM(dataset=dataset, topic_model='cetopic', num_topics=200,
embedding='sentence-transformers/bert-base-nli-mean-tokens',
word_select_method='tfidf_idfi', dim_size=1, seed=42)
print("Begin model training...")
tm.train()
topic_words = tm.get_topics()
The following error message was displayed for both models.
Begin model training...
Traceback (most recent call last):
File "cetopic_train.py", line 32, in <module>
tm.train()
File "/home/devanshjain/mlda/topicx/baselines/cetopictm.py", line 32, in train
self.topics = self.model.fit_transform(self.sentences)
File "/home/devanshjain/mlda/topicx/baselines/cetopic/cetopic.py", line 55, in fit_transform
embeddings = self._extract_embeddings(documents.Document)
File "/home/devanshjain/mlda/topicx/baselines/cetopic/cetopic.py", line 84, in _extract_embeddings
embeddings = self.embedding_model.embed_documents(documents)
File "/home/devanshjain/mlda/topicx/baselines/cetopic/backend/_base.py", line 69, in embed_documents
return self.embed(document, verbose)
File "/home/devanshjain/mlda/topicx/baselines/cetopic/backend/_flair.py", line 71, in embed
self.embedding_model.embed(sentence)
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/flair/embeddings/base.py", line 62, in embed
self._add_embeddings_internal(data_points)
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/flair/embeddings/base.py", line 766, in _add_embeddings_internal
self._add_embeddings_to_sentences(expanded_sentences)
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/flair/embeddings/base.py", line 684, in _add_embeddings_to_sentences
return_tensors="pt",
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 2512, in __call__
**kwargs,
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 2703, in batch_encode_plus
**kwargs,
File "/home/devanshjain/miniconda3/envs/cetopic/lib/python3.7/site-packages/transformers/tokenization_utils_fast.py", line 459, in _batch_encode_plus
for key in tokens_and_encodings[0][0].keys():
IndexError: list index out of range
Thanks for the nice work by the way!
Hi,
I was reading your paper and I came across the way of word selection for topic representation. I implemented this method along with all the word selection methods you have in this link. However, along the way, I found some code that can be edited. In here baselines/cetopictm.py
you have a function called _calculate_topic_diversity()
and the variables are derived from Bertopic code I believe. I think you should change the names accordingly.
Warm regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.