|
Download README.md from adhwiraj/security-scanner-llm: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/adhwiraj/security-scanner-llm/resolve/main/README.md
- Command line
-
hf download hf://adhwiraj/security-scanner-llm/README.md
-
curl -L -o README.md https://huggingface.co/adhwiraj/security-scanner-llm/resolve/main/README.md
1.57 kB
| license: mit | |
| base_model: microsoft/phi-2 | |
| tags: | |
| - generated_from_trainer | |
| datasets: | |
| - adhwiraj/security-scanner-dataset-private | |
| model-index: | |
| - name: security-scanner-llm | |
| results: [] | |
| # Security Scanner LLM (PEFT LoRA Adapter) | |
| This is a PEFT LoRA adapter for the microsoft/phi-2 model, fine-tuned for security vulnerability detection. | |
| ## Model Details | |
| - Base Model: microsoft/phi-2 | |
| - PEFT Type: LoRA | |
| - Task: Causal Language Modeling | |
| - Training Dataset: adhwiraj/security-scanner-dataset-private | |
| ## Usage | |
| ```python | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| base_model_name = "microsoft/phi-2" | |
| adapter_name = "adhwiraj/security-scanner-llm" | |
| # Load base model | |
| model = AutoModelForCausalLM.from_pretrained(base_model_name) | |
| tokenizer = AutoTokenizer.from_pretrained(base_model_name) | |
| # Load PEFT adapter | |
| model = PeftModel.from_pretrained(model, adapter_name) | |
| # Use for inference | |
| prompt = "Analyze this code for security vulnerabilities:\n\n```python\ndef query(user_input):\n return f'SELECT * FROM users WHERE name = {user_input}'\n```\n\nSecurity analysis:" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate(**inputs, max_new_tokens=200) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ## Training | |
| This model was trained using PEFT LoRA (Low-Rank Adaptation) technique with the following parameters: | |
| - r: 8 | |
| - lora_alpha: 16 | |
| - lora_dropout: 0.1 | |
| - target_modules: ["fc1", "out_proj", "fc2", "Wqkv"] | |