MaartenGr / MaartenGr/BERTopic

Embedding Error

Open
#1,533 3 comments 0 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 @MaartenGr ,

I installed a Google package that updated some packages and after that I am getting the following error. Can you please help me to resolve this? Thanks

2023-09-19 16:43:58,838 - BERTopic - Transformed documents to Embeddings
Traceback (most recent call last):
topics, probs = topic_model.fit_transform(docs)
File "... /bertopic/_bertopic.py", line 350, in fit_transform
y, embeddings = self._guided_topic_modeling(embeddings)
File "... /bertopic/_bertopic.py", line 2919, in _guided_topic_modeling
seed_topic_embeddings = np.vstack([seed_topic_embeddings, embeddings.mean(axis=0)])
File "<array_function internals>", line 5, in vstack
File "... /site-packages/numpy/core/shape_base.py", line 282, in vstack
return _nx.concatenate(arrs, 0)
File "<array_function internals>", line 5, in concatenate
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 46 and the array at index 1 has size 100

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 in bertopic/_bertopic.py at fit_transform and _guided_topic_modeling, then inspect the NumPy vstack failure and the embedding dimensions shown in the traceback. Reproduce the failure with the reported package state and determine which inputs produce dimensions 46 and 100. Done means the cause and a verified compatibility or input-level resolution are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.