Text Generation
Transformers
Safetensors
qwen2
cybersecurity
qlora
lora
unsloth
trl
ironllms
conversational
text-generation-inference
Instructions to use FarrukhMunir1/CyberGaurd-Demo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FarrukhMunir1/CyberGaurd-Demo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FarrukhMunir1/CyberGaurd-Demo") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FarrukhMunir1/CyberGaurd-Demo") model = AutoModelForCausalLM.from_pretrained("FarrukhMunir1/CyberGaurd-Demo", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FarrukhMunir1/CyberGaurd-Demo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FarrukhMunir1/CyberGaurd-Demo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FarrukhMunir1/CyberGaurd-Demo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FarrukhMunir1/CyberGaurd-Demo
- SGLang
How to use FarrukhMunir1/CyberGaurd-Demo with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "FarrukhMunir1/CyberGaurd-Demo" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FarrukhMunir1/CyberGaurd-Demo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "FarrukhMunir1/CyberGaurd-Demo" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FarrukhMunir1/CyberGaurd-Demo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use FarrukhMunir1/CyberGaurd-Demo with Docker Model Runner:
docker model run hf.co/FarrukhMunir1/CyberGaurd-Demo
CyberGuard-3B โ IronLLMs
A 3B-parameter cybersecurity expert model fine-tuned with QLoRA on a free Google Colab T4, by Farrukh Munir.
Method
- Base: Qwen2.5-3B-Instruct, 4-bit NF4 quantised (bitsandbytes)
- LoRA adapters: rank r=16, alpha=32, dropout=0, 7 target modules (q/k/v/o + gate/up/down)
- Trainer: trl SFTTrainer (SFTConfig) + Unsloth
- Data: Trendyol cybersecurity instruction-tuning dataset (53,201 rows -> 5,000 curated, seed 3407)
- Persona: fixed SYSTEM_PROMPT used verbatim in training AND inference
Domains
Threat analysis / Vulnerability guidance / Security best practices / Incident response
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
SYSTEM_PROMPT = ("You are CyberGuard, an expert in cybersecurity. You are part of a "
"project named 'IronLLMs', created by Farrukh Munir. The aim of this "
"project is to fine-tune a quantised 2-3B parameter language model "
"using QLoRA in Google Colab. You cover threat analysis, vulnerability "
"guidance, security best practices, and incident response. Give "
"precise, actionable, and technically accurate answers.")
model = AutoModelForCausalLM.from_pretrained("FarrukhMunir1/CyberGuard-3B", torch_dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("FarrukhMunir1/CyberGuard-3B")
question = "What is ransomware?"
prompt = f"### System:
{SYSTEM_PROMPT}
### Instruction:
{question}
### Response:
"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
print(tokenizer.decode(out[0], skip_special_tokens=True).split("### Response:")[1].strip())
- Downloads last month
- 288