Views
No views yet
Intended use: Exclusive internal use as an investigative-aid assistant. The adapter is a decision-support tool, not an authority — all outputs must be reviewed by a qualified human investigator before any action.
| Field | Value |
|---|---|
| Base model | unsloth/Qwen2.5-7B-Instruct-bnb-4bit |
| Adapter type | LoRA (PEFT) |
LoRA rank r | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Precision | 4-bit base (bitsandbytes NF4) + bf16 training |
| Training data | jhenberthf/cyber-investigator (Alpaca format, 99 rows) |
| Epochs | 2 |
| Max sequence length | 512 |
| Trainable params | ~40.4M (0.53% of base) |
Prompt format (important): the adapter was trained on Alpaca-format (### Instruction / ### Input / ### Response) text. Wrap that text inside a single Qwen chat-template user turn — do not feed raw Alpaca text, or the base Instruct model will echo the instruction and drift off-topic.
1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5base = "unsloth/Qwen2.5-7B-Instruct-bnb-4bit"
6adapter = "jhenberthf/cybercop-ai" # local path or "jhenberthf/cybercop-ai"
7
8tokenizer = AutoTokenizer.from_pretrained(base)
9if tokenizer.pad_token is None:
10 tokenizer.pad_token = tokenizer.eos_token
11model = AutoModelForCausalLM.from_pretrained(
12 base, device_map={"": "cuda:0"}, torch_dtype=torch.bfloat16
13)
14model = PeftModel.from_pretrained(model, adapter)
15model.eval()
16
17instruction = ("You are a cyber-investigation assistant. Given a complaint, "
18 "classify the likely cybercrime type, list immediate preservation "
19 "steps, and outline the next investigative actions.")
20inp = ("Victim reports being tricked into sending PHP 50,000 via GCash to a "
21 "suspect after a 'customer service' impostor promised a refund for a "
22 "purchase that was never delivered. The suspect account is now inactive.")
23
24# Alpaca-format text wrapped as a single chat user turn
25alpaca = f"### Instruction:\n{instruction}\n\n### Input:\n{inp}\n\n### Response:\n"
26prompt = tokenizer.apply_chat_template(
27 [{"role": "user", "content": alpaca}],
28 tokenize=False, add_generation_prompt=True,
29)
30
31inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
32out = model.generate(
33 **inputs, max_new_tokens=512, do_sample=False, temperature=1.0,
34 repetition_penalty=1.05,
35)
36text = tokenizer.decode(out[0], skip_special_tokens=True)
37# strip the prompt prefix, keep only the generated Response
38gen = text[len(tokenizer.decode(inputs["input_ids"][0], skip_special_tokens=False)):]
39resp = gen.split("### Response:")[-1].strip() if "### Response:" in gen else gen.strip()
40print(resp)unsloth/Qwen2.5-7B-Instruct-bnb-4bit and Qwen2.5 apply to the underlying weights.