Team Ai
Modelpublic

melfatihomran/codet5-small-code-comment-gen

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes22downloads
Model Card

CodeT5-Small — Code Comment Generator

Fine-tuned `Salesforce/codet5-small` on a filtered subset of CodeSearchNet to generate natural-language comments and docstrings from source code.

Usage

python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("melfatihomran/codet5-small-code-comment-gen")
model: [melfatihomran/codet5-small-code-comment-gen](https://huggingface.co/melfatihomran/codet5-small-code-comment-gen)
code = "def add(a, b):\n    return a + b"
inputs = tokenizer(code, return_tensors="pt")
output = model.generate(**inputs, max_length=64, num_beams=4)
print(tokenizer.decode(output[0], skip_special_tokens=True))

Training

ParameterValue
Base modelSalesforce/codet5-small
Datasetsentence-transformers/codesearchnet (pair)
Train / Val / Test8,000 / 1,000 / 1,000
Epochs5
Learning rate5e-5
Batch size8
Precisionfp16 (GPU)

Results

MetricScore
BLEU19.65
ROUGE-141.11
ROUGE-223.41
ROUGE-L38.83
Exact Match5.60%