|
Download README.md from Mayurkhalse/muril-sarcasm-detector: direct link, hf CLI and curl.
- Browser
- Download file 2.59 kB
-
https://huggingface.co/Mayurkhalse/muril-sarcasm-detector/resolve/main/README.md
- Command line
-
hf download hf://Mayurkhalse/muril-sarcasm-detector/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/Mayurkhalse/muril-sarcasm-detector/resolve/main/README.md
2.59 kB
metadata
language:
- en
- hi
- multilingual
license: apache-2.0
tags:
- sarcasm-detection
- muril
- hinglish
- text-classification
pipeline_tag: text-classification
widget:
- text: Oh brilliant! Another meeting that could have been an email.
- text: Arey wah! 3 ghante late aakar bolte ho 'I am on time'!
- text: वाह भाई! पूरी रात रील्स देखकर कहते हैं कि पढ़ाई का समय नहीं मिला।
- text: The package arrived safely today and was packed well.
- text: Kal subah 10 baje office me team meeting start hogi.
MuRIL for Sarcasm Detection (English, Hindi, & Hinglish)
This model is a fine-tuned version of Google's google/muril-base-cased specialized for Sarcasm Detection across English, Hinglish (code-mixed / transliterated Hindi), and Hindi (Devanagari script).
Model Details
- Base Architecture: Multilingual Representations for Indian Languages (MuRIL)
- Task: Binary Sequence Classification (
0: Not Sarcastic,1: Sarcastic) - Languages: English, Hindi, Hinglish (and applicable to Indian languages)
- Regularization: Label Smoothing (0.1) & L2 Weight Decay (0.05) to ensure calibrated, non-overfit confidence scores.
How to Use in Python
You can load and use this model directly in your Python scripts with 3 lines of code:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Load model and tokenizer
model_id = "YOUR_HF_USERNAME/muril-sarcasm-detector"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
# Input sentences
texts = [
"Oh brilliant! Another meeting that could have been an email.",
"Arey wah! 3 ghante late aakar bolte ho 'I am on time'!",
"The package arrived safely today and was packed well."
]
# Tokenize & Predict
inputs = tokenizer(texts, padding=True, truncation=True, max_length=128, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.softmax(outputs.logits, dim=-1)
for text, prob in zip(texts, probabilities):
label = "Sarcastic" if prob[1] > 0.5 else "Not Sarcastic"
confidence = max(prob[0], prob[1]).item()
print(f"Text: '{text}' -> {label} ({confidence:.1%})")
Intended Use & Limitations
- Trained to identify irony, situational sarcasm, and sarcastic colloquialisms in Indian social media, workplace, and conversational contexts.