mrm8488 / codebert-base-finetuned-detect-insecure-code

huggingface.co
Total runs: 923
24-hour runs: 0
7-day runs: -1.2K
30-day runs: -1.1K
Model's Last Updated: May 21 2021
text-classification

Introduction of codebert-base-finetuned-detect-insecure-code

Model Details of codebert-base-finetuned-detect-insecure-code

CodeBERT fine-tuned for Insecure Code Detection 💾⛔

codebert-base fine-tuned on CodeXGLUE -- Defect Detection dataset for Insecure Code Detection downstream task.

Details of CodeBERT

We present CodeBERT, a bimodal pre-trained model for programming language (PL) and nat-ural language (NL). CodeBERT learns general-purpose representations that support downstream NL-PL applications such as natural language codesearch, code documentation generation, etc. We develop CodeBERT with Transformer-based neural architecture, and train it with a hybrid objective function that incorporates the pre-training task of replaced token detection, which is to detect plausible alternatives sampled from generators. This enables us to utilize both bimodal data of NL-PL pairs and unimodal data, where the former provides input tokens for model training while the latter helps to learn better generators. We evaluate CodeBERT on two NL-PL applications by fine-tuning model parameters. Results show that CodeBERT achieves state-of-the-art performance on both natural language code search and code documentation generation tasks. Furthermore, to investigate what type of knowledge is learned in CodeBERT, we construct a dataset for NL-PL probing, and evaluate in a zero-shot setting where parameters of pre-trained models are fixed. Results show that CodeBERT performs better than previous pre-trained models on NL-PL probing.

Details of the downstream task (code classification) - Dataset 📚

Given a source code, the task is to identify whether it is an insecure code that may attack software systems, such as resource leaks, use-after-free vulnerabilities and DoS attack. We treat the task as binary classification (0/1), where 1 stands for insecure code and 0 for secure code.

The dataset used comes from the paper Devign : Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networks . All projects are combined and splitted 80%/10%/10% for training/dev/test.

Data statistics of the dataset are shown in the below table:

#Examples
Train 21,854
Dev 2,732
Test 2,732
Test set metrics 🧾
Methods ACC
BiLSTM 59.37
TextCNN 60.69
RoBERTa 61.05
CodeBERT 62.08
Ours 65.30
Model in Action 🚀
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import numpy as np
tokenizer = AutoTokenizer.from_pretrained('mrm8488/codebert-base-finetuned-detect-insecure-code')
model = AutoModelForSequenceClassification.from_pretrained('mrm8488/codebert-base-finetuned-detect-insecure-code')

inputs = tokenizer("your code here", return_tensors="pt", truncation=True, padding='max_length')
labels = torch.tensor([1]).unsqueeze(0)  # Batch size 1
outputs = model(**inputs, labels=labels)
loss = outputs.loss
logits = outputs.logits

print(np.argmax(logits.detach().numpy()))

Created by Manuel Romero/@mrm8488 | LinkedIn

Made with in Spain

Runs of mrm8488 codebert-base-finetuned-detect-insecure-code on huggingface.co

923
Total runs
0
24-hour runs
-8
3-day runs
-1.2K
7-day runs
-1.1K
30-day runs

More Information About codebert-base-finetuned-detect-insecure-code huggingface.co Model

codebert-base-finetuned-detect-insecure-code huggingface.co

codebert-base-finetuned-detect-insecure-code huggingface.co is an AI model on huggingface.co that provides codebert-base-finetuned-detect-insecure-code's model effect (), which can be used instantly with this mrm8488 codebert-base-finetuned-detect-insecure-code model. huggingface.co supports a free trial of the codebert-base-finetuned-detect-insecure-code model, and also provides paid use of the codebert-base-finetuned-detect-insecure-code. Support call codebert-base-finetuned-detect-insecure-code model through api, including Node.js, Python, http.

codebert-base-finetuned-detect-insecure-code huggingface.co Url

https://huggingface.co/mrm8488/codebert-base-finetuned-detect-insecure-code

mrm8488 codebert-base-finetuned-detect-insecure-code online free

codebert-base-finetuned-detect-insecure-code huggingface.co is an online trial and call api platform, which integrates codebert-base-finetuned-detect-insecure-code's modeling effects, including api services, and provides a free online trial of codebert-base-finetuned-detect-insecure-code, you can try codebert-base-finetuned-detect-insecure-code online for free by clicking the link below.

mrm8488 codebert-base-finetuned-detect-insecure-code online free url in huggingface.co:

https://huggingface.co/mrm8488/codebert-base-finetuned-detect-insecure-code

codebert-base-finetuned-detect-insecure-code install

codebert-base-finetuned-detect-insecure-code is an open source model from GitHub that offers a free installation service, and any user can find codebert-base-finetuned-detect-insecure-code on GitHub to install. At the same time, huggingface.co provides the effect of codebert-base-finetuned-detect-insecure-code install, users can directly use codebert-base-finetuned-detect-insecure-code installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

codebert-base-finetuned-detect-insecure-code install url in huggingface.co:

https://huggingface.co/mrm8488/codebert-base-finetuned-detect-insecure-code

Url of codebert-base-finetuned-detect-insecure-code

codebert-base-finetuned-detect-insecure-code huggingface.co Url

Provider of codebert-base-finetuned-detect-insecure-code huggingface.co

mrm8488
ORGANIZATIONS

Other API from mrm8488

huggingface.co

Total runs: 855
Run Growth: 264
Growth Rate: 30.88%
Updated:February 23 2024
huggingface.co

Total runs: 213
Run Growth: 64
Growth Rate: 31.68%
Updated:March 19 2023
huggingface.co

Total runs: 72
Run Growth: 32
Growth Rate: 44.44%
Updated:January 24 2024
huggingface.co

Total runs: 60
Run Growth: 46
Growth Rate: 82.14%
Updated:June 20 2023