/Ordered-Neuron-LSTM-with-Pretrained-Model

Introducing two different word representations to ON-LSTM model and evaluate their grammar induction performances

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

DS-GA 1012 Course Project

Ordered Neuron LSTM with Pretrained Model

GitHub contributors

Syntactic parsing, the task of learning grammar structure, acts as the backbone of naturallanguage understanding and has been shown to benefit many downstream natural language processing tasks. Toward this pursuit, we introduce two different word representations to ON-LSTM model and evaluate their grammar induction performances.

Requirements

To run the code, you will need an environment with the following:

  • Python (>3.6)
  • PyTorch
  • CUDA (strongly recommended)
  • NLTK

To run the evaluation script, you will also need Penn Treebank database.

Quick Start

  1. Please make sure you have the install NLTK PTB package and have the PTB corpus in the directory. For more details, please refer to ON-LSTM repo and find instructions.

  2. To run the language modeling training, use the following command

    python main_gpt.py --cuda --mode GPT --learning_rate 1e-6 --lr 10 --batch_size 20 --dropoute 0.0 --dropout 0.45 --dropouth 0.3 --dropouti 0.0 --wdrop 0.45 --chunk_size 10 --seed 141 --epoch 1000
    
  3. To test the model on the unsupervised parsing task, please use

    python test_phrase_grammar.py --cuda
    

References