Code Monkey home page Code Monkey logo

qg-net's Introduction

Running Instructions

To train the base QG-Net model, run python qg_net_base.py To train the BERT based QG-Net model, run python qg_net_bert.py

An example of running inference to compute the metrics has been shown in inference.py

Data Link

The dataset used along with the trained weights can be found at - https://drive.google.com/drive/folders/1Jlo4wUBKDapEhR6D2-uaR3N8cctCy8lF?usp=sharing

QG-Net Implementation

RNNEncoder: This class encode the input using a bidirectional input and produces representations for each word in the context

RNNDecoder: This class decode the output of Encoder in sequential manner with attention and pointer network (used for calculating probabilities from source side).
QGNet: This class combine the encoder and decoder. the forward pass uses teacher forcing if a target is available. else special token '' is used as input for the first decoder step.

QG-Net with Bert

QADataset: Dataset used for converting data to form usable by Huggingface transformers

BertEncoder: We used pre-trained encoder from bert 'bert-base-uncased' which assume capital and small alphabets as same.

BertDecoder: The decoder will decode the encoder output and calculate probability distribution using attention and pointer network. Uses a BertLMHeadModel for decoding.

BertPointerNetwork-: This class combine the encoder and decoder. the forward pass uses teacher forcing if a target is available. else special token '[CLS]' is used as input for the first decoder step.

Util

Functions

train_step: this function will check our model on train data and return how much loss we obtain for this data.
eval_step:this function will evalute our model on test data and test how much loss we obtain for this data.
train_model:The function will train our model for certain epochs which are 10 in our case.also this function is used to print losses and to save model at pt format.

qg-net's People

Contributors

manoj-sirvi avatar

Watchers

 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.