MilaNLProc / contextualized-topic-models

A python package to run contextualized topic modeling. CTMs combine contextualized embeddings (e.g., BERT) with topic models to get coherent topics. Published at EACL and ACL 2021 (Bianchi et al.).
MIT License
1.21k stars 147 forks source link

Inference with the last version in master #122

Closed Elfilali-Taoufiq closed 1 year ago

Elfilali-Taoufiq commented 1 year ago

Description

I'm trying to use my trained model for inference, and i found this notebook : https://colab.research.google.com/drive/1euxW3ya3_PX6Kj1tnCNrIQ7pjZIODsB6?usp=sharing#scrollTo=SZmTpQUov8y8

that you suggested , but i have a problem:

I'm using a new version that i installed in local, and i dont find some functions in the "TopicModelDataPreparation" class, such as : create_training_set . how can i do Prediction with the saved model in the new version of the package plz ?

What I Did

- I insalled  the package in my local from source after clone the repo, this is because i made some change in the preprocesss
- I trained a model with my custom data without problems
- I saved the model and the vocab trained for using in prod
- I got some error "RuntimeError: mat1 and mat2 shapes cannot be multiplied (5x187428 and 367170x100)" in this line: 
ctmtopics_predictions_zh = ctm.get_thetas(training_dataset, n_samples=5) # get all the topic predictions
vinid commented 1 year ago

Hello!!!

That colab uses an old version of the package.

You can use this one that is the latest one: https://colab.research.google.com/drive/1fXJjr_rwqvpp1IdNQ4dxqN4Dp88cxO97?usp=sharing

Elfilali-Taoufiq commented 1 year ago

hello @vinid

Thank you for sharing