Text Classification
Transformers
PyTorch
JAX
Safetensors
roberta
Text Classification
Transformers
PyTorch
JAX
MSR
English
Inference Endpoints
text-embeddings-inference
Instructions to use starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR") model = AutoModelForSequenceClassification.from_pretrained("starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR")
model = AutoModelForSequenceClassification.from_pretrained("starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR")Quick Links
I finetuned a RobertaForSequenceClassification model which is initialized from CodeBert [https://huggingface.co/microsoft/codebert-base] to judge whether a code is vulnerable or not. I selected balanced samples from MSR dataset [https://github.com/ZeoVan/MSR_20_Code_vulnerability_CSV_Dataset] for training, validation, and testing. The "func_before" is used for code classification. All the data is in the file "msr.csv".
Test Reulsts: acc 0.7022935779816514, f1 0.6482384823848238, precision 0.7920529801324503, recall 0.5486238532110091
- Downloads last month
- 10
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="starmage520/Coderbert_finetuned_detect_vulnerability_on_MSR")