CoolFace
Modelpublic

ryeyoo/sentimentizer-rnn

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
Model Card

Sentimentizer RNN Sentiment Model

Description

A bidirectional LSTM for sentiment classification built on pre-trained GloVe embeddings. The model processes token sequences through a multi-layer bidirectional LSTM, concatenates the final forward and backward hidden states, and classifies via a two-layer MLP head.

Training Data

Trained on the Yelp Open Dataset reviews, with GloVe Wiki-Gigaword-100 pre-trained embeddings. Reviews are tokenized with a custom dictionary (20k vocab, min frequency 3) and padded/truncated to 200 tokens.

Usage

python
from sentimentizer.hf import download_weights
from sentimentizer.config import DriverConfig, weights_path_for

# Download weights + dictionary from Hugging Face Hub
weights_path = weights_path_for("rnn")
download_weights(
    "rnn",
    weights_path,
    repo_id="ryeyoo/sentimentizer-rnn",
    dict_path=DriverConfig.files.dictionary_file_path,
)

# Load and run inference
from sentimentizer.models.rnn import get_trained_model
from sentimentizer.tokenizer import get_trained_tokenizer

model = get_trained_model(device="cpu")
tokenizer = get_trained_tokenizer()

probs = model.predict_text('amazing food great service')
for label, prob in sorted(probs.items(), key=lambda x: -x[1]):
    print(f'{label}: {prob:.4f}')
# e.g. positive: 0.8300, neutral: 0.1200, negative: 0.0500

Files

  • rnn_weights.pth — Model state dictionary
  • yelp.dictionary — Gensim dictionary for tokenization