Downloads · 30 days
0
francesco-zatto/stacked-bilstm-sexism-detector
stacked-bilstm-sexism-detector is a text classification model from francesco-zatto. Use it when you need a label for a piece of text. The card lists the license as mit.
This repository contains a custom PyTorch Bidirectional LSTM model trained for multi-class sexism detection. It was developed as part of an academic assignment based on Task 2 of the EXIST 2023 (EXpert Identification…
Downloads · 30 days
0
Access
Public
Updated Apr 11, 2026
Repo size
161 MB
Likes
0
Public
Click a slice to open those files.
.pth161 MB · 100%
From the Hugging Face model README
This repository contains a custom PyTorch Bidirectional LSTM model trained for multi-class sexism detection. It was developed as part of an academic assignment based on Task 2 of the EXIST 2023 (EXpert Identification of SExist Tweets) dataset.
en).glove-wiki-gigaword-100), with Out-Of-Vocabulary (OOV) terms embedded using context-window neighborhood averaging.This model categorizes English tweets into one of four categories based on the author's intent:
- (Non-sexist)DIRECT (Directly sexist messages)JUDGEMENTAL (Messages condemning sexist behaviors)REPORTED (Messages reporting a sexist situation)Because this is a custom PyTorch model, input text must be cleaned using the specific pipeline defined during training before being passed to the model. The pipeline includes:
emoji library)nltk.WordNetLemmatizer)The model was trained on the English subset of the EXIST 2023 Task 2 dataset. Labels were aggregated from six annotators using majority voting. Tweets without a clear majority were discarded. Class imbalance was handled using weighted Cross-Entropy Loss.
The model was evaluated on the provided test split using Macro-averaged metrics across 5 different random seeds to ensure robust estimation.
Since this is a pure PyTorch model (.pth weights) rather than a standard Hugging Face Transformer, you must instantiate the architecture in your code before loading the weights.
import torch
from huggingface_hub import hf_hub_download
# 1. Download the weights from the Hub
weights_path = hf_hub_download(
repo_id="your-username/your-repo-name",
filename="best_lstm_weights.pth"
)
# 2. Instantiate your custom model class (BaselineModel or StackedModel)
# NOTE: You must have your custom class defined in your script
model = StackedModel()
# 3. Load the state dictionary
model.load_state_dict(torch.load(weights_path, map_location=torch.device('cpu')))
model.eval()
print("Model successfully loaded!")