Downloads · 30 days
19
28% of all-time downloads
Mohammadeeu20/besstie-sarcasm-gemma2b-lora-en-in
besstie-sarcasm-gemma2b-lora-en-in 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 Indian English text (Google reviews and Reddit posts). It is one of three variety-specific adapters (British, Australian, Indian…
Downloads · 30 days
19
28% of all-time downloads
All-time downloads
67
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 Indian 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) | 0.552 | 0.140 | 0.930 |
| en-AU (Australian English) | 0.440 | 0.050 | 0.712 |
| en-IN (Indian English) (in-variety) | 0.542 | 0.121 | 0.929 |
Across two seeds, the in-variety Macro-F1 is 0.565 ± 0.032, compared with 0.596 for full RoBERTa-base fine-tuning on the same split.
The weakest adapter. Indian English has only about 95 sarcastic training examples and heavy Hindi-English code-mixing, and the low-rank adapter struggles to learn the sarcastic class (F1 0.12). Treat its sarcasm predictions with caution.
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-in").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.