CoolFace
Modelpublic

SimoneAstarita/trilingual-no-bio-20251012-202343-t16

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

october-finetuning-more-variables-sweep-20251012-202343-t08

Slur reclamation binary classifier Task: LGBTQ+ reclamation vs non-reclamation use of harmful words on social media text.

Trial timestamp (UTC): 2025-10-12 20:23:43 Data case: en-es-it

Configuration (trial hyperparameters)

Model: Alibaba-NLP/gte-multilingual-base

HyperparameterValue
LANGUAGESen-es-it
LR1e-05
EPOCHS5
MAX_LENGTH256
USE_BIOFalse
USELANGTOKENFalse
GATED_BIOFalse
FOCAL_LOSSTrue
FOCAL_GAMMA1.5
USE_SAMPLERTrue
R_DROPTrue
RKLALPHA0.5
TEXT_NORMALIZETrue

Dev set results (summary)

MetricValue
f1macrodev_0.50.6966881607229021
f1weighteddev_0.50.8396412101658748
accuracydev0.50.8285077951002228
f1macrodevbestglobal0.7184728843416901
f1weighteddevbestglobal0.861020415912312
accuracydevbest_global0.8596881959910914
f1macrodevbestby_lang0.7297459973516311
f1weighteddevbestby_lang0.8726099195059952
accuracydevbestbylang0.8775055679287305
default_threshold0.5
bestthresholdglobal0.65
thresholdsbylang{"en": 0.65, "it": 0.6, "es": 0.8}

Thresholds

  • —Default: 0.5
  • —Best global: 0.65
  • —Best by language: { "en": 0.65, "it": 0.6, "es": 0.8 }

Detailed evaluation

Classification report @ 0.5

text
              precision    recall  f1-score   support

 no-recl (0)     0.9278    0.8675    0.8966       385
    recl (1)     0.4270    0.5938    0.4967        64

    accuracy                         0.8285       449
   macro avg     0.6774    0.7306    0.6967       449
weighted avg     0.8564    0.8285    0.8396       449

Classification report @ best global threshold (t=0.65)

text
              precision    recall  f1-score   support

 no-recl (0)     0.9215    0.9143    0.9179       385
    recl (1)     0.5075    0.5312    0.5191        64

    accuracy                         0.8597       449
   macro avg     0.7145    0.7228    0.7185       449
weighted avg     0.8625    0.8597    0.8610       449

Classification report @ best per-language thresholds

text
              precision    recall  f1-score   support

 no-recl (0)     0.9167    0.9429    0.9296       385
    recl (1)     0.5849    0.4844    0.5299        64

    accuracy                         0.8775       449
   macro avg     0.7508    0.7136    0.7297       449
weighted avg     0.8694    0.8775    0.8726       449

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

langnaccf1_macrof1_weightedprec_macrorec_macroprec_weightedrec_weighted
en1540.86360.54290.86120.54460.54150.85870.8636
it1630.88340.79800.87940.82160.77990.87790.8834
es1320.88640.75300.87950.79060.72770.87700.8864

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/october-finetuning-more-variables-sweep-20251012-202343-t08"
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)))

Additional files

reports.json: all metrics (macro/weighted/accuracy) for @0.5, @bestglobal, and @bestbylang. config.json: stores thresholds: defaultthreshold, bestthresholdglobal, thresholdsbylang. postprocessing.json: duplicate threshold info for external tools.