KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
bert-sentiment
★ 18
Open GitHub ↗
Sentiment analysis by BERT
Download README (.md)
Explore Similar Repositories
jsii-publish
:
Dockerfile and Github action for publishing JSII packages
OctoPrint-Smuff
:
OctoPrint Plugin for SMuFF
tcp-warp
:
A userspace tunnel between two hosts mapping ports on client machine to addresses reachable from server machine.
APIs
:
Scripts para acesso de APIs de interesse público
Env
:
A Powershell version of Python's venv
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
bert-sentiment
?
Download (.md)
# Sentiment analysis by BERT in PyTorch BERT is state-of-the-art natural language processing model from Google. Using its latent space, it can be repurpossed for various NLP tasks, such as sentiment analysis. This simple wrapper based on [Transformers](https://github.com/huggingface/transformers) (for managing BERT model) and PyTorch achieves 92% accuracy on guessing positivity / negativity on IMDB reviews. # How to use ## Prepare data First, you need to prepare IMDB data which are publicly available. Format used here is one review per line, with first 12500 lines being positive, followed by 12500 negative lines. Or you can simply download dataset on my Google Drive [here](https://drive.google.com/drive/folders/1FiRODwhfJt6MpCqdfM7GgHwHqQ9VXFSJ?usp=sharing). Default folder read by script is `data/`. ## Train weights Training with default parameters can be performed simply by. `python script.py --train` Optionally, you can change output dir for weights or input dir for dataset. ## Evaluate weights You can find out how great you are (until your grandma gets her hands on BERT as well) simply by running `python script.py --evaluate` Of course, you need to train your data first or get them from my drive. ## Predict text `python script.py --predict "It was truly amazing experience."` or `python script.py --predict "It was so terrible and disgusting as coffee topped with ketchup."`