Text Classification
Transformers
Safetensors
modernbert
Generated from Trainer
text-embeddings-inference
Instructions to use P0u4a/ModernBERT-bash-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use P0u4a/ModernBERT-bash-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="P0u4a/ModernBERT-bash-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("P0u4a/ModernBERT-bash-classifier") model = AutoModelForSequenceClassification.from_pretrained("P0u4a/ModernBERT-bash-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,9 +14,6 @@ model-index:
|
|
| 14 |
results: []
|
| 15 |
---
|
| 16 |
|
| 17 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 18 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 19 |
-
|
| 20 |
# ModernBERT-bash-classifier
|
| 21 |
|
| 22 |
This model is a fine-tuned version of [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) on an unknown dataset.
|
|
@@ -29,18 +26,38 @@ It achieves the following results on the evaluation set:
|
|
| 29 |
|
| 30 |
## Model description
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Intended uses & limitations
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
|
| 38 |
## Training and evaluation data
|
| 39 |
|
| 40 |
-
|
|
|
|
| 41 |
|
| 42 |
## Training procedure
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
### Training hyperparameters
|
| 45 |
|
| 46 |
The following hyperparameters were used during training:
|
|
|
|
| 14 |
results: []
|
| 15 |
---
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# ModernBERT-bash-classifier
|
| 18 |
|
| 19 |
This model is a fine-tuned version of [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) on an unknown dataset.
|
|
|
|
| 26 |
|
| 27 |
## Model description
|
| 28 |
|
| 29 |
+
Bash command classification model, for classifying a bash command as either safe or unsafe based on what it does.
|
| 30 |
+
|
| 31 |
+
We classify a bash command as unsafe based on the following criteria:
|
| 32 |
+
|
| 33 |
+
- Downloads data from the internet[^1]
|
| 34 |
+
- Sends data from the machine over the network[^1]
|
| 35 |
+
- Permanently modifies files outside the current project directory[^2]
|
| 36 |
+
- Deletes files outside the current project directory[^2]
|
| 37 |
+
- Modifies cloud resources (via CLIs like `az` or `tf`)
|
| 38 |
+
- Creates persistent, resource consuming processes on the machine like cron jobs
|
| 39 |
+
|
| 40 |
+
[^1]: Git commands are an exception to this rule.
|
| 41 |
+
|
| 42 |
+
[^2]: We treat files within the current project directory as safe, since an agent working in a project is expected to mutate its contents.
|
| 43 |
|
| 44 |
## Intended uses & limitations
|
| 45 |
|
| 46 |
+
Created to be used as a auto-mode classifier for coding agent harnesses, so users only manually approve bash commands flagged as unsafe.
|
| 47 |
+
|
| 48 |
+
The model may not generalize well to bash commands incorporating unknown CLIs or commands that use raw code blocks like Python within heredocs.
|
| 49 |
|
| 50 |
## Training and evaluation data
|
| 51 |
|
| 52 |
+
Fine-tuned on bash tool calls collected from Claude Code and Codex traces. Any PII in the commands such as directory names
|
| 53 |
+
were anonymised. The total dataset consists of 3,738 bash calls.
|
| 54 |
|
| 55 |
## Training procedure
|
| 56 |
|
| 57 |
+
Fine-tuned on bash commands formatted as `CWD: [CWD]\nCOMMAND: [COMMAND]`.
|
| 58 |
+
|
| 59 |
+
Used weighted cross-entropy loss to penalise misclassifications of unsafe bash commands. This alleviates the imbalanced dataset.
|
| 60 |
+
|
| 61 |
### Training hyperparameters
|
| 62 |
|
| 63 |
The following hyperparameters were used during training:
|