Instructions to use 0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use 0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use 0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora" --prompt "Once upon a time"
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
base_model: mlx-community/gemma-4-e2b-it-4bit
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
- lora
|
| 8 |
+
- gemma4
|
| 9 |
+
- pentesting
|
| 10 |
+
- kali-linux
|
| 11 |
+
- nethunter
|
| 12 |
+
- security
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Gemma 4 E2B-IT — Kali NetHunter Pentest LoRA
|
| 19 |
+
|
| 20 |
+
LoRA adapters for [mlx-community/gemma-4-e2b-it-4bit](https://huggingface.co/mlx-community/gemma-4-e2b-it-4bit) finetuned on Kali NetHunter penetration testing data for use on a rooted OnePlus 8T.
|
| 21 |
+
|
| 22 |
+
## What it does
|
| 23 |
+
|
| 24 |
+
Teaches the model to respond like an expert pentester with structured output:
|
| 25 |
+
- Nmap scan analysis with risk-rated tables
|
| 26 |
+
- Attack plans with exact bash commands
|
| 27 |
+
- WiFi, SMB, DNS enumeration workflows
|
| 28 |
+
- NetHunter + Termux specific tooling
|
| 29 |
+
|
| 30 |
+
## Training
|
| 31 |
+
|
| 32 |
+
- **Base model:** `mlx-community/gemma-4-e2b-it-4bit` (Gemma 4 E2B instruction-tuned, 4-bit quantized)
|
| 33 |
+
- **Method:** LoRA (rank 8, alpha 16, 4 layers)
|
| 34 |
+
- **Data:** 18 pentest examples + 2 validation (chat format with system/user/assistant)
|
| 35 |
+
- **Iterations:** 200 @ batch_size=1, lr=1e-5, grad_checkpoint=true
|
| 36 |
+
- **Hardware:** Apple Silicon 8GB (peak memory: 4.8GB)
|
| 37 |
+
- **Final loss:** Train 0.54, Val 2.13
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
> **Note:** Requires mlx-lm installed from the `gemma4` branch (Gemma 4 support not yet in the stable release).
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
# Install mlx-lm with Gemma 4 support
|
| 45 |
+
git clone https://github.com/ml-explore/mlx-lm.git
|
| 46 |
+
cd mlx-lm && git checkout gemma4
|
| 47 |
+
pip install -e .
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from mlx_lm import load, generate
|
| 52 |
+
|
| 53 |
+
model, tokenizer = load(
|
| 54 |
+
"mlx-community/gemma-4-e2b-it-4bit",
|
| 55 |
+
adapter_path="0xsoftboi/gemma-4-e2b-it-kali-nethunter-lora"
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
messages = [
|
| 59 |
+
{"role": "system", "content": "Expert pentester on rooted OnePlus 8T with Kali NetHunter + Termux. Give exact commands. Be concise."},
|
| 60 |
+
{"role": "user", "content": "Generate an attack plan for SMB"}
|
| 61 |
+
]
|
| 62 |
+
|
| 63 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 64 |
+
response = generate(model, tokenizer, prompt=prompt, max_tokens=300)
|
| 65 |
+
print(response)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Bug fix required
|
| 69 |
+
|
| 70 |
+
The upstream `gemma4` branch has a bug in `mlx_lm/models/gemma4.py` that prevents loading multimodal Gemma 4 checkpoints. The weight sanitizer adds a double `model.` prefix. Fix: [0xSoftBoi/mlx-lm@gemma4-fixes](https://github.com/0xSoftBoi/mlx-lm/tree/gemma4-fixes)
|
| 71 |
+
|
| 72 |
+
## Limitations
|
| 73 |
+
|
| 74 |
+
- Small training set (18 examples) — good at matching the pentest output style but may hallucinate specific CVEs or command flags
|
| 75 |
+
- E2B is a 2B-parameter model — works great on-device but less capable than larger variants
|
| 76 |
+
- Some safety guardrails from the base instruct model remain active
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
|
| 80 |
+
Apache 2.0 (same as base model)
|