NLBSE/nlbse25-code-comment-classification
Viewer • Updated • 13.2k • 205
How to use fabiancpl/nlbse25_python with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("fabiancpl/nlbse25_python")How to use fabiancpl/nlbse25_python with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("fabiancpl/nlbse25_python")
sentences = [
"The weather is lovely today.",
"It's so sunny outside!",
"He drove to the stadium."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]This is a SetFit model that can be used for Python code comment classification.
The model has been trained using few-shot learning that involves:
First, install the depencies:
pip install setfit scikit-learn
Then, load the model and run inferences:
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("fabiancpl/nlbse25_python")
# Run inference
preds = model("This function sorts a list of numbers.")
@inproceedings{11029440,
author={Peña, Fabian C. and Herbold, Steffen},
booktitle={2025 IEEE/ACM International Workshop on Natural Language-Based Software Engineering (NLBSE)},
title={Evaluating the Performance and Efficiency of Sentence-BERT for Code Comment Classification},
year={2025},
pages={21-24},
doi={10.1109/NLBSE66842.2025.00010}}
Base model
sentence-transformers/all-MiniLM-L6-v2