CoolFace
Modelpublic

ryeyoo/sentimentizer-decoder

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
README.md52 linesDownload Raw Back to root
1---2language: en3license: mit4tags:5  - sentiment-analysis6  - text-classification7  - decoder8library_name: sentimentizer9task: text-classification10---11# Sentimentizer DECODER Sentiment Model12## Description13 14A Transformer Encoder-Decoder for sentiment classification built on pre-trained GloVe embeddings. The encoder processes the input sequence, and the decoder attends to the encoder outputs to produce a sentiment prediction.15 16## Training Data17 18Trained on the [Yelp Open Dataset](https://www.yelp.com/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.19 20## Usage21 22```python23from sentimentizer.hf import download_weights24from sentimentizer.config import DriverConfig, weights_path_for25 26# Download weights + dictionary from Hugging Face Hub27weights_path = weights_path_for("decoder")28download_weights(29    "decoder",30    weights_path,31    repo_id="ryeyoo/sentimentizer-decoder",32    dict_path=DriverConfig.files.dictionary_file_path,33)34 35# Load and run inference36from sentimentizer.models.decoder import get_trained_model37from sentimentizer.tokenizer import get_trained_tokenizer38 39model = get_trained_model(device="cpu")40tokenizer = get_trained_tokenizer()41 42probs = model.predict_text('amazing food great service')43for label, prob in sorted(probs.items(), key=lambda x: -x[1]):44    print(f'{label}: {prob:.4f}')45# e.g. positive: 0.8300, neutral: 0.1200, negative: 0.050046```47 48## Files49 50- `decoder_weights.pth` — Model state dictionary51- `yelp.dictionary` — Gensim dictionary for tokenization52