Instructions to use mervegundogdu/fraud-detection-gemma2b-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mervegundogdu/fraud-detection-gemma2b-fp16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mervegundogdu/fraud-detection-gemma2b-fp16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mervegundogdu/fraud-detection-gemma2b-fp16") model = AutoModelForCausalLM.from_pretrained("mervegundogdu/fraud-detection-gemma2b-fp16", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mervegundogdu/fraud-detection-gemma2b-fp16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mervegundogdu/fraud-detection-gemma2b-fp16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mervegundogdu/fraud-detection-gemma2b-fp16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mervegundogdu/fraud-detection-gemma2b-fp16
- SGLang
How to use mervegundogdu/fraud-detection-gemma2b-fp16 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 "mervegundogdu/fraud-detection-gemma2b-fp16" \ --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": "mervegundogdu/fraud-detection-gemma2b-fp16", "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 "mervegundogdu/fraud-detection-gemma2b-fp16" \ --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": "mervegundogdu/fraud-detection-gemma2b-fp16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mervegundogdu/fraud-detection-gemma2b-fp16 with Docker Model Runner:
docker model run hf.co/mervegundogdu/fraud-detection-gemma2b-fp16
Fraud Detection Gemma2B (fp16, LoRA merged)
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.
- Base model:
google/gemma-2b - Task: classify a credit card / bank transaction as
FraudorLegitimate Transactionwith a short justification - Architecture:
GemmaForCausalLM,2.5B parameters, fp16 (5 GB) - Trained on:
mervegundogdu/fraud-detection-dataset
Prompt format
Use 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: ...
Usage (local)
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))
Hosted usage
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.
- Downloads last month
- 20
Model tree for mervegundogdu/fraud-detection-gemma2b-fp16
Base model
google/gemma-2b