Skip to main content

straight forward rnn model

Project description

Introduction

PyPI Latest Release GitHub CI

Beta release, api subject to change. Install with:

pip install sentimentizer

This repo contains Neural Nets written with the pytorch framework for sentiment analysis.
A LSTM based torch model can be found in the rnn folder. In spite of large language models (GPT3.5 as of 2023) dominating the conversation, small models can be pretty effective and are nice to learn from. This model focuses on sentiment analysis and was trained on a single gpu in minutes and requires less than 1GB of memory.

Usage

# where 0 is very negative and 1 is very positive
from sentimentizer.tokenizer import get_trained_tokenizer
from sentimentizer.rnn.model 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)

Install for development with miniconda:

conda create -n {env}  
conda install pip  
pip install -e .  

Retrain model

To rerun the model:

  • get the yelp dataset,
  • get the glove 6B 100D dataset
  • place both files in the package data directory
  • run the training script in workflows

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentimentizer-0.6.5.tar.gz (9.3 MB view details)

Uploaded Source

File details

Details for the file sentimentizer-0.6.5.tar.gz.

File metadata

  • Download URL: sentimentizer-0.6.5.tar.gz
  • Upload date:
  • Size: 9.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for sentimentizer-0.6.5.tar.gz
Algorithm Hash digest
SHA256 75becfddac60f9b70e10860e8b35ccd8510582834234a42a98263612fdb7c573
MD5 17522db4ccfad523bd3cd070b72c478c
BLAKE2b-256 45a4d658bc14271b9124593c2d0e58301572156a893d0b447c076b80585d6350

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page