embeddings-backends
Select, adapt, and troubleshoot BERTopic embedding backends, precomputed embeddings, and multimodal image/text inputs.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- embeddings-backends
- license
- MIT
- metadata
- { "package": "BERTopic", "disco-role": "operating", "parent-skill": "bertopic", "package-version": "0.17.4" }
- description
- Select, adapt, and troubleshoot BERTopic embedding backends, precomputed embeddings, and multimodal image/text inputs.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md6.2 KB
- 参考文档references/troubleshooting.md3.9 KB
- 参考文档references/workflows.md4.2 KB
- 脚本scripts/inventory_backends.py11.5 KB
03 SKILL.md 正文
embeddings-backends
Use this sub-skill when the task is about BERTopic embedding selection or backend adaptation rather than topic representations or c-TF-IDF.
Route here for
embedding_model=choices,select_backend(...), and language-driven defaults.- Sentence Transformers, Hugging Face feature-extraction pipelines, Model2Vec, Flair, spaCy, USE, Gensim, scikit-learn pipelines, OpenAI, Cohere, FastEmbed, LangChain, and MultiModal wrappers.
BaseEmbeddersubclasses, custom embedding classes, document/word backend composition, and deterministic offline embedders.- Precomputed embeddings passed to
fit_transform(...),transform(...), or tiny synthetic smoke checks. - Multimodal text + image embeddings,
embed_images(...), and image/document alignment. - Optional dependency detection,
NotInstalledplaceholders, and safe backend inventory checks.
Route elsewhere
- Topic labels, KeyBERT-inspired/MMR/POS/LLM aspects, or
topic_aspects_: use the representations-labeling sub-skill. - c-TF-IDF, CountVectorizer tuning, online vocabulary updates, or
update_topics(...)term refreshes: use the vectorizers-ctfidf sub-skill. - Plotting, hierarchy analysis, topic distributions, or dashboards: use the analysis-visualization sub-skill.
- Save/load, format selection, or hub upload: use the serialization sub-skill.
Operating references
- Start with
references/api-reference.mdfor backend classes, selection rules, shape expectations, and optional-placeholder behavior. - Use
references/workflows.mdfor explicit backend-selection paths, offline precomputed embeddings, custom backend construction, multimodal setup, and inventory checks. - Use
references/troubleshooting.mdfor install/import failures, placeholder errors, invalid shapes, wrong wrapper types, and download-related gotchas. - Run
scripts/inventory_backends.pyto inventory available backends without downloads and to smoke-test a tiny deterministic local encoder.
Minimal decision flow
- If you already have embeddings or need a no-download path, keep
embedding_model=Noneand pass the matrix throughfit_transform(..., embeddings=...)ortransform(..., embeddings=...). - If you want BERTopic to choose a default backend, set
language=only when no explicit embedding model is being passed; otherwise provide the backend directly. - If you need one backend for documents and another for topic words, use
WordDocEmbedderor a customBaseEmbedder. - If the task includes images, use
MultiModalBackendor a custom backend that definesembed_images(...); keep image/document rows aligned. - If the backend selection must stay offline, avoid string model IDs because they can still trigger downloads.
- If you only need to know what is installed, use the bundled inventory script instead of probing by downloading models.
Verification anchors for future checks
- Deterministic local custom backend: a tiny function-backed encoder that always returns the same
(n, d)matrix for the same input. - Precomputed embedding smoke: a small document list with a hand-built dense embedding matrix and explicit topic labels, fitted with
embedding_model=Noneand no downloads. - Optional-backend inventory: a report that distinguishes present modules, missing extras, and
NotInstalledplaceholders without instantiating remote models.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).