Views
No views yet
phishing vs safe).google/gemma-3-4b-itbriankkogi/gemma3-phishing-main-v1phishing or safe (single-word target)1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4repo = "briankkogi/gemma3-phishing-v1-bf16"
5
6tok = AutoTokenizer.from_pretrained(repo)
7if tok.pad_token is None:
8 tok.pad_token = tok.eos_token
9
10model = AutoModelForCausalLM.from_pretrained(
11 repo,
12 torch_dtype=torch.bfloat16,
13 device_map="auto",
14).eval()
15
16prompt = 'Email body: """Your account will be suspended unless you verify now."""\n\nTask: Is this phishing or safe? Reply with only one word: phishing or safe.'
17inputs = tok.apply_chat_template(
18 [{"role": "user", "content": prompt}],
19 tokenize=True,
20 add_generation_prompt=True,
21 return_dict=True,
22 return_tensors="pt",
23).to(model.device)
24
25with torch.no_grad():
26 out = model.generate(**inputs, max_new_tokens=2, do_sample=False)
27
28txt = tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip().lower()
29pred = "phishing" if "phishing" in txt else "safe"
30print(pred, "| raw:", txt)google/gemma-3-4b-itbriankkogi/gemma3-phishing-main-v1briankkogi/gemma3-phishing-v1-bf16bf16https://huggingface.co/briankkogi/gemma3-phishing-main-v1.google/gemma-3-4b-it and is subject to upstream model terms and any dataset usage constraints.
Review and comply with all applicable licenses/policies before deployment.v1-bf16