How to use from the
Use from the
sentence-transformers library
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("kiel2/Kiel-2-Matrix")

sentences = [
    "But Close wondered whether the package would be worth the cost of licensing the third-party software , along with Salesforce.com 's rental price .",
    "Close also questions whether it would be worth the cost of licensing third-party software , along with Salesforce.com 's rental price .",
    "No tumors were detected ; rather , empty cavities and scar tissue were found in their place .",
    "A race observer sits in the passenger seat of the follow vehicle to record any broken rules and also keep track of the car 's time ."
]
embeddings = model.encode(sentences)

similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]

Kiel-2-Matrix

Kiel-2-Matrix is a specialized dense embedding model based on microsoft/codebert-base for code and text representation.

This is a sentence-transformers model that maps sentences and code blocks into a 768-dimensional dense vector space optimized for semantic textual similarity, semantic search, and clustering tasks.


Model Details

Model Description

  • Model Type: Sentence Transformer / Dense Embedding Backbone
  • Base Model: microsoft/codebert-base
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text & Code

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'RobertaModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)
Direct Usage (Sentence Transformers)
First, install the Sentence Transformers library:

Bash
pip install -U sentence-transformers
Then load your model and run inference:

Python
from sentence_transformers import SentenceTransformer

# Load your model from the Hugging Face Hub
model = SentenceTransformer("kiel2/Kiel-2-Matrix")

# Run inference
sentences = [
    '" Any decision on Charleroi will have huge implications for regional airports in France , " he said .',
    '" A bad decision on Charleroi would have huge implications for state-owned regional airports in France .',
    "He said the ferry 's crew will be interviewed and tested for drugs and alcohol .",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
Citation
Code snippet
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "[https://arxiv.org/abs/1908.10084](https://arxiv.org/abs/1908.10084)",
}
Downloads last month
58
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kiel2/Kiel-2-Matrix

Finetuned
(149)
this model

Paper for kiel2/Kiel-2-Matrix