CoolFace
Modelpublic

SimoneAstarita/Pride-large-try-sweep-20251009-174509-t00

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes8downloads
Model Card

Pride-large-try-sweep-20251009-174509-t00

Multilingual XLM-T (EN/IT/ES) binary classifier Task: LGBTQ+ reclamation vs non-reclamation on social media text.

Trial timestamp (UTC): 2025-10-09 17:45:09 Data case: it

Configuration (trial hyperparameters)

HyperparameterValue
LANGUAGESit
LR2e-05
EPOCHS3
MAX_LENGTH256
USE_BIOTrue
USELANGTOKENFalse
GATED_BIOTrue
FOCAL_LOSSTrue
FOCAL_GAMMA1.5
USE_SAMPLERTrue
R_DROPTrue
RKLALPHA1.0
TEXT_NORMALIZETrue

Dev set results (summary)

MetricValue
f1macrodev_0.50.8943118184497495
f1weighteddev_0.50.9336848329020955
accuracydev0.50.9325153374233128
f1macrodevbestglobal0.9092483761212495
f1weighteddevbestglobal0.9444368750936943
accuracydevbest_global0.9447852760736196
f1macrodevbestby_lang0.9092483761212495
f1weighteddevbestby_lang0.9444368750936943
accuracydevbestbylang0.9447852760736196
default_threshold0.5
bestthresholdglobal0.65
thresholdsbylang{"it": 0.65}

Thresholds

  • —Default: 0.5
  • —Best global: 0.65
  • —Best by language: { "it": 0.65 }

Detailed evaluation

Classification report @ 0.5

text
              precision    recall  f1-score   support

 no-recl (0)     0.9690    0.9470    0.9579       132
    recl (1)     0.7941    0.8710    0.8308        31

    accuracy                         0.9325       163
   macro avg     0.8816    0.9090    0.8943       163
weighted avg     0.9357    0.9325    0.9337       163

Classification report @ best global threshold (t=0.65)

text
              precision    recall  f1-score   support

 no-recl (0)     0.9624    0.9697    0.9660       132
    recl (1)     0.8667    0.8387    0.8525        31

    accuracy                         0.9448       163
   macro avg     0.9145    0.9042    0.9092       163
weighted avg     0.9442    0.9448    0.9444       163

Classification report @ best per-language thresholds

text
              precision    recall  f1-score   support

 no-recl (0)     0.9624    0.9697    0.9660       132
    recl (1)     0.8667    0.8387    0.8525        31

    accuracy                         0.9448       163
   macro avg     0.9145    0.9042    0.9092       163
weighted avg     0.9442    0.9448    0.9444       163

Per-language metrics (at best-by-lang)

langnaccf1_macrof1_weightedprec_macrorec_macroprec_weightedrec_weighted
it1630.94480.90920.94440.91450.90420.94420.9448

Data

  • —Train/Dev: private multilingual splits with ~15% stratified Dev (by (lang,label)).
  • —Source: merged EN/IT/ES data with bios retained (ignored if unused by model).

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
import torch, numpy as np

repo = "SimoneAstarita/Pride-large-try-sweep-20251009-174509-t00"
tok = AutoTokenizer.from_pretrained(repo)
cfg = AutoConfig.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)

texts = ["example text ..."]
langs = ["en"]

mode = "best_global"  # or "0.5", "by_lang"

enc = tok(texts, truncation=True, padding=True, max_length=256, return_tensors="pt")
with torch.no_grad():
    logits = model(**enc).logits
probs = torch.softmax(logits, dim=-1)[:, 1].cpu().numpy()

if mode == "0.5":
    th = 0.5
    preds = (probs >= th).astype(int)
elif mode == "best_global":
    th = getattr(cfg, "best_threshold_global", 0.5)
    preds = (probs >= th).astype(int)
elif mode == "by_lang":
    th_by_lang = getattr(cfg, "thresholds_by_lang", {})
    preds = np.zeros_like(probs, dtype=int)
    for lg in np.unique(langs):
        t = th_by_lang.get(lg, getattr(cfg, "best_threshold_global", 0.5))
        preds[np.array(langs) == lg] = (probs[np.array(langs) == lg] >= t).astype(int)
print(list(zip(texts, preds, probs)))

### Files
reports.json — all metrics (macro/weighted/accuracy) for @0.5, @best_global, and @best_by_lang.
config.json — stores thresholds: default_threshold, best_threshold_global, thresholds_by_lang.
report_0.5.txt, report_best.txt — readable classification reports.
postprocessing.json — duplicate threshold info for external tools.