GithubHelp home page GithubHelp logo

xingxingzhang / dress Goto Github PK

View Code? Open in Web Editor NEW
153.0 13.0 44.0 574 KB

DRESS simplification model (EMNLP 2017) described in http://aclweb.org/anthology/D/D17/D17-1062.pdf

License: MIT License

Lua 81.52% Python 4.80% Perl 11.01% Shell 2.68%

dress's Introduction

Sentence Simplification with Deep Reinforcement Learning

This is an implmentation of the DRESS (Deep REinforcement Sentence Simplification) model described in Sentence Simplification with Deep Reinforcement Learning

Datasets

The wikismall and wikilarge datasets can be downloaded on Github or on Google Drive.

8 references wikilarge development and test sets can be downloaded here https://github.com/cocoxu/simplification/tree/master/data/turkcorpus

Copyright of the newsela dataset belongs to https://newsela.com. Please contact newsela.com to obtain the dataset https://newsela.com/data/

System Output

If you are looking for system output and don't bother to install dependencies and train a model (or run a pre-trained model), the all-system-output folder is for you.

Dependencies

Note that this model is tested using an old version of torch (available here)

Train a Reinforcement Learning Simplification Model

Step 1: Train an Encoder-Decoder Attention Model

CUDA_VISIBLE_DEVICES=$ID th train.lua --learnZ --useGPU \
    --model EncDecAWE \
    --attention dot \
    --seqLen 85 \
    --freqCut 4 \
    --nhid 256 \
    --nin 300 \
    --nlayers 2 \
    --dropout 0.2 \
    --lr $lr \
    --valid $valid \
    --test $test \
    --optimMethod Adam \
    --save $model \
    --train $train \
    --validout $validout --testout $testout \
    --batchSize 32 \
    --validBatchSize 32 \
    --maxEpoch 30 \
    --wordEmbedding $wembed \
    --embedOption fineTune \
    --fineTuneFactor 0 \
    | tee $log

Details see experiments/wikilarge/encdeca/train.sh. Note in newsela and wikismall datasets, you should use --freqCut 3.

If you want to generate simplifications from a pre-trained Encoder-Decoder Attention model, use the following command:

CUDA_VISIBLE_DEVICES=3 th generate_pipeline.lua \
    --modelPath $model \
    --dataPath $data.test \
    --outPathRaw $output.test \
    --oriDataPath $oridata.test \
    --oriMapPath $orimap | tee $log.test

Details see experiments/wikilarge/encdeca/generate/run_std.sh.

Step 2: Train a Language Model for the Fluency Reward

See details in experiments/wikilarge/dress/train_lm.sh

Step 3: Train a Sequence Auto-Encoder for the Relevance Reward

Create dataset scripts/get_auto_encoder_data/gen_data.sh See details in experiments/wikilarge/dress/train_auto_encoder.sh

Step 4: Train a Reinforcement Learning Model

See details in experiments/wikilarge/dress/train_dress.sh. Run a pre-trained DRESS model using this script experiments/wikilarge/dress/generate/dress/run_std.sh.

Step 5: Train a Lexical Simplification Model

To train a lexical simplification model, you need to obtain soft word alignments in the training data, which are assigned by a pre-trained Encoder-Decoder Attention model. See details in experiments/wikilarge/dress/run_align.sh.

After you obtain the alignments, you can train a lexical simplification model using experiments/wikilarge/dress/train_lexical_simp.sh.

Lastly, you can apply the lexical simplification model with DRESS experiments/wikilarge/dress/generate/dress-ls/run_std.sh.

Pre-trained Models

https://drive.google.com/open?id=0B6-YKFW-MnbOTVRMSURFbXYxNjg

Evaluation

Please be careful about the automatic evaluation.
You can use our released code and models to produce output for different models (i.e., EncDecA, Dress and Dress-Ls). But please make sure your evaluation settings follow the settings in our paper.

BLEU

The evaluation pipeline accompanied in our code released produces single reference BLEU scores.

WikiLarge

