AGENT SKILL

text2vec

Operate text2vec for text embeddings, similarity search, model fine-tuning, evaluation, and serving without reopening the source repository.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
text2vec
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Operate text2vec for text embeddings, similarity search, model fine-tuning, evaluation, and serving without reopening the source repository.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

text2vec

Use this repo skill when a task involves the text2vec Python package, Chinese or multilingual sentence embeddings, text similarity, BM25 fallback retrieval, CoSENT/Sentence-BERT/BGE fine-tuning, or text2vec service templates.

First checks

  1. Install a compatible PyTorch build before expecting public model APIs to import.
  2. Install text2vec and run a no-download import check:
python -c "from text2vec import SentenceModel, Similarity, BM25; print('text2vec ok')"
text2vec -h
  1. For a safer environment probe, run the bundled helper from this skill:
python scripts/check_text2vec_env.py

Read references/installation.md for optional dependency and backend decisions. Read references/troubleshooting.md for cross-cutting install, model download, CUDA, data, CLI, and service failures.

Route by task

User task Read
Generate sentence embeddings, use SentenceModel, run the text2vec CLI, choose EncoderType, preserve batch output rows, use Word2Vec, or understand NGram caveats sub-skills/embeddings/SKILL.md
Score sentence pairs, use Similarity, call cos_sim / semantic_search, run dense top-k retrieval, or use BM25 as a no-network lexical fallback sub-skills/similarity-search/SKILL.md
Validate fine-tuning data, construct CoSENT/Sentence-BERT/BERT-match/BGE training commands, understand train_model parameters, or handle multi-GPU/bf16 training boundaries sub-skills/training-finetuning/SKILL.md
Choose among released models, interpret Spearman/QPS tables, summarize local score files, or plan MTEB/C-MTEB-style evaluation without running large downloads by default sub-skills/evaluation-benchmarks/SKILL.md
Build a FastAPI endpoint, compare FastAPI/Jina/Gradio service patterns, or avoid blocking forever-server verification sub-skills/serving-deployment/SKILL.md

Package surface at a glance

  • Main import: import text2vec.
  • Important inference APIs: SentenceModel, SBert, EncoderType, Word2Vec, BM25, Similarity, SimilarityType, EmbeddingType, cos_sim, semantic_search.
  • Training APIs: CosentModel, SentenceBertModel, BertMatchModel, BgeModel, plus text-matching and BGE dataset loaders.
  • CLI entry point: text2vec, with required --input_file and optional --output_file, --model_type, --model_name, --encoder_type, --batch_size, --max_seq_length, --chunk_size, --device, --show_progress_bar, --normalize_embeddings, and --multi_gpu.
  • Default neural model names usually require Hugging Face access unless cached. Prefer a local HF-compatible model directory for offline smoke tests.
  • Word2Vec requires gensim and either a local vector file or the built-in Tencent lightweight vector download.

Bundled root files

Operating rules

  • Do not run default model downloads, full training, benchmarks, JinaHub fetches, Gradio launches, or long-lived servers unless the user explicitly approves network/runtime side effects.
  • Do not use synthetic CPU smoke checks as proof of CUDA, bf16, multi-GPU, or production-scale training coverage.
  • Prefer bundled validators and helpers before expensive commands: data validation before training, no-network BM25 before dense retrieval when embeddings are absent, and local model directories before default downloads.
  • For stale-source decisions, compare the current checkout against references/repo-provenance.md and refresh if APIs, docs, examples, tests, or package metadata changed.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351