Skip to content

epochx/pytorch-nlp-tutorial

Repository files navigation

A batch-wise NLP tutorial with PyTorch

A simple batch-wise NLP tutorial using PyTorch.

Main requirements

  • Python 3
  • Pytorch
  • conda

Installation

  1. Clone this repo in your home directory (recommended)

    git clone https://github.com/epochx/pytorch-nlp-tutorial
    cd pytorch-nlp-tutorial
  2. Create a conda environment. If you don't have conda installed, I recommend using miniconda. You can then easily create and activate a new conda environment with Python 3.6 by executing:

    conda create -n tutorial python=3.6
    conda activate tutorial
    
  3. Run the installation script

    sh ./install.sh

Contents

sequence-classification

A tutorial for sentence classification using PyTorch. We start by showcasing the PyTorch workflow with a simple Logistic Regression for irony detection on the SemEval 2018 Dataset, using one-hot vectors.

Additionaly, we work on Sentiment Classification over the Large IMDB Movie Review Dataset, using a bidirectional LSTM with word embeddings.

Find the self-contained interactive Jupyter Notebook versions here:

To run the examples in your own machine:

  • Download the data (will create ~/data/pytorch-nlp-tutorial):
    • sh ./sequence_classification/get_data.sh
  • Run the Logistic Regression model:
    • python -m tutorial.sequence_classification.run_log_reg
  • Run the LSTM model:
  • python -m tutorial.sequence_classification.run_lstm

sequence-labeling

A tutorial for sequence labeling using a bidirectional LSTM and Conditonal Random Fields for NER for spanish over the CoNLL-2003 data.

Coming soon...

About

A batch-wise NLP tutorial with Pytorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published