BERTopic
BERTopic turns documents, precomputed embeddings, or multimodal inputs into topic models you can fit, inspect, label, visualize, and save.
Install
python -m pip install bertopic
Use only the optional packages that the chosen workflow needs. For example, multimodal image workflows use bertopic[vision], while label and backend workflows may require openai, litellm, langchain, llama-cpp-python, spacy, fastembed, model2vec, gensim, flair, safetensors, or datamapplot.
If you are working from a local checkout to inspect the package, editable install is also fine:
python -m pip install -e .
Quick check
Run the bundled environment check first:
python scripts/check_env.py
Add --smoke for a tiny no-download fit/load-style smoke that uses synthetic documents and precomputed embeddings.
Route map
sub-skills/topic-modeling/ — build BERTopic models, fit and transform data, run partial_fit, mutate topics, and combine or reduce fitted models.
sub-skills/embeddings-backends/ — choose embedding backends, build custom embedders, inventory optional backend imports, and handle precomputed or multimodal embeddings.
sub-skills/vectorizers-ctfidf/ — tune ClassTfidfTransformer, CountVectorizer, and OnlineCountVectorizer for better topic words.
sub-skills/representations-labeling/ — rerank keywords, generate labels, chain representation models, and manage multi-aspect topic outputs.
sub-skills/analysis-visualization/ — inspect fitted models with topic tables, hierarchies, distributions, and plots.
sub-skills/serialization/ — save, reload, and share fitted models locally or through the Hugging Face Hub.
When a task spans more than one route, start with the earliest route in the pipeline and move forward: embeddings → model building → topic-word tuning → labels → analysis → serialization.
Read next
references/workflows.md for the fastest route through common BERTopic tasks.
references/troubleshooting.md when imports, optional dependencies, plotting, or save/load fail.
references/repo-provenance.md before deciding whether this skill matches the current checkout.
1---2name: bertopic3description: "Route BERTopic topic modeling, embedding, vectorizer, labeling,4 visualization, and serialization workflows."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/bertopic8 disco-role: operating9license: MIT10---1112# BERTopic1314BERTopic turns documents, precomputed embeddings, or multimodal inputs into topic models you can fit, inspect, label, visualize, and save.1516## Install1718```bash19python -m pip install bertopic20```2122Use only the optional packages that the chosen workflow needs. For example, multimodal image workflows use `bertopic[vision]`, while label and backend workflows may require `openai`, `litellm`, `langchain`, `llama-cpp-python`, `spacy`, `fastembed`, `model2vec`, `gensim`, `flair`, `safetensors`, or `datamapplot`.2324If you are working from a local checkout to inspect the package, editable install is also fine:2526```bash27python -m pip install -e .28```2930## Quick check3132Run the bundled environment check first:3334```bash35python scripts/check_env.py36```3738Add `--smoke` for a tiny no-download fit/load-style smoke that uses synthetic documents and precomputed embeddings.3940## Route map4142- `sub-skills/topic-modeling/` — build BERTopic models, fit and transform data, run `partial_fit`, mutate topics, and combine or reduce fitted models.43- `sub-skills/embeddings-backends/` — choose embedding backends, build custom embedders, inventory optional backend imports, and handle precomputed or multimodal embeddings.44- `sub-skills/vectorizers-ctfidf/` — tune `ClassTfidfTransformer`, `CountVectorizer`, and `OnlineCountVectorizer` for better topic words.45- `sub-skills/representations-labeling/` — rerank keywords, generate labels, chain representation models, and manage multi-aspect topic outputs.46- `sub-skills/analysis-visualization/` — inspect fitted models with topic tables, hierarchies, distributions, and plots.47- `sub-skills/serialization/` — save, reload, and share fitted models locally or through the Hugging Face Hub.4849When a task spans more than one route, start with the earliest route in the pipeline and move forward: embeddings → model building → topic-word tuning → labels → analysis → serialization.5051## Read next5253- `references/workflows.md` for the fastest route through common BERTopic tasks.54- `references/troubleshooting.md` when imports, optional dependencies, plotting, or save/load fail.55- `references/repo-provenance.md` before deciding whether this skill matches the current checkout.