Sentence Similarity
sentence-transformers
Safetensors
modernbert
feature-extraction
dense
Generated from Trainer
dataset_size:8118
loss:CachedMultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use benjamintli/modernbert-cosqa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use benjamintli/modernbert-cosqa with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("benjamintli/modernbert-cosqa") sentences = [ "python create path if doesnt exist", "def clean_whitespace(string, compact=False):\n \"\"\"Return string with compressed whitespace.\"\"\"\n for a, b in (('\\r\\n', '\\n'), ('\\r', '\\n'), ('\\n\\n', '\\n'),\n ('\\t', ' '), (' ', ' ')):\n string = string.replace(a, b)\n if compact:\n for a, b in (('\\n', ' '), ('[ ', '['),\n (' ', ' '), (' ', ' '), (' ', ' ')):\n string = string.replace(a, b)\n return string.strip()", "def rotateImage(img, angle):\n \"\"\"\n\n querries scipy.ndimage.rotate routine\n :param img: image to be rotated\n :param angle: angle to be rotated (radian)\n :return: rotated image\n \"\"\"\n imgR = scipy.ndimage.rotate(img, angle, reshape=False)\n return imgR", "def check_create_folder(filename):\n \"\"\"Check if the folder exisits. If not, create the folder\"\"\"\n os.makedirs(os.path.dirname(filename), exist_ok=True)" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Download 1_Pooling/config.json from benjamintli/modernbert-cosqa: direct link, hf CLI and curl.
- Browser
- Download file 312 Bytes
-
https://huggingface.co/benjamintli/modernbert-cosqa/resolve/main/1_Pooling/config.json
- Command line
-
hf download hf://benjamintli/modernbert-cosqa/1_Pooling/config.json
-
curl -L -o config.json https://huggingface.co/benjamintli/modernbert-cosqa/resolve/main/1_Pooling/config.json
312 Bytes
| { | |
| "word_embedding_dimension": 768, | |
| "pooling_mode_cls_token": false, | |
| "pooling_mode_mean_tokens": true, | |
| "pooling_mode_max_tokens": false, | |
| "pooling_mode_mean_sqrt_len_tokens": false, | |
| "pooling_mode_weightedmean_tokens": false, | |
| "pooling_mode_lasttoken": false, | |
| "include_prompt": true | |
| } |