To be consistent with previous work, you should use 8 references wikilarge test set (availabel at https://github.com/cocoxu/simplification/tree/master/data/turkcorpus)

Therefore, to get the numbers on wikilarge, you should use scripts that support multi-bleu evalution (e.g., joshua or mtevalv13a.pl).

Checkout details for BLEU evaluation of wikilarge here

FKGL

Make sure your FKGL is on corpus level.

SARI

The evaluation pipeline accompanied in our code released produces sentence-level SARI scores. You can use this simplification system (available here) to produce corpus level SARI scores.

Checkout details for SARI evaluation here

Citation

@InProceedings{D17-1063,
  author = 	"Zhang, Xingxing
		and Lapata, Mirella",
  title = 	"Sentence Simplification with Deep Reinforcement Learning",
  booktitle = 	"Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing",
  year = 	"2017",
  publisher = 	"Association for Computational Linguistics",
  pages = 	"595--605",
  location = 	"Copenhagen, Denmark",
  url = 	"http://aclweb.org/anthology/D17-1063"
}

dress's People

Contributors

louismartin avatar xingxingzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dress's Issues

Am I running the correct test file?

I try to reproduce the result (mostly for BLEU) for encoder-decoder with attention (in the paper it said 88% in BLEU), but I tried the model you provide "model_0.001.256.2L.we.full.2l.ft0.t7" with both test file in wikilarge and wikismall. I see the best result I got is from Wikilarge (which is 59.80% lower than what you reported in the paper). I wonder if I use correct test file or correct checkpoint?

`th generate_pipeline.lua --modelPath ../model_0.001.256.2L.we.full.2l.ft0.t7 --dataPath ../../text_simplification_data/train/dress/wikismall/PWKP_108016.tag.80.aner.test --outPathRaw outraw2.txt --oriDataPath ../../text_simplification_data/train/dress/wikismall/PWKP_108016.tag.80.aner.ori.test --oriMapPath ../../text_simplification_data/train/dress/wikismall/PWKP_108016.tag.80.aner.map.t7

th generate_pipeline.lua --modelPath ../model_0.001.256.2L.we.full.2l.ft0.t7 --dataPath ../../text_simplification_data/train/dress/wikilarge/wiki.full.aner.test --outPathRaw outraw2.txt --oriDataPath ../../text_simplification_data/train/dress/wikilarge/wiki.full.aner.ori.test --oriMapPath ../../text_simplification_data/train/dress/wikilarge/wiki.full.aner.map.t7`

To be honest, for now, I tried your dataset with another encoder-decoder model (Transformer, no RNN inside), which supposed to be work better at least in memory part. And I have also concerns with your model configuration:
why turn off the ignore case, I think the uppercase or lowercase makes no difference for the words in this data set?

Also based on your decode result, I also see many of short sentences (which drop performance but maybe good for FK score), the reason is wikilarge contains noisy kwoodsen data (http://homepages.inf.ed.ac.uk/kwoodsen/wiki.html#wiki-data), the data teach model to generate short sentences.

where is the glove.840B.300d.wiki.full.aner.t7 file

embedFile should be a torch object , not only the glove.840B.300d.txt file

but, where is the file?

`require 'shortcut'

local WordEmbed = torch.class('WordEmbeddingFT')

-- input should be torch7 file
function WordEmbed:__init(embedFile)
self.embed, self.word2idx, self.idx2word = unpack( torch.load(embedFile) )
xprintln('load embedding done!')
self.lowerCase = true
for _, word in ipairs(self.idx2word) do
if word ~= word:lower() then
self.lowerCase = false
end
end
print('lower case: ')
print(self.lowerCase)
end`

where are the txt data files for training auto encoders

in file train_atuo_encoder.sh

where are the files?

train=/afs/inf.ed.ac.uk/group/project/img2txt/encdec/dataset/wiki-full/norm_all/auto-encoder-data/train.txt
valid=/afs/inf.ed.ac.uk/group/project/img2txt/encdec/dataset/wiki-full/norm_all/auto-encoder-data/valid.txt
test=/afs/inf.ed.ac.uk/group/project/img2txt/encdec/dataset/wiki-full/norm_all/auto-encoder-data/test.txt

High STAR score with random sentence

Hi, I have some problems when using the STAR scripts.

I can get the correct STAR score with the DRESS output (27.37). However, when I replace the DRESS output with random sentence, it get higher STAR score (33.7).

Am I using the script correctly? Do you have similar results during the experiment?

Running source code - user-defined modules imported with 'require' not found

When trying to train an encoder decoder model with attention by calling the script experiments/wikilarge/encdeca/train.sh, I get the error message: "module 'shortcut' not found:No LuaRocks module found for shortcut", although this file does exists in utils/shortcut.lua. Do I need to compile anything in advance such that require('shortcut') and other modules will work?

License for data-set

Could you please add some open source license to the data set? e.g. Creative Commons.

Thanks!

An error training an Encoder-Decoder Attention Model

When I train an Encoder-Decoder Attention Model using "sh run_std.sh", I get the following error:

/home/qiang/torch/extra/cutorch/lib/THC/THCTensorIndex.cu:321: void indexSelectLargeIndex(TensorInfo<T, IndexType>, TensorInfo<T, IndexType>, TensorInfo<long, IndexType>, int, int, IndexType, IndexType, long) [with T = float, IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [56,0,0], thread: [63,0,0] Assertion srcIndex < srcSelectDimSize failed.
THCudaCheck FAIL file=/home/qiang/torch/extra/cutorch/lib/THC/generic/THCStorage.c line=32 error=59 : device-side assert triggered
/home/qiang/torch/install/bin/luajit: cuda runtime error (59) : device-side assert triggered at /home/qiang/torch/extra/cutorch/lib/THC/generic/THCStorage.c:32
stack traceback:
[C]: at 0x7fbc8f5b6050
[C]: in function '__index'
layers/EMaskedClassNLLCriterion.lua:18: in function 'forward'
nnets/EncDecAWE.lua:391: in function 'opfunc'
/home/qiang/torch/install/share/lua/5.1/optim/sgd.lua:44: in function 'optimMethod'
nnets/EncDecAWE.lua:468: in function 'trainBatch'
train.lua:40: in function 'train'
train.lua:162: in function 'main'
train.lua:269: in function 'main'
train.lua:272: in main chunk
[C]: in function 'dofile'
...iang/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405e90
Lock freed

Usage instructions:

To obtain and lock an id: ./gpu_lock.py --id
The lock is automatically freed when the parent terminates

To get an id that won't be freed: ./gpu_lock.py --id-to-hog
You must manually free these ids: ./gpu_lock.py --free

More info: http://homepages.inf.ed.ac.uk/imurray2/code/gpu_monitoring/

Word Embedding file miss

Could you please release .840B.300d.wiki.full.aner.t7 file? I download the pertained wiki word embedding online but it doesn't work.

Could I confirm the performance result for WikiSmall Dataset?

Based on Table 1 of your paper, I saw WikiSmall performance is much lower than WikiLarge. The table indicates three results are based on the different test set.

I know for WikiLarge, you use 8 references test set. But for WikiSmall, I wonder which test set you are using? Is it PWKP_108016.tag.80.aner.test.src/PWKP_108016.tag.80.aner.test.dst (contain 100 test sample) in WikiSmall folder?

Details on pre-processing

Hello,

Could you provide details on the pre-processing applied to the dataset? For example, which tokenizer was used (with which options)? Thank you.

Can't find cudnn.sh

Hi

Whichever .sh file I try to run doesn't run because there is no cudnn.sh file, how to get that ?

Missing module?

Shouldn't there be a module called 'utils/shortcut.lua' included as well? Thanks!

lua dependencies

Would it be possible to add a list of dependencies which need to be installed before running the code?

System Outputs on Validation Set

Hi,
I was able to find the predictions of the models in the test set, but I was wondering if you could make available the predictions of the models (or even just the best one) on the validation set.

Thanks!

Newsela Split

Hi,

I would like to clarify regarding the Newsela data setup:

  1. Am I right that the originally released data in 2015 (1,130 articles) was used in the paper? (That is, the text file in “newsela_data_share-20150302” in the Newsela release)
  2. Following the description in Section 5 by having the first 1,070 articles for training, the next 30 for development, and the next 30 for testing, followed by filtering out sentence pairs corresponding to alignment levels 0-1, 1-2, and 2-3 gave me numbers of sentence pairs that are different from the paper (94,944 training, 2,531 development, and 2,462 test sentences). How can I come up with 94,208 training sentence pairs, 1,129 development sentence pairs, and 1,076 test sentence pairs as stipulated in the paper?

Thank you.

Regards,
Christian

What's difference with SARI and STAR?

For your evaluation, I thought you use evaluation code from Joshua.
They have both SARI and STAR, could I ask is there any special reason you use STAR rather than STAR?

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.