Text Classification
Transformers
Safetensors
roberta
codebert
vulnerability-detection
php
javascript
detecode
text-embeddings-inference
Instructions to use dunguasli/detecode-model-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dunguasli/detecode-model-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="dunguasli/detecode-model-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("dunguasli/detecode-model-v1") model = AutoModelForSequenceClassification.from_pretrained("dunguasli/detecode-model-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload detecode model v1
Browse files- README.md +32 -1
- config.json +58 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +17 -0
- training_args.bin +3 -0
README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
| 1 |
-
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- codebert
|
| 6 |
+
- vulnerability-detection
|
| 7 |
+
- php
|
| 8 |
+
- javascript
|
| 9 |
+
- detecode
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# DeteCode Model v1
|
| 13 |
+
|
| 14 |
+
Fine-tuned CodeBERT checkpoint for the optional AI engine in [DeteCode](https://github.com/rizkidsaputra/detecode).
|
| 15 |
+
|
| 16 |
+
This model is experimental and should be used as an assistive semantic layer, not as the only source of truth. DeteCode's local rules and taint analysis are recommended for stable CLI scanning.
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
|
| 20 |
+
Download or clone this repository into:
|
| 21 |
+
|
| 22 |
+
```text
|
| 23 |
+
models/codebert-webvuln
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Then run:
|
| 27 |
+
|
| 28 |
+
```powershell
|
| 29 |
+
python -m detecode scan .\tests\samples --engine hybrid --model-path .\models\codebert-webvuln --format table
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## Training Data
|
| 33 |
+
|
| 34 |
+
The model was fine-tuned using the DeteCode training script with PHP/JavaScript vulnerability data, primarily CrossVul (`hitoshura25/crossvul`).
|
config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"RobertaForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"hidden_dropout_prob": 0.1,
|
| 13 |
+
"hidden_size": 768,
|
| 14 |
+
"id2label": {
|
| 15 |
+
"0": "safe",
|
| 16 |
+
"1": "CWE-200",
|
| 17 |
+
"2": "CWE-22",
|
| 18 |
+
"3": "CWE-352",
|
| 19 |
+
"4": "CWE-434",
|
| 20 |
+
"5": "CWE-502",
|
| 21 |
+
"6": "CWE-78",
|
| 22 |
+
"7": "CWE-79",
|
| 23 |
+
"8": "CWE-89",
|
| 24 |
+
"9": "CWE-918",
|
| 25 |
+
"10": "CWE-94",
|
| 26 |
+
"11": "CWE-98"
|
| 27 |
+
},
|
| 28 |
+
"initializer_range": 0.02,
|
| 29 |
+
"intermediate_size": 3072,
|
| 30 |
+
"is_decoder": false,
|
| 31 |
+
"label2id": {
|
| 32 |
+
"CWE-200": 1,
|
| 33 |
+
"CWE-22": 2,
|
| 34 |
+
"CWE-352": 3,
|
| 35 |
+
"CWE-434": 4,
|
| 36 |
+
"CWE-502": 5,
|
| 37 |
+
"CWE-78": 6,
|
| 38 |
+
"CWE-79": 7,
|
| 39 |
+
"CWE-89": 8,
|
| 40 |
+
"CWE-918": 9,
|
| 41 |
+
"CWE-94": 10,
|
| 42 |
+
"CWE-98": 11,
|
| 43 |
+
"safe": 0
|
| 44 |
+
},
|
| 45 |
+
"layer_norm_eps": 1e-05,
|
| 46 |
+
"max_position_embeddings": 514,
|
| 47 |
+
"model_type": "roberta",
|
| 48 |
+
"num_attention_heads": 12,
|
| 49 |
+
"num_hidden_layers": 12,
|
| 50 |
+
"output_past": true,
|
| 51 |
+
"pad_token_id": 1,
|
| 52 |
+
"problem_type": "single_label_classification",
|
| 53 |
+
"tie_word_embeddings": true,
|
| 54 |
+
"transformers_version": "5.9.0",
|
| 55 |
+
"type_vocab_size": 1,
|
| 56 |
+
"use_cache": false,
|
| 57 |
+
"vocab_size": 50265
|
| 58 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:064f2a5b2599baf25b1e0da0f61bb2697bb817a86eefcf4cdc6da73e1e50e2ee
|
| 3 |
+
size 498643584
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"cls_token": "<s>",
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"is_local": false,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"mask_token": "<mask>",
|
| 11 |
+
"model_max_length": 512,
|
| 12 |
+
"pad_token": "<pad>",
|
| 13 |
+
"sep_token": "</s>",
|
| 14 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 15 |
+
"trim_offsets": true,
|
| 16 |
+
"unk_token": "<unk>"
|
| 17 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d29f62b2668fb205e8ad29350c893addf69b6eeb3733f1bccbf2cc42687e7b34
|
| 3 |
+
size 5265
|