All Projects → castorini → Mp Cnn Torch

castorini / Mp Cnn Torch

Multi-Perspective Convolutional Neural Networks for modeling textual similarity (He et al., EMNLP 2015)

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Mp Cnn Torch

Grenade
Deep Learning in Haskell
Stars: ✭ 1,338 (+1162.26%)
Mutual labels:  convolutional-neural-networks
Lsuvinit
Reference caffe implementation of LSUV initialization
Stars: ✭ 99 (-6.6%)
Mutual labels:  convolutional-neural-networks
Wav2letter.pytorch
A fully convolution-network for speech-to-text, built on pytorch.
Stars: ✭ 104 (-1.89%)
Mutual labels:  convolutional-neural-networks
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-8.49%)
Mutual labels:  convolutional-neural-networks
Awslambdaface
Perform deep neural network based face detection and recognition in the cloud (via AWS lambda) with zero model configuration or tuning.
Stars: ✭ 98 (-7.55%)
Mutual labels:  convolutional-neural-networks
Ynet
Y-Net: Joint Segmentation and Classification for Diagnosis of Breast Biopsy Images
Stars: ✭ 100 (-5.66%)
Mutual labels:  convolutional-neural-networks
Fakeimagedetector
Image Tampering Detection using ELA and CNN
Stars: ✭ 93 (-12.26%)
Mutual labels:  convolutional-neural-networks
Self Driving Car
Automated Driving in NFS using CNN.
Stars: ✭ 105 (-0.94%)
Mutual labels:  convolutional-neural-networks
Cutmix
a Ready-to-use PyTorch Extension of Unofficial CutMix Implementations with more improved performance.
Stars: ✭ 99 (-6.6%)
Mutual labels:  convolutional-neural-networks
Sigmoidal ai
Tutoriais de Python, Data Science, Machine Learning e Deep Learning - Sigmoidal
Stars: ✭ 103 (-2.83%)
Mutual labels:  convolutional-neural-networks
Mongolian Speech Recognition
Mongolian speech recognition with PyTorch
Stars: ✭ 97 (-8.49%)
Mutual labels:  convolutional-neural-networks
Bayesian cnn
Bayes by Backprop implemented in a CNN in PyTorch
Stars: ✭ 98 (-7.55%)
Mutual labels:  convolutional-neural-networks
Keras Video Classifier
Keras implementation of video classifier
Stars: ✭ 100 (-5.66%)
Mutual labels:  convolutional-neural-networks
Cnniqa
CVPR2014-Convolutional neural networks for no-reference image quality assessment
Stars: ✭ 96 (-9.43%)
Mutual labels:  convolutional-neural-networks
Idn Caffe
Caffe implementation of "Fast and Accurate Single Image Super-Resolution via Information Distillation Network" (CVPR 2018)
Stars: ✭ 104 (-1.89%)
Mutual labels:  convolutional-neural-networks
Cardiac Segmentation
Convolutional Neural Networks for Cardiac Segmentation
Stars: ✭ 94 (-11.32%)
Mutual labels:  convolutional-neural-networks
Antialiased Cnns
pip install antialiased-cnns to improve stability and accuracy
Stars: ✭ 1,363 (+1185.85%)
Mutual labels:  convolutional-neural-networks
Ghostnet
CV backbones including GhostNet, TinyNet and TNT, developed by Huawei Noah's Ark Lab.
Stars: ✭ 1,744 (+1545.28%)
Mutual labels:  convolutional-neural-networks
Tiny Faces Pytorch
Finding Tiny Faces in PyTorch
Stars: ✭ 105 (-0.94%)
Mutual labels:  convolutional-neural-networks
Top Deep Learning
Top 200 deep learning Github repositories sorted by the number of stars.
Stars: ✭ 1,365 (+1187.74%)
Mutual labels:  convolutional-neural-networks

Multi-Perspective Convolutional Neural Networks for Modeling Textual Similarity

NOTE: This repo contains code for the original Torch implementation from the EMNLP 2015 paper. The code is not being maintained anymore and has been superseded by a PyTorch reimplementation in Castor. This repo exists solely for archival purposes.

This repo contains the Torch implementation of multi-perspective convolutional neural networks for modeling textual similarity, described in the following paper:

This model does not require external resources such as WordNet or parsers, does not use sparse features, and achieves good accuracy on standard public datasets.

Installation and Dependencies

  • Please install Torch deep learning library. We recommend this local installation which includes all required packages our tool needs, simply follow the instructions here: https://github.com/torch/distro

  • Currently our tool only runs on CPUs, therefore it is recommended to use INTEL MKL library (or at least OpenBLAS lib) so Torch can run much faster on CPUs.

  • Our tool then requires Glove embeddings by Stanford. Please run fetech_and_preprocess.sh for downloading and preprocessing this data set (around 3 GBs).

Running

  • Command to run (training, tuning and testing all included):
  • th trainSIC.lua or th trainMSRVID.lua

The tool will output pearson scores and also write the predicted similarity scores given each pair of sentences from test data into predictions directory.

Adaption to New Dataset

To run our model on your own dataset, first you need to build the dataset following below format and put it under data folder:

  • a.toks: sentence A, each sentence per line.
  • b.toks: sentence B, each sentence per line.
  • id.txt: sentence pair ID
  • sim.txt: semantic relatedness gold label, can be in any scale. For binary classification, the set of labels will be {0, 1}.

Then build vocabulary for your dataset which writes the vocab-cased.txt into your data folder:

$ python build_vocab.py

The last thing is to change the training and model code slightly to process your dataset:

  • change util/read_data.lua to handle your data.
  • create a new piece of training code following trainSIC.lua to read in your dataset.
  • change Conv.lua in Line 89-102 and 142-148 to handle your own task
  • more details can refer to issue https://github.com/castorini/MP-CNN-Torch/issues/6

Then you should be able to run your training code.

Trained Model

We also porvide a model which is already trained on STS dataset. So it is easier if you just want to use the model and do not want to re-train the whole thing.

The tarined model download link is HERE. Model file size is 500MB. To use the trained model, then simply use codes below:

modelTrained = torch.load("download_local_location/modelSTS.trained.th", 'ascii')
modelTrained.convModel:evaluate()
modelTrained.softMaxC:evaluate()
local linputs = torch.zeros(rigth_sentence_length, emd_dimension)
linpus = XassignEmbeddingValuesX
local rinputs = torch.zeros(left_sentence_length, emd_dimension)
rinpus = XassignEmbeddingValuesX

local part2 = modelTrained.convModel:forward({linputs, rinputs})
local output = modelTrained.softMaxC:forward(part2)
local val = torch.range(0, 5, 1):dot(output:exp()) 
return val/5

The ouput variable 'val' contains a similarity score between [0,1]. The input linputs1/rinputs are torch tensors and you need to fill in the word embedding values for both.

Example Deployment Script with Our Trained Model

We provide one example file for deployment: testDeployTrainedModel.lua. So it is easier for you to directly use our model. Run:

$ th testDeployTrainedModel.lua

This deployment file will use the trained model (assume you have downloaded the trained model from the above link), and it will generate scores given all test sentences of sick dataset. Please note the trained model is not trained on SICK data.

Ackowledgement

We thank Kai Sheng Tai for providing the preprocessing codes. We also thank the public data providers and Torch developers. Thanks.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].