A simple LSTM-based sentiment classifier built with PyTorch for learning deep learning fundamentals.
Classifies text as positive or negative sentiment using:
- Embedding layer for word representations
- LSTM for sequence processing
- Fully connected layer with sigmoid activation for binary classification
- Python 3.8+
- PyTorch (CUDA optional for GPU acceleration)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtpython main.pyThis trains the model on a small toy dataset and prints the loss every 10 epochs.
main.py # Model definition and training loop
requirements.txt # Python dependencies
MIT