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-code-v2

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

Instructions to use benjamintli/modernbert-code-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • sentence-transformers

    How to use benjamintli/modernbert-code-v2 with sentence-transformers:

    from sentence_transformers import SentenceTransformer
    
    model = SentenceTransformer("benjamintli/modernbert-code-v2")
    
    sentences = [
        "// Uint is a helper routine that allocates a new uint value to store v and\n// returns a pointer to it.  This is useful when assigning optional parameters.",
        "func (c *Animation) GetCurrentTimeWithParams(v *AnimationGetCurrentTimeParams) (float64, error) {\n\tresp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Animation.getCurrentTime\", Params: v})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar chromeData struct {\n\t\tResult struct {\n\t\t\tCurrentTime float64\n\t\t}\n\t}\n\n\tif resp == nil {\n\t\treturn 0, &gcdmessage.ChromeEmptyResponseErr{}\n\t}\n\n\t// test if error first\n\tcerr := &gcdmessage.ChromeErrorResponse{}\n\tjson.Unmarshal(resp.Data, cerr)\n\tif cerr != nil && cerr.Error != nil {\n\t\treturn 0, &gcdmessage.ChromeRequestErr{Resp: cerr}\n\t}\n\n\tif err := json.Unmarshal(resp.Data, &chromeData); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn chromeData.Result.CurrentTime, nil\n}",
        "func Uint(v uint) *uint {\n\tp := new(uint)\n\t*p = v\n\treturn p\n}",
        "def after_init_app(self, app: FlaskUnchained):\n        \"\"\"\n        Configure the JSON encoder for Flask to be able to serialize Enums,\n        LocalProxy objects, and SQLAlchemy models.\n        \"\"\"\n        self.set_json_encoder(app)\n        app.before_first_request(self.register_model_resources)"
    ]
    embeddings = model.encode(sentences)
    
    similarities = model.similarity(embeddings, embeddings)
    print(similarities.shape)
    # [4, 4]
  • Notebooks
  • Google Colab
  • Kaggle
modernbert-code-v2 / eval
3.9 kB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 14 commits
benjamintli's picture
benjamintli
Training in progress, step 260
cd523c6 verified 2 months ago
  • Information-Retrieval_evaluation_eval_results.csv
    3.9 kB
    Training in progress, step 260 2 months ago