Sentence Similarity
sentence-transformers
Safetensors
English
qwen3
feature-extraction
retrieval
matryoshka
text-embeddings-inference
Run this model with HF Jobs
Run Louvain/embed-4b-erb on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Louvain/embed-4b-erb. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Louvain/embed-4b-erb on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Louvain/embed-4b-erb with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Louvain/embed-4b-erb with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Louvain/embed-4b-erb") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Download training/evaluate.py from Louvain/embed-4b-erb: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/Louvain/embed-4b-erb/resolve/main/training/evaluate.py
- Command line
-
hf download hf://Louvain/embed-4b-erb/training/evaluate.py
-
curl -L -o evaluate.py https://huggingface.co/Louvain/embed-4b-erb/resolve/main/training/evaluate.py
1.88 kB
| """ | |
| STEP 5 — SCORE A FINE-TUNED MODEL WITH THE SAME HARNESS AS THE MODEL TABLE. Loads the embedder harness | |
| (an evaluation harness that is not part of this release) unchanged and registers the fine-tuned model under the base's own | |
| pooling and query prompt (`self-tune.json`), then runs it exactly as any row of that table: the same pool, the same | |
| chunker and header, gold@1/5/10/18, semantic against the others. | |
| python evaluate.py --harness <evaluation harness> --model models/qwen3-0.6b-st \\ | |
| --pool pool-hard.json --out result.json [--name qwen3-0.6b-st] | |
| """ | |
| import argparse | |
| import importlib.util | |
| import json | |
| import os | |
| import sys | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--harness", required=True) | |
| ap.add_argument("--model", required=True, help="a directory train.py wrote") | |
| ap.add_argument("--name", default="") | |
| a, rest = ap.parse_known_args() | |
| meta = json.load(open(os.path.join(a.model, "self-tune.json"))) | |
| name = a.name or os.path.basename(os.path.normpath(a.model)) | |
| spec = importlib.util.spec_from_file_location("embed_pool_probe", a.harness) | |
| probe = importlib.util.module_from_spec(spec) | |
| spec.loader.exec_module(probe) | |
| entry = (os.path.abspath(a.model), meta["pooling"], meta["prefix"]) | |
| # A newer harness also declares a document prefix per model; the self-tuned models take none, as their bases do. | |
| width = len(next(iter(probe.MODELS.values()))) | |
| probe.MODELS[name] = entry + ("",) * (width - len(entry)) | |
| # The harness treats a Qwen-family model's precision by its name; a fine-tuned Qwen keeps that behaviour. | |
| if meta["pooling"] == "last" and not name.startswith("qwen3"): | |
| probe.MODELS[f"qwen3-{name}"] = probe.MODELS.pop(name) | |
| name = f"qwen3-{name}" | |
| sys.argv = [a.harness, "--model", name, *rest] | |
| probe.main() | |
| if __name__ == "__main__": | |
| main() | |