Giter Site home page Giter Site logo

sentiment-analysis-app's Introduction

Sentiment Analysis Classification with PyTorch Lightning

Getting Started

This project showcases an example application of PyTorch Lightning for sentiment analysis classification.

You can find a guide for this project in my blog post: Building a Sentiment Analysis Classifier using PyTorch Lightning

Project Structure

The directory structure of the project looks as follows:

.
├── .data # Contains the raw and processed data
│   ├── processed
│   └── raw
│
├── .experiments # Contains the results from training the models (checkpoints, results, etc.)
│   └── model1
│       ├── version_0 # Each version encapsulates everything needed to run the model (label encoder, tokenizer, weights, etc.)
│       |   └── ...
│       └── ...
├── .embeddings # Contains the pre-trained embeddings
│      
└── src 
    │
    └── ml  # Contains all the machine learning related code
        │
        ├── data # Contains the code for loading and preprocessing the data
        │   
        ├── datasets # Contains the code for the datasets
        │   
        ├── engines # Contains the code for training and evaluating the models
        │  
        ├── models # Contains the code for the models
        │   
        ├── scripts # Contains the scripts for running the training, testing, tuning, etc.
        │   
        └── utils # Contains the utility code and other helper functions

Note: Directories starting with a dot (.) are not tracked by git. They are created dynamically during the execution of the scripts.

Installation

The project is developed using Python 3.10. To install the dependencies needed for the project, run the following commands:

  1. pip install pdm
  2. pdm sync
  3. Activate the virtual environment

Training the model

To train the model you can run the following command:

pdm run ml

Otherwise, if you want to use the training script directly, you can run the following command from the root directory of the project:

python src/ml/scripts/train.py

Visualizing the model results

The results of the training and testing experiments are stored in the .experiments folder. You can view the results of these experiments by using tensorboard. To do so, run the following command:

pdm run tensorboard

sentiment-analysis-app's People

Contributors

harteros avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.