Spaces:
Running
Running
Pelumi Oluwategbe commited on
Commit ·
bd82d52
1
Parent(s): 70f6a4e
Updated the read me with demo commans, created a good first issue template, added demo commands examples, and sample report json format
Browse files- .github/ISSUE_TEMPLATE/good_first_issue.md +35 -0
- README.md +24 -0
- examples/demo_commands.md +28 -0
- examples/sample_report.json +12 -0
.github/ISSUE_TEMPLATE/good_first_issue.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Good first issue
|
| 3 |
+
about: A simple, well-defined task that’s perfect for someone new to the project.
|
| 4 |
+
title: "Good First Issue: [TASK]"
|
| 5 |
+
labels: "good first issue"
|
| 6 |
+
assignees: ""
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## Description
|
| 10 |
+
|
| 11 |
+
This is a simple task for first-time contributors! Please follow the steps below to implement the feature or fix the bug.
|
| 12 |
+
|
| 13 |
+
### Steps to reproduce
|
| 14 |
+
|
| 15 |
+
- Step 1
|
| 16 |
+
- Step 2
|
| 17 |
+
- Step 3
|
| 18 |
+
|
| 19 |
+
### Expected behavior
|
| 20 |
+
|
| 21 |
+
- What should happen after the task is completed
|
| 22 |
+
|
| 23 |
+
### How to contribute
|
| 24 |
+
|
| 25 |
+
1. Fork the repository.
|
| 26 |
+
2. Create a new branch from `main` (`git checkout -b feature/new-feature`).
|
| 27 |
+
3. Work on the task and commit your changes (`git commit -m "Implement new feature"`).
|
| 28 |
+
4. Push the changes and create a pull request.
|
| 29 |
+
5. Ensure that your code passes all tests and is documented.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
### Additional Context
|
| 34 |
+
|
| 35 |
+
- Link to relevant resources (e.g., issues, discussions, or other PRs).
|
README.md
CHANGED
|
@@ -20,3 +20,27 @@ This comes with risks:
|
|
| 20 |
---
|
| 21 |
|
| 22 |
## Other Functionaly will be updated as the project goes on
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
---
|
| 21 |
|
| 22 |
## Other Functionaly will be updated as the project goes on
|
| 23 |
+
|
| 24 |
+
## Quickstart
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
python -m venv .venv && source .venv/bin/activate
|
| 28 |
+
pip install -e .
|
| 29 |
+
pip install pytest pytest-cov
|
| 30 |
+
|
| 31 |
+
# (A) Train demo models (fast settings)
|
| 32 |
+
|
| 33 |
+
#Clean model on 5 epochs (Increase epochs for better accuracy, but it will take longer)
|
| 34 |
+
python -m scripts.train_resnet18 --dataset clean --epochs 5 --output_path models/resnet18_clean.pth
|
| 35 |
+
|
| 36 |
+
#Poisoned model on 5 epochs (Increase epochs for better accuracy, but it will take longer)
|
| 37 |
+
python -m scripts.train_resnet18 --dataset poison --train_poison_rate 0.1 --target_class 0 \
|
| 38 |
+
--epochs 5 --output_path models/resnet18_poison.pth
|
| 39 |
+
|
| 40 |
+
# (B) Run detection
|
| 41 |
+
mithridatium detect --model models/resnet18_poison.pth --defense mmbd --data cifar10 --out reports/mmbd.json
|
| 42 |
+
|
| 43 |
+
# (C) See summary
|
| 44 |
+
cat reports/mmbd.json
|
| 45 |
+
|
| 46 |
+
```
|
examples/demo_commands.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Demo Commands for Mithridatium
|
| 2 |
+
|
| 3 |
+
## 1. Set up environment:
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
python -m venv .venv
|
| 7 |
+
source .venv/bin/activate
|
| 8 |
+
pip install -e .
|
| 9 |
+
pip install pytest pytest-cov
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
## 2. Train Clean model:
|
| 13 |
+
|
| 14 |
+
```bash
|
| 15 |
+
python -m scripts.train_resnet18 --dataset clean --epochs 5 --output_path models/resnet18_clean.pth
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
## 3. Train Poisoned model:
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
python -m scripts.train_resnet18 --dataset poison --train_poison_rate 0.1 --target_class 0 --epochs 5 --output_path models/resnet18_poison.pth
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## 4. Run detection:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
mithridatium detect --model models/resnet18_poison.pth --defense mmbd --data cifar10 --out reports/mmbd.json
|
| 28 |
+
```
|
examples/sample_report.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"mithridatium_version": "0.1.0",
|
| 3 |
+
"timestamp_utc": "2025-01-01T00:00:00Z",
|
| 4 |
+
"model_path": "models/resnet18_poison.pth",
|
| 5 |
+
"defense": "mmbd",
|
| 6 |
+
"dataset": "cifar10",
|
| 7 |
+
"results": {
|
| 8 |
+
"suspected_backdoor": true,
|
| 9 |
+
"num_flagged": 500,
|
| 10 |
+
"top_eigenvalue": 42.3
|
| 11 |
+
}
|
| 12 |
+
}
|