Sign in
Explore
Skills · SkillData & AIMachine learningLLM apps & RAGReviewedMakes network calls

train-sentence-transformers

Trains and fine-tunes sentence-transformers models: bi-encoder embeddings, CrossEncoder rerankers and SparseEncoder models.

Kind
Skill
Works with
Claude Code
Source
Hugging Face Skills @ 25910b3d0ba3
Path
skills/train-sentence-transformers/SKILL.md
Jobs
Implementation
Topics
Machine learning, LLM apps & RAG

Credit

Made by
huggingface
Original
github.com/huggingface/skills/blob/25910b3d0ba31a2ba102f901cd…
License
Apache-2.0

Listed by Skill Manifest; not made by us.

InstallInstall it by hand, following the source.
hf skills add train-sentence-transformers
Install factsScanned 3 Nov 2026
Adds
  • .claude/skills/train-sentence-transformers/ (the skill folder)
  • 27 file(s) the skill refers to
  • 30 other files in the folder: references/base_model_selection.md, references/dataset_formats.md, references/evaluators_cross_encoder.md, references/evaluators_multi_vector_encoder.md and 26 more
Runs scripts
Yes
  • scripts/mine_hard_negatives.py
  • scripts/train_cross_encoder_distillation_example.py
  • scripts/train_cross_encoder_example.py
  • scripts/train_cross_encoder_listwise_example.py
Uses the network
Yes
  • downloads Python packages
  • downloads Python packages (references/hf_jobs_execution.md)
  • HTTP client calls (scripts/mine_hard_negatives.py)
  • downloads Python packages (scripts/train_cross_encoder_distillation_example.py)
Needs secrets
Yes
  • HF_TOKEN
  • WANDB_API_KEY
  • MLFLOW_TRACKING_TOKEN
Reads environment variables
  • HF_TOKEN
  • WANDB_API_KEY
  • MLFLOW_TRACKING_TOKEN
  • SMOKE_TEST
Reads outside the project
  • ~/.cache/huggingface/datasets (references/hf_jobs_execution.md)
  • /usr/bin/env (scripts/mine_hard_negatives.py)
Calls other skills
  • /data
  • /trackio
  • /final
Value without its scripts
High
  • The main file never tells the agent to run a bundled script, so the text works without them.
  • scripts/mine_hard_negatives.py: Mine hard negatives as a pre-training step for contrastive losses.
  • scripts/train_cross_encoder_distillation_example.py: CrossEncoder distillation: train a small reranker from a stronger one's scores.
  • scripts/train_cross_encoder_example.py: Production-ready cross-encoder (reranker) training template.
  • scripts/train_cross_encoder_listwise_example.py: CrossEncoder listwise training with LambdaLoss.
What it does
  • Needs a paid account or key
Source revision
25910b3d0ba3
Licence
Apache-2.0
Last activity
26 Nov 2026
Source changed after the scan
Yes
  • Last push 26 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

# Train a sentence-transformers Model

**This SKILL.md is a router, not a manual.** It tells you which references and example scripts to load for your task. The actual content (recommended losses, evaluators, training-script structure, model selection, training-arg knobs, troubleshooting) lives in `references/` and `scripts/`.

**Do not synthesize a training script from this file alone.** Open the per-type production template (`scripts/train_<type>_example.py`) and copy it as your starting point. The templates contain load-bearing scaffolding (autocast helper, model-card class, logger silencing list, `force=True`, `seed`, TF32, version-compatible imports, named-evaluator metric handling) that prior agent runs have repeatedly missed when rolling their own from a synthesized snippet.

## 1. Identify the model type

| Tag | Class | What it does | When to pick |
|---|---|---|---|
| **[SentenceTransformer]** | `SentenceTransformer` (bi-encoder) | Maps each input to a fixed-dim dense vector | Retrieval, similarity, clustering, classification, paraphrase mining, dedup |
…