sentence-transformers How to use davanstrien/code-prompt-similarity-model with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("davanstrien/code-prompt-similarity-model")
sentences = [
"Write a Python function that counts the number of even numbers in a given list of integers or floats",
"Write a Python function that returns the number of even numbers in a list.",
"Create a Python function that adds up all the numbers in a given list. The function should support lists containing only positive integers.",
"Write a Python function that converts a JSON string into a Python dictionary using the json module and returns it."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]