MaartenGr / MaartenGr/BERTopic

Nan Representative Docs when loading a serialized model

Open
#1,975 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hi,
I've serialized my model using the command `topic_model.save(folder_path, serialization="safetensors", save_ctfidf=True, save_embedding_model=model_name)`. But when I load the model with BERTopic.load(topic_model_path), the column 'Representative_Docs' is filled with NaN values. How can I recover or recompute them after loading the model?

Thanks in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown BERTopic.save call using serialization="safetensors" and then BERTopic.load(topic_model_path). Trace how Representative_Docs is written and restored during serialization, and compare the loaded model with the original; done means representative documents are preserved or the missing restoration behavior is covered by a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.