Downloads · 30 days
18
27% of all-time downloads
Mohammadeeu20/besstie-sarcasm-gemma2b-lora-en-uk
besstie-sarcasm-gemma2b-lora-en-uk is a text classification model from Mohammadeeu20. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as gemma.
A 4-bit QLoRA adapter that turns google/gemma-2-2b into a binary sarcasm classifier for British English text (Google reviews and Reddit posts). It is one of three variety-specific adapters (British, Australian, Indian…
Downloads · 30 days
18
27% of all-time downloads
All-time downloads
66
Public
Repo size
25.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors25.6 MB · 100%
From the Hugging Face model README
A 4-bit QLoRA adapter that turns google/gemma-2-2b into a binary sarcasm classifier for British English text (Google reviews and Reddit posts).
It is one of three variety-specific adapters (British, Australian, Indian English) that share a single base model and can be swapped at request time.
python src/app.py from the GitHub repoTest-set results for this adapter (seed 123, the uploaded checkpoint), evaluated on each English variety:
| Test variety | Macro-F1 | Sarcastic-class F1 | Accuracy |
|---|---|---|---|
| en-UK (British English) (in-variety) | 0.737 | 0.506 | 0.939 |
| en-AU (Australian English) | 0.541 | 0.248 | 0.727 |
| en-IN (Indian English) | 0.617 | 0.283 | 0.907 |
Across two seeds, the in-variety Macro-F1 is 0.719 ± 0.025, compared with 0.702 for full RoBERTa-base fine-tuning on the same split.
Strong in-variety performance; the sarcastic class is rare in the British test split (53 examples), so per-class F1 is noisy.
Efficiency: about 0.4% of parameters trained (6.4M of 1.6B), and the adapter is about 25 MB on disk, against roughly 500 MB for a full RoBERTa checkpoint. Measured single-example GPU latency was about 39 ms with the 4-bit base.
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b")
base = AutoModelForSequenceClassification.from_pretrained(
"google/gemma-2-2b", num_labels=2, quantization_config=bnb,
torch_dtype=torch.float16, device_map="auto")
base.config.pad_token_id = tokenizer.pad_token_id
model = PeftModel.from_pretrained(base, "Mohammadeeu20/besstie-sarcasm-gemma2b-lora-en-uk").eval()
inputs = tokenizer("Oh brilliant, another delayed train.", return_tensors="pt").to(model.device)
with torch.inference_mode():
p_sarcastic = model(**inputs).logits.float().softmax(-1)[0, 1].item()
print(f"P(sarcastic) = {p_sarcastic:.3f}")
Label 1 = sarcastic, label 0 = not sarcastic. Gemma is a gated model, so accept its licence on Hugging Face and log in before loading.
Built as part of a team project for the COMM061 Natural Language Processing module at the University of Surrey (2026). Author of this release: Mohammad Abdalaziz.