Downloads · 30 days
17
25% of all-time downloads
mervegundogdu/fraud-detection-gemma2b-fp16
fraud-detection-gemma2b-fp16 is a text generation model from mervegundogdu. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
This model is a full-precision fp16 version of the fine-tuned mervegundogdu/fraud-detection-lora-gemma2b checkpoint.
Downloads · 30 days
17
25% of all-time downloads
All-time downloads
68
Public
Parameters
2.5B
5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5 GB · 99%
From the Hugging Face model README
This model is a full-precision fp16 version of the fine-tuned
mervegundogdu/fraud-detection-lora-gemma2b checkpoint.
The original checkpoint stored the base weights in bnb 4-bit NF4 format with a
LoRA adapter (r=16, alpha=32). In this repository the 4-bit weights are
dequantized to fp16 and the LoRA adapter is merged into the base weights,
so the model can be loaded and served with plain AutoModelForCausalLM
without bitsandbytes, on CPU or GPU.
google/gemma-2bFraud or
Legitimate Transaction with a short justificationGemmaForCausalLM, ~2.5B parameters, fp16 (~5 GB)mervegundogdu/fraud-detection-datasetUse the Gemma chat template. The user message should contain the instruction followed by the transaction details:
<bos><start_of_turn>user
Below is information about a credit card / bank transaction. Analyze whether this transaction is fraudulent, and classify it as 'Fraud' or 'Legitimate Transaction' along with a short justification.
Transaction Amount: $2400.00
Customer's Average Transaction Amount: $523.76
Category: Electronics
Transaction Time: 03:00 (Night transaction: Yes)
Location: New York (Distance from home: 4500.0 km)
Customer Age: 38
Account Age: 3615 days
New Device: Yes
Previous Fraud Count: 0
<end_of_turn>
<start_of_turn>model
Expected output format: Fraud. Reason: ... or Legitimate Transaction. Reason: ...
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "mervegundogdu/fraud-detection-gemma2b-fp16"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.float16)
instruction = ("Below is information about a credit card / bank transaction. "
"Analyze whether this transaction is fraudulent, and classify it "
"as 'Fraud' or 'Legitimate Transaction' along with a short justification.")
input_text = """Transaction Amount: $2400.00
Customer's Average Transaction Amount: $523.76
Category: Electronics
Transaction Time: 03:00 (Night transaction: Yes)
Location: New York (Distance from home: 4500.0 km)
Customer Age: 38
Account Age: 3615 days
New Device: Yes
Previous Fraud Count: 0"""
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": instruction + "\n" + input_text}],
tokenize=False, add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(out[0], skip_special_tokens=True))
This model is not served by the Hugging Face serverless Inference API.
To run it as an API, use a dedicated Inference Endpoint
(see mervegundogdu/fraud-detection-gemma2b-fp16 on the Hub — it is
endpoints_compatible / TGI-ready) or self-host it locally with the code above.
The model card tags note base_model:google/gemma-2b; the base model is
gated, so keep the license requirements in mind when sharing outputs.