Update README.md
Browse files
README.md
CHANGED
|
@@ -3,14 +3,61 @@ license: apache-2.0
|
|
| 3 |
base_model: Qwen/Qwen2.5-Coder-14B-Instruct
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
-
- code-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
- rocm
|
| 10 |
-
- qwen2.5
|
| 11 |
- amd-hackathon
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
Fine-tuned Qwen2.5-Coder-14B-Instruct khusus untuk **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
base_model: Qwen/Qwen2.5-Coder-14B-Instruct
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
+
- code-generation
|
| 7 |
+
- secure-coding
|
| 8 |
+
- patch-generation
|
| 9 |
- rocm
|
| 10 |
+
- qwen2.5-Coder
|
| 11 |
- amd-hackathon
|
| 12 |
+
- Axolotl
|
| 13 |
+
- LoRA(PEFT)
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# ๐ง Security Builder Model (14B)
|
| 17 |
|
| 18 |
+
Fine-tuned Qwen2.5-Coder-14B-Instruct khusus untuk **generasi patch keamanan & penulisan kode aman**. Melengkapi Auditor model dengan mengubah laporan kerentanan menjadi kode perbaikan yang production-ready.
|
| 19 |
+
|
| 20 |
+
## ๐ Quick Load
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 23 |
+
import torch
|
| 24 |
+
|
| 25 |
+
model_id = "lablab-ai-amd-developer-hackathon/security-builder-14b"
|
| 26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 27 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
| 28 |
+
|
| 29 |
+
### ๐ฌ Example Usage (JSON Mode)
|
| 30 |
+
messages = [
|
| 31 |
+
{"role": "user", "content": "Fix the buffer overflow and return JSON with keys: fixed_code, explanation, cwe_mitigated."}
|
| 32 |
+
]
|
| 33 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 34 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 35 |
+
|
| 36 |
+
with torch.no_grad():
|
| 37 |
+
output = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
|
| 38 |
+
|
| 39 |
+
import json
|
| 40 |
+
print(json.loads(tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)))
|
| 41 |
+
```
|
| 42 |
+
#### ๐ ๏ธ Technical Specifications
|
| 43 |
+
|
| 44 |
+
| Parameter | Value |
|
| 45 |
+
| :--- | :--- |
|
| 46 |
+
| **Base Model** | Qwen2.5-Coder-14B-Instruct |
|
| 47 |
+
| **Fine-tuning** | LoRA (r=64, alpha=128, dropout=0.05) |
|
| 48 |
+
| **Training Data** | Custom secure coding & patch dataset |
|
| 49 |
+
| **Epochs** | 3 |
|
| 50 |
+
| **Precision** | float16 (ROCm-optimized) |
|
| 51 |
+
| **Format** | Safetensors (6 shards, ~28GB) |
|
| 52 |
+
| **VRAM Required** | ~38-42 GB |
|
| 53 |
+
|
| 54 |
+
##### ๐ฅ๏ธ ROCm & Hardware Optimization
|
| 55 |
+
Dioptimalkan untuk AMD Instinct MI300X / ROCm 7.0. Disarankan set env var berikut sebelum inference:
|
| 56 |
+
export HSA_OVERRIDE_GFX_VERSION=11.0.0
|
| 57 |
+
export PYTORCH_HIP_ALLOC_CONF=expandable_segments:False
|
| 58 |
+
|
| 59 |
+
###### ๐ API Integration
|
| 60 |
+
Designed for CI/CD integration. Gunakan response_format={"type":"json_object"} untuk parsing otomatis patch & metadata keamanan.
|
| 61 |
+
|
| 62 |
+
####### ๐ License & Credits
|
| 63 |
+
Apache 2.0. Developed for the AMD Developer Hackathon 2026.
|