BERT4code
Collection
This collection features BERT and RoBERTa-based models fine-tuned for multi-label code classification, designed to accurately tag and categorize code โข 3 items โข Updated
Run Mallard74/codebert-xcode-tags-classification on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/Mallard74/codebert-xcode-tags-classification. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/Mallard74/codebert-xcode-tags-classification on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use Mallard74/codebert-xcode-tags-classification with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Mallard74/codebert-xcode-tags-classification") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Mallard74/codebert-xcode-tags-classification")
model = AutoModelForSequenceClassification.from_pretrained("Mallard74/codebert-xcode-tags-classification", device_map="auto")# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Mallard74/codebert-xcode-tags-classification")# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Mallard74/codebert-xcode-tags-classification")
model = AutoModelForSequenceClassification.from_pretrained("Mallard74/codebert-xcode-tags-classification", device_map="auto")This model is a fine-tuned version of microsoft/codebert-base on the xCodeEval dataset, more precisely on the multi-tag classification task.. It achieves the following results on the evaluation set:
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | F1 Macro | F1 Micro | Roc Auc | Accuracy | Hamming Loss |
|---|---|---|---|---|---|---|---|---|
| No log | 1.0 | 287 | 0.3148 | 0.1532 | 0.4274 | 0.8593 | 0.2510 | 0.1314 |
| 0.3402 | 2.0 | 574 | 0.2830 | 0.3484 | 0.5897 | 0.8873 | 0.3765 | 0.1132 |
| 0.3402 | 3.0 | 861 | 0.2756 | 0.3907 | 0.6159 | 0.8944 | 0.4118 | 0.1088 |
Base model
microsoft/codebert-base
# Gated model: Login with a HF token with gated access permission hf auth login