Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

benjamintli
/
modernbert-cosqa

Sentence Similarity
sentence-transformers
Safetensors
modernbert
feature-extraction
dense
Generated from Trainer
dataset_size:8118
loss:CachedMultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Model card Files Files and versions
xet
Community

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
modernbert-cosqa
600 MB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 29 commits
benjamintli's picture
benjamintli
End of training
8d7c40a verified 2 months ago
  • 1_Pooling
    End of training 2 months ago
  • eval
    Training in progress, epoch 10 2 months ago
  • .gitattributes
    1.52 kB
    initial commit 2 months ago
  • README.md
    26.8 kB
    End of training 2 months ago
  • config.json
    1.9 kB
    Training in progress, epoch 1 2 months ago
  • config_sentence_transformers.json
    283 Bytes
    End of training 2 months ago
  • model.safetensors
    596 MB
    xet
    Training in progress, epoch 10 2 months ago
  • modules.json
    229 Bytes
    End of training 2 months ago
  • sentence_bert_config.json
    57 Bytes
    End of training 2 months ago
  • tokenizer.json
    3.58 MB
    Training in progress, epoch 1 2 months ago
  • tokenizer_config.json
    541 Bytes
    Training in progress, epoch 1 2 months ago
  • training_args.bin
    5.59 kB
    xet
    Training in progress, epoch 1 2 months ago