sentimentizer
1.0.0
Beta release, api subject to change. Install with:
pip install sentimentizer
This repo contains Neural Nets written with the pytorch framework for sentiment analysis. Small models can be pretty effective for classification tasks at a much smaller cost to deploy. This package focuses on sentiment analysis and all models were trained on a single 2080Ti gpu in minutes. Deploying models for inference requires less than 1GB of memory which makes creating multiple containers relatively efficient.
# where 0 is very negative and 1 is very positive
from sentimentizer.tokenizer import get_trained_tokenizer
from sentimentizer.models.rnn import get_trained_model
model = get_trained_model(64, 'cpu')
tokenizer = get_trained_tokenizer()
review_text = "greatest pie ever, best in town!"
positive_ids = tokenizer.tokenize_text(review_text)
model.predict(positive_ids)
>> tensor(0.9701)
conda create -n {env}
conda install pip
pip install -e .
To rerun the model: