Giter VIP home page Giter VIP logo

opennmt-kpg-release's Introduction

Keyphrase Generation (built on OpenNMT-py)

This is a repository providing code and datasets for keyphrase generation.

Update (October 2022)

Release the resources of paper General-to-Specific Transfer Labeling for Domain Adaptable Keyphrase Generation.

All datasets and selected model checkpoints in the papers can be downloaded from Huggingface Hub (data and ckpt). Config files can be found at script/.

For example, you can start training a Transformer model on KP20k using OpenNMT:

CUDA_VISIBLE_DEVICES=0 python train.py -config config/transfer_kp/train/transformer-presabs-kp20k.yml

To train a BART model on KP20k using fairseq-kpg, vocab can be downloaded here:

cd $FAIRSEQ_DIR
CUDA_VISIBLE_DEVICES=0 python train.py data/kp/json/kp20k/ --save-dir exps/kp/bartFT_presabs_kp20k_100k_rerun/ckpts --disable-validation --task keyphrasification --max-source-length 512 --max-target-length 128 --kp-concat-type pres_abs --arch bart_large --restore-file cache/bart.large/model.pt --bpe hf_pretrained_bpe --bpe-vocab hf_vocab/roberta-base-kp/vocab.json --bpe-merges hf_vocab/roberta-base-kp/merges.txt --dict-path hf_vocab/roberta-base-kp/dict.txt --bpe-dropout 0.0 --ddp-backend=no_c10d --criterion label_smoothed_cross_entropy --share-all-embeddings --layernorm-embedding --share-all-embeddings --share-decoder-input-output-embed --reset-optimizer --reset-dataloader --reset-meters --required-batch-size-multiple 1 --optimizer adam --adam-betas (0.9,0.999) --adam-eps 1e-08 --clip-norm 0.1 --lr 1e-5 --update-freq 8 --lr-scheduler polynomial_decay --label-smoothing 0.1 --dropout 0.1 --attention-dropout 0.1 --weight-decay 0.01 --log-format simple --log-interval 100 --fixed-validation-seed 7 --max-tokens 1024 --save-interval-updates 5000 --warmup-updates 10000 --total-num-update 100000 --num-workers 4 --find-unused-parameters --fp16 --ddp-backend=no_c10d --wandb-project kp-project

Update (April 2022)

Several pretrained checkpoints are available at Huggingface model repos.

Two examples:

  • Run kpg inference with Huggingface Transformers
CUDA_VISIBLE_DEVICES=0 python onmt/keyphrase/run_infer_hfkpg.py --config_name memray/bart_wikikp --model_name_or_path memray/bart_wikikp --tokenizer_name memray/bart_wikikp --dataset_name midas/duc2001 --do_predict --output_dir kp_output/duc2001/ --overwrite_output_dir --per_device_eval_batch_size 8 --predict_with_generate --text_column document --keyphrase_column extractive_keyphrases --source_prefix <present>10<header>5<category>5<seealso>2<infill>0<s> --num_beams 5 --generation_max_length 60
  • Run kpg inference with OpenNMT-kpg (parameters are hard-coded)
CUDA_VISIBLE_DEVICES=0 python onmt/keyphrase/kpg_example_hfdatasets.py

Update (Jan 2022)

Merged with OpenNMT v2 and integrated a new pre-processing pipeline. Now training/inference can directly load JSON data from disk, without any hassle of tokenization or conversion to tensor files. Please check out Huggingface repo for all resources. - Paper datasets and DUC: KP20k/Inspec/Krapivin/NUS/SemEval2010/DUC2001. - 4 large annotated datasets: KP20k, OpenKP, KPTimes+JPTimes, StackExchange.

Some config examples can be of help for you to kick off:

  • Configs using RoBERTa subword tokenization. Vocab (including merges.txt/vocab.json/tokenizer.json) can be found here.
  • Configs using word tokenization. Vocab (magkp20k.vocab.json, 50k most frequent words in KP20k and MagKP) can be found here.

Please note that hf_vocab.tar.gz contains the vocab of subword tokenization (RoBERTa vocab with some new special tokens such as ), and magkp20k.vocab.json is for previous word tokenization based models (top 50k frequent words in magcs and kp20k).

Quickstart

All the config files used for training and evaluation can be found in folder config/. For more examples, you can refer to scripts placed in folder script/.

Train a One2Seq model

python train.py -config config/transfer_kp/train/transformer-presabs-kp20k.yml

Train a One2One model

python train.py -config config/transfer_kp/train/transformer-one2one-kp20k.yml

Run generation and evaluation

# beam search (beamwidth=50)
python kp_gen_eval_transfer.py -config config/transfer_kp/infer/keyphrase-one2seq.yml -tasks pred eval -data_dir kp/data/kp/json/ -exp_root_dir kp/exps/transformer_exp_devbest/ -gpu 0 -batch_size 16 -beam_size 50 -max_length 40 -testsets kp20k openkp kptimes jptimes stackex kp20k_valid2k openkp_valid2k kptimes_valid2k jptimes_valid2k stackex_valid2k duc -splits test --data_format jsonl -gpu 0

# greedy decoding (beamwidth=1)
python kp_gen_eval_transfer.py -config config/transfer_kp/infer/keyphrase-one2seq.yml -tasks pred eval -data_dir kp/data/kp/json/ -exp_root_dir kp/exps/transformer_exp_devbest/ -gpu 0 -batch_size 16 -beam_size 1 -max_length 40 -testsets kp20k openkp kptimes jptimes stackex kp20k_valid2k openkp_valid2k kptimes_valid2k jptimes_valid2k stackex_valid2k duc -splits test --data_format jsonl -gpu 0

Evaluation and Datasets

You may refer to notebook/json_process.ipynb to have a glance at the pre-processing.

We follow the data pre-processing and evaluation protocols in Meng et al. 2017. We pre-process both document texts and ground-truth keyphrases, including word segmentation, lowercasing and replacing all digits with symbol <digit>.

We manually clean the data examples in the valid/test set of KP20k (clean noisy text, replace erroneous keyphrases with actual author keyphrases, remove examples without any ground-truth keyphrases) and use scripts to remove invalid training examples (without any author keyphrase).

We evaluate models' performance on predicting present and absent phrases separately. Specifically, we first tokenize, lowercase and stem (using the Porter Stemmer of NLTK) the text, then we determine the presence of each ground-truth keyphrase by checking whether its words can be found verbatim in the source text.

To evaluate present phrase performance, we compute Precision/Recall/F1-score for each document taking only present ground-truth keyphrases as target and ignore the absent ones. We report the macro-averaged scores over documents that have at least one present ground-truth phrases (corresponding to the column #PreDoc in the Table below, and similarly to the case of absent phrase evaluation.

metrics

where #(pred) and #(target) are the number of predicted and ground-truth keyphrases respectively; and #(correct@k) is the number of correct predictions among the first k results.

We clarify that, since our study mainly focuses on keyword/keyphrase extraction/generation on short text, we only used the abstract of Semeval and NUS as source text. Therefore statistics like #PreKP may be different from the ones computed with fulltext, which also affect the final F1-scores. For the ease of reproduction, we post the detailed statistics in the following table and processed testsets with present/absent phrases split can be found in the released data (e.g. data/json/kp20k/kp20k_test_meng17token.json).

Dataset #Train #Valid #Test #KP #PreDoc #PreKP #AbsDoc #AbsKP
KP20k 514k 19,992 19,987 105,181 19,048 66,595 16,357 38,586
Inspec -- 1,500 500 4,913 497 3,858 381 1,055
Krapivin -- 1,844 460 2,641 437 1,485 417 1,156
NUS -- - 211 2,461 207 1,263 195 1,198
Semeval -- 144 100 1,507 100 671 99 836
StackEx 298k 16,000 16,000 43,131 13,475 24,809 10,984 18,322
DUC -- -- 308 2,484 308 2,421 38 63

Contributers

Major contributors are:

Citation

Please cite the following papers if you are interested in using our code and datasets.

@article{meng2022general2specific,
  title={General-to-Specific Transfer Labeling for Domain Adaptable Keyphrase Generation},
  author={Meng, Rui and Wang, Tong and Yuan, Xingdi and Zhou, Yingbo and He, Daqing},
  journal={arXiv preprint arXiv:2208.09606},
  year={2022}
}
@inproceedings{meng2021empirical,
  title={An Empirical Study on Neural Keyphrase Generation},
  author={Meng, Rui and Yuan, Xingdi and Wang, Tong and Zhao, Sanqiang and Trischler, Adam and He, Daqing},
  booktitle={Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
  pages={4985--5007},
  year={2021}
}
@article{yuan2018onesizenotfit,
  title={One Size Does Not Fit All: Generating and Evaluating Variable Number of Keyphrases},
  author={Yuan, Xingdi and Wang, Tong and Meng, Rui and Thaker, Khushboo and He, Daqing and Trischler, Adam},
  booktitle={Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},
  url={https://arxiv.org/pdf/1810.05241.pdf},
  year={2020}
}
@article{meng2019ordermatters,
  title={Does Order Matter? An Empirical Study on Generating Multiple Keyphrases as a Sequence},
  author={Meng, Rui and Yuan, Xingdi and Wang, Tong and Brusilovsky, Peter and Trischler, Adam and He, Daqing},
  journal={arXiv preprint arXiv:1909.03590},
  url={https://arxiv.org/pdf/1909.03590.pdf},
  year={2019}
}
@inproceedings{meng2017kpgen,
  title={Deep keyphrase generation},
  author={Meng, Rui and Zhao, Sanqiang and Han, Shuguang and He, Daqing and Brusilovsky, Peter and Chi, Yu},
  booktitle={Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  pages={582--592},
  url={https://arxiv.org/pdf/1704.06879.pdf},
  year={2017}
}

opennmt-kpg-release's People

Contributors

adamlerer avatar apaszke avatar bmccann avatar bpopeters avatar colesbury avatar da03 avatar flauted avatar francoishernandez avatar guillaumekln avatar gwenniger avatar helson73 avatar jianyuzhan avatar jsenellart avatar justinchiu avatar memray avatar meocong avatar pltrdy avatar scarletpan avatar sebastiangehrmann avatar soumith avatar srush avatar taolei87 avatar tayciryahmed avatar thammegowda avatar vince62s avatar waino avatar wjbianjason avatar xingdi-eric-yuan avatar xutaima avatar zenglinxiao 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

opennmt-kpg-release's Issues

Problem with generating kephrases (inference.ipynb file)

Hello
I have a problem with generating keyphrases for single text

Traceback (most recent call last):
  File "/home/***/PycharmProjects/OpenNMT-kpg-release/notebook/inference.py", line 69, in <module>
    opt=opt
  File "/home/***/PycharmProjects/OpenNMT-kpg-release/onmt/translate/translator.py", line 396, in translate
    for batch in data_iter:
  File "/home/***/PycharmProjects/OpenNMT-kpg-release/onmt/inputters/inputter.py", line 972, in __iter__
    self.init_epoch()
  File "/home/***/anaconda3/envs/torch17/lib/python3.7/site-packages/torchtext/data/iterator.py", line 117, in init_epoch
    self.create_batches()
  File "/home/***/PycharmProjects/OpenNMT-kpg-release/onmt/inputters/inputter.py", line 960, in create_batches
    b = keyphrase_dataset.process_multiple_tgts(b, self.dataset.tgt_type)
  File "/home/***/PycharmProjects/OpenNMT-kpg-release/onmt/inputters/keyphrase_dataset.py", line 370, in process_multiple_tgts
    order = obtain_sorted_indices(ex.src, ex.tgt, sort_by=tgt_type)
AttributeError: 'Example' object has no attribute 'tgt'

Process finished with exit code 1

PermissionError and ValueError

Hi
When I run python train.py -config config/train/config-rnn-keyphrase-one2seq-diverse.yml , there is an error:

Traceback (most recent call last): File "train.py", line 6, in <module> main() File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 274, in main train(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 32, in train train_single._check_save_model_path(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/train_single.py", line 54, in _check_save_model_path os.makedirs(opt.wandb_log_dir) File "/home/yons/anaconda3/lib/python3.7/os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/logs/'

I found there is no wandb_log_dir in file config-rnn-keyphrase-one2seq-diverse.yml, so I deleted code about wandb in train_single.py. Can I do that?

After I deleted code about wandb in train_single.py, the error mentioned above does not appear. But there is another error:

Traceback(most recent call last): File "train.py", line 6, in <module> main() File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 274, in main train(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 126, in train train_iter = build_dataset_iter(shard_base, fields, opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/inputters/inputter.py", line 1220, in build_dataset_iter raise ValueError('Training data %s not found' % opt.data) ValueError: Training data data/keyphrase/meng17/kp20k not found

I dont't know why does it goes wrong when kp20k exists in data/keyphrase/meng17. Could you tell me what I should do? Thank you!

batch absent_exact P/R/F1/Corr @50

When I am running your provided example for generation and evaluation, I got the results like this:
batch absent_exact P/R/F1/Corr @50 = 0 0 0 0
How to reproduce your success in your paper? Thanks!
image

kp_convert.sh

line 13 in kp_convert.sh
"-max_tgt_seq_length 8 -min_src_seq_length 1"
should be "-max_tgt_seq_length 8 -min_tgt_seq_length 1"?

Training data

Hi
When I run python train.py -config config/train/config-rnn-keyphrase-one2seq-diverse.yml , there is an error:

Traceback (most recent call last): File "train.py", line 6, in <module> main() File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 274, in main train(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 32, in train train_single._check_save_model_path(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/train_single.py", line 54, in _check_save_model_path os.makedirs(opt.wandb_log_dir) File "/home/yons/anaconda3/lib/python3.7/os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/logs/'

I found there is no wandb_log_dir in file config-rnn-keyphrase-one2seq-diverse.yml, so I deleted code about wandb in train_single.py. Can I do that?

After I deleted code about wandb in train_single.py, the error mentioned above does not appear. But there is another error:

Traceback (most recent call last): File "train.py", line 6, in <module> main() File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 274, in main train(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 126, in train train_iter = build_dataset_iter(shard_base, fields, opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/inputters/inputter.py", line 1220, in build_dataset_iter raise ValueError('Training data %s not found' % opt.data) ValueError: Training data data/keyphrase/meng17/kp20k not found

I found according to code in inputters.py, training data will match:
data/keyphrase/meng17/kp20k.train[0-9][string].pt
data/keyphrase/meng17/kp20ktrain[0-9][string].pt
data/keyphrase/meng17/kp20k.train[0-9][string].jsonl
and so on.

But there is no pt file or jsonl file in data/keyphrase/meng17/kp20k. There is only src and tgt files in the directory.

What data should I use for training?

Training from existing model

I am trying to train my data starting from an existing top-kp20k checkpoints.
I have set train_from to "kp20k-meng17-random-rnn-BS64-LR0.05-Layer1-Dim150-Emb100-Dropout0.0-Copytrue-Reusetrue-Covtrue-PEfalse-Contboth-IF1_step_90000.pt" and remaining config same as "config-rnn-keyphrase-one2seq-diverse".
I am getting this error when trying to start the training:

  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1448, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/OpenNMT-kpg-release/train.py", line 212, in <module>
    main(opt)
  File "D:/OpenNMT-kpg-release/train.py", line 98, in main
    single_main(opt, 0)
  File "D:\OpenNMT-kpg-release\onmt\train_single.py", line 110, in main
    optim = Optimizer.from_opt(model, opt, checkpoint=checkpoint)
  File "D:\OpenNMT-kpg-release\onmt\utils\optimizers.py", line 277, in from_opt
    optimizer.load_state_dict(optim_state_dict)
  File "D:\OpenNMT-kpg-release\onmt\utils\optimizers.py", line 305, in load_state_dict
    self._optimizer.load_state_dict(state_dict['optimizer'])
  File "C:\Users\Mohit\anaconda3\envs\venv\lib\site-packages\torch\optim\optimizer.py", line 123, in load_state_dict
    raise ValueError("loaded state dict contains a parameter group "
ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group

How can I start training my data from an existing top model?

About Transformer performance

Hi Memray,
Thanks for sharing the source code ! It's really helpful !
I'd like to know that whether you have tried Transformer ? And how about the performance of Transformer with copy mechanism ?

Missing model files

data.zip doesn't have the models/checkpoints (as specified in the readme)

Running the translator method on string fails (similar approach as notebook/inference.ipynb)

I am trying to run the pretrained weights for keyphrase extraction on string, trying to follow the example from inference.ipynb. I kept all the parameters as same in the jupiter notebook, besides explicitly passing the text_to_extract as defined below. I downloaded the pretrained weights from the link in the readme.

Running the method:

text_to_extract="Anything that threatens a company's ability to meet its target or achieve its financial goals is called business risk. These risks come from a variety of sources, so it's not always the company head or a manager who's to blame. Instead, the risks may come from other sources within the firm or they may be external—from regulations to the overall economy. While a company may not be able to shelter itself from risk completely, there are ways it can help protect itself from the effects of business risk, primarily by adopting a risk management strategy"

scores, predictions = translator.translate(
src=[text_to_extract],tgt=None,src_dir=opt.src_dir,batch_size=opt.batch_size,attn_debug=opt.attn_debug,opt=opt)

Error:
It looks like the translator method can only accept json files since it uses keyphrase_dataset.py for reading the input rather than datareader_base.py

Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/home/ayush/OpenNMT-kpg-release/onmt/translate/translator.py", line 335, in translate
    filter_pred=self._filter_pred
  File "/home/ayush/OpenNMT-kpg-release/onmt/inputters/keyphrase_dataset.py", line 92, in __init__
    for ex_dict in starmap(_join_dicts, zip(*read_iters)):
  File "/home/ayush/OpenNMT-kpg-release/onmt/inputters/keyphrase_dataset.py", line 155, in read
    json_line = json_line.decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'

What's the best approach to run the pretrained weights on input string ?

Report an error

Hi Meng,
I encountered the following issue when I ran the evaluation commands ( python kp_gen_eval.py -tasks pred eval report -config config/test/config-test-keyphrase-one2seq.yml -data_dir data/keyphrase/meng17/ -ckpt_dir models/keyphrase/meng17-one2seq-kp20k-topmodels/ -output_dir output/meng17-one2seq-topbeam-selfterminating/meng17-one2many-beam10-maxlen40/ -testsets duc inspec semeval krapivin nus -gpu -1 --verbose --beam_size 10 --batch_size 32 --max_length 40 --onepass --beam_terminate topbeam --eval_topbeam).

[2021-04-22 03:11:54,383 ERROR] Error while translating
Traceback (most recent call last):
File "kp_gen_eval.py", line 196, in
opt=opt
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/translate/translator.py", line 362, in translate
filter_pred=self._filter_pred
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/inputters/keyphrase_dataset.py", line 197, in init
ex_dict, src_base_field, tgt_base_field)
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/inputters/dataset_base.py", line 43, in _dynamic_dict
src = src_field.tokenize(example["src"])
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/inputters/text_dataset.py", line 63, in _feature_tokenize
tokens = string.split(tok_delim)
AttributeError: 'dict' object has no attribute 'split'

Can you please help to address this issue?

Scoring question

Thanks to great work!

I have one question about your paper. Your paper uses below formula.
image

I understood length of Intersection that formula, but your released code uses list as metrics not set.

for pred_id, pred_seq in enumerate(pred_seqs):
        if type == 'exact':
            match_score[pred_id] = 0
            for true_id, true_seq in enumerate(tgt_seqs):
                match = True
                if len(pred_seq) != len(true_seq):
                    continue
                for pred_w, true_w in zip(pred_seq, true_seq):
                    # if one two words are not same, match fails
                    if pred_w != true_w:
                        match = False
                        break
                # if every word in pred_seq matches one true_seq exactly, match succeeds
                if match:
                    match_score[pred_id] = 1
                    break

Some examples to explain my question.

preds = ['hello world', 'cute rabbit', 'cute rabbit', 'fast train']
targets = ['cute rabbit']

According to your code, The length corresponding to the intersection is 2. However, the actual intersection should be 1, not a list.

Is it right to follow this code to reimplement the performance of your paper?

AttributeError: module 'torchtext.data' has no attribute 'Iterator'

i use pytorch 1.11 and therefore torchtext 0.12
in this new version of torchtext, torchtext.data.Iterator dose not exist
so i don,t know what i have to do to run the code:
CUDA_VISIBLE_DEVICES=0 python onmt/keyphrase/kpg_example_hfdatasets.py
note that i m almost beginner in python

PermissionError: [Errno 13] Permission denied: '/logs/'

When I am training a One2Seq model with Diversity Mechanisms enabled by python train.py -config config/train/config-rnn-keyphrase-one2seq-diverse.yml , there is an error:
Traceback (most recent call last): File "train.py", line 6, in <module> main() File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 274, in main train(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/bin/train.py", line 32, in train train_single._check_save_model_path(opt) File "/home/yons/OpenNMT-kpg-release-new/onmt/train_single.py", line 55, in _check_save_model_path os.makedirs(opt.wandb_log_dir) File "/home/yons/anaconda3/lib/python3.7/os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/logs/'
Could you tell me what I should do?

what's the full name of 'magkp'?

Hi,
I noticed in your preprocessing scripts, there is a kind of data called 'magkp'.

I guess it means one2many? but I can not get the full name. I was wondering what the full name of it.
Thanks!

Don't run project

I have a issue when i run this repos,
I don't run step training seq2seq , and an issue 👍
File "train.py", line 104, in main
single_main(opt, -1)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/train_single.py", line 165, in main
valid_steps=opt.valid_steps)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/trainer.py", line 265, in train
valid_iter, moving_average=self.moving_average)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/trainer.py", line 323, in validate
_, batch_stats = self.valid_loss(batch, outputs, attns, model=valid_model)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/utils/loss.py", line 187, in call
loss, stats = self._compute_loss(batch, **shard_state)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/modules/copy_generator.py", line 266, in _compute_loss
semcov_ending_state=self.semcov_ending_state)
File "/home/lethanhloi/PycharmProjects/keyphrase_project/OpenNMT-kpg-release/onmt/utils/loss.py", line 461, in _compute_semantic_coverage_loss
neg_idx = np.random.randint(0, batch_size-1, size=(n_sep * n_neg))
File "mtrand.pyx", line 746, in numpy.random.mtrand.RandomState.randint
File "_bounded_integers.pyx", line 1254, in numpy.random._bounded_integers._rand_int64
ValueError: low >= high

question about reproduction

I have run the evaluation for your trained model with the command provided in the readme file, and noticed that in all result csv files present_exact_f_score@5 and present_exact_f_score@10 are completely the same. I wonder if those are reasonable? if so, how can I reproduce the result shown in Table 1 of the 'paper Does Order Matter? An Empirical Study on Generating Multiple Keyphrases as a Sequence'?

about install

Hi,
There is a setup.py file in the project. Is this project available for installation?If you import, do you use the import OpenNMT_py statement?

AttributeError: 'NoneType' object has no attribute 'close'

Hi Rui,
I am running the command below:
CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py -config config/train/config-rnn-keyphrase-one2seq-diverse.yml
Have you encountered this error and do you know how to solve it?

[2019-11-15 06:59:48,581 INFO] number of examples: 100000
[2019-11-15 07:01:43,754 INFO] Step 100000/100000; acc: 60.37; ppl: 5.19; xent: 1.65; lr: 0.00002; 14635/1246 tok/s; 213352 sec
Process SpawnProcess-3:
Traceback (most recent call last):
File "train.py", line 212, in
main(opt)
File "train.py", line 94, in main
p.join()
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/multiprocessing/process.py", line 124, in join
res = self._popen.wait(timeout)
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/multiprocessing/popen_fork.py", line 50, in wait
Traceback (most recent call last):
File "/home/diaoshizhe/OpenNMT-py/train.py", line 154, in run
single_main(opt, device_id, batch_queue, semaphore)
File "/home/diaoshizhe/OpenNMT-py/onmt/train_single.py", line 164, in main
trainer.report_manager.tensorboard_writer.close()
AttributeError: 'NoneType' object has no attribute 'close'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/diaoshizhe/OpenNMT-py/train.py", line 160, in run
error_queue.put((opt.gpu_ranks[device_id], traceback.format_exc()))
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/traceback.py", line 167, in format_exc
return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/traceback.py", line 121, in format_exception
type(value), value, tb, limit=limit).format(chain=chain))
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/traceback.py", line 612, in format
yield from self.format_exception_only()
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/traceback.py", line 567, in format_exception_only
yield _format_final_exc_line(stype, self._str)
return self.poll(os.WNOHANG if timeout == 0.0 else 0)
KeyboardInterrupt
File "/home/diaoshizhe/anaconda3/envs/pt11p36/lib/python3.6/multiprocessing/popen_fork.py", line 28, in poll
pid, sts = os.waitpid(self.pid, flag)
File "train.py", line 196, in signal_handler
raise Exception(msg)
Exception:

-- Tracebacks above this line can probably
be ignored --

Traceback (most recent call last):
File "/home/diaoshizhe/OpenNMT-py/train.py", line 154, in run
single_main(opt, device_id, batch_queue, semaphore)
File "/home/diaoshizhe/OpenNMT-py/onmt/train_single.py", line 164, in main
trainer.report_manager.tensorboard_writer.close()
AttributeError: 'NoneType' object has no attribute 'close'

Thanks!
image

Can't find magkp20k.vocab.pt

I downloaded the recently updated code and ran it. I can run ·source kp_convert.sh successfully. But when I run python preprocess.py -config config/preprocess/config-preprocess-keyphrase-kp20k.yml , it reported a error : AssertionError: Please check path of your src vocab!。 It seems like The src_vocab address is specified in the yml file, but there is no magkp20k.vocab.pt file at that address (data/keyphrase/meng17/magkp20k.vocab.pt) . Should I use data/keyphrase/meng17/kp20k.vocab.pt or What else should I do?

Pump torchtext from 0.8 to 0.12

Dear authors.

omnt.inputters is using legacy 0.8 torchtext.data.Field , not available anymore in 0.12, which causes errors.

  1. Do you advice I downgrade to 0.8. reqruiement.txt has no specification but looking at the code its required to go to legacy.
  2. Making changes seem to be complicated, but can attempt and push for a PR, if i get the support, considering the many models/datasets uses.

Thoughts?!

Real train & eval dataset statistics

Hi~ @memray.

I'm confused something in preprocessing. It shows different to statistics in this and in each training and evaluation phase by max document length. Is that right to differ between statistics of dataset before preprocessing and after preprocessing? Then it requires to show real dataset statistics after preprocessing.

This function drops document longer than max length.

inputters.filter_example, use_src_len=opt.data_type == "text",

inputter implementations.

def filter_example(ex, use_src_len=True, use_tgt_len=True,

# Confused for the experiment setting of transformer

Hi memray~
I have questions about the setting of transformer:

  1. Which config file is related to the transformer arch in your paper "Does order matter"?
  2. Do you have pretrained transformer model for releasing?

Thanks for your help~

Error occurs when run preprocess.py

Hi,
I encounter the following error when I ran:

python preprocess.py -config config/preprocess/config-preprocess-keyphrase-kp20k.yml

wandb: WARNING W&B installed but not logged in. Run wandb login or set the WANDB_API_KEY env variable.
[2021-04-19 04:33:33,536 INFO] Extracting features...
[2021-04-19 04:33:33,537 INFO] * number of source features: 0.
[2021-04-19 04:33:33,537 INFO] * number of target features: 0.
[2021-04-19 04:33:33,537 INFO] Building Fields object...
[2021-04-19 04:33:33,537 INFO] Building & saving training data...
[2021-04-19 04:33:33,537 INFO] Using existing vocabulary...
[2021-04-19 04:33:35,631 INFO] Building shard 0.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/bin/preprocess.py", line 70, in process_one_shard
filter_pred=filter_pred
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/inputters/keyphrase_dataset.py", line 164, in init
self.dataset_type = infer_dataset_type(dirs[0])
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/inputters/keyphrase_dataset.py", line 60, in infer_dataset_type
'Accecpted values:' + KP_DATASET_FIELDS.keys()
TypeError: must be str, not dict_keys
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "preprocess.py", line 6, in
main()
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/bin/preprocess.py", line 310, in main
preprocess(opt)
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/bin/preprocess.py", line 290, in preprocess
'train', fields, src_reader, tgt_reader, align_reader, opt)
File "/home/bingyang/keyphrase/transformer_gan/OpenNMT-kpg/onmt/bin/preprocess.py", line 217, in build_save_dataset
for sub_counter in p.imap(func, shard_iter):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 735, in next
raise value
TypeError: must be str, not dict_keys

I wonder if the processed data (*.pt) for magkp can be provided like kp20k.

Train configuration file does not exitst

Hi @memray ,

  1. just start with your code. I found that config/transfer_kp/train does not exist! I created it and copied transformer-presabs-kp20k.yml from here. Is it the same?

python train.py -config config/transfer_kp/train/transformer-presabs-kp20k.yml

  1. I run the code on a multi-gpu machine and I want to use only 1 (e.g. GPU number 1), I specified gpu_ranks: 1 but It does not work. I checked and I have to set the world_size=2>gpu_ranks. Is gpu rank = gpu id ? and world_size = number of available gpu on the machine ?

question about dataset

Hi Memray,
I noticed that in the kp20k_test.tgt, examples are in the following format:
{"keywords": ["feedback vertex set", "decycling set", "2-degenerate graphs"], "id": "0", "tgt": ["feedback vertex set", "decycling set", "2 degenerate graphs"]}

I was wondering what's the difference bewteen keywords and tgt?
Which one are you using?
Thanks!

Is this project still working?

I am having many issues.

  1. In newer torchtext (torchtext.data -> torchtext.legacy.data)
  2. All the config files have data folder something like data/keyphrase/------ but original data uploaded on the drive has a different flow
  3. Due to a huge number of config files, it's very confusing where should I start.

Any comments from the developers would be highly appreciated.

About the statistics of present/absent keyphrase

Hi~
I see in your paper Deep Keyphrase Generation you give proportion of the present keyphrases and absent keyphrases in four public datasets:
image
This result is different from the table in README. I also calculated the proportion based on the data you provided and get another number.
I want to know how to get the correct result and how you defined present/absent keyphrase(only on testset? only present in abstract? after stemming?). Thank you !

Question about exact-matching between predicted and groundtruth keyphrases

Hi,

I have a question about how the exact-matching is computed between two keyphrases in this function:

def compute_match_scores(tgt_seqs, pred_seqs, do_lower=True, do_stem=True, type='exact'):

for example: predicted k1= "data mining course" , groundtruth k2="data mining projects" in this case, both K1 and K2 are not exact matching (i.e, score=0 no matching at all) or it will be 2 correct-words out of 3?

Thanks,

How to use Bart model in OPenNMT

Hi,
I'm trying to use the bart model in the model package. Is there any .yml file with bart to use ? Because currently I just simply change the transformer-one2one-kp20k.yml to bart but there is a debug shows after I change the generator in bart as Copygenrator (well,the original generator in bart is Sequential, but I want to use copy_attn so I changed the generator to copygenerator)

  File "/code/OpenNMT/train.py", line 10, in <module>
    main()
  File "/code/OpenNMT/onmt/bin/train.py", line 209, in main
    train(opt)
  File "/code/OpenNMT/onmt/bin/train.py", line 195, in train
    train_process(opt, device_id=0)
  File "/code/OpenNMT/onmt/train_single.py", line 114, in main
    trainer.train(
  File "/code/OpenNMT/onmt/trainer.py", line 271, in train
    res = self._gradient_accumulation(
  File "/code/OpenNMT/onmt/trainer.py", line 467, in _gradient_accumulation
    if self.model.decoder.state is not None:
  File "/anaconda3/envs/copyrnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 778, in __getattr__
    raise ModuleAttributeError("'{}' object has no attribute '{}'".format(
torch.nn.modules.module.ModuleAttributeError: 'BARTDecoder' object has no attribute 'state'```

How to run model on GPU?

I ran 'python train.py -config config/train/config-rnn-keyphrase-one2seq-diverse.yml', but the model was training on cpu.
[2020-07-12 08:39:48,866 INFO] encoder: 5199350
[2020-07-12 08:39:48,866 INFO] decoder: 8123008
[2020-07-12 08:39:48,866 INFO] * number of parameters: 13322358
[2020-07-12 08:39:49,071 INFO] Starting training on CPU, could be very slow

R@50 computation for absent keyphrase generation

Hi, I have a quick question to understand how R@50 is computed. If I understand correctly, the ACL2020 paper uses One2Seq style generation (with a beam size of 10). Duplicate keyphrases are removed after stemming, so I am confused that how 50 keyphrases can be generated such that we can compute R@50? If a model does not generate 50 keyphrases, what is the point of computing R@50?

Also when beam decoding is used, I wonder does the final prediction consists of 10 concatenated sequences of keyphrases? or only the best prediction (e.g., n_best = 1) sequence is evaluated?

Report an error

Hi Meng,
I just found that the tgt_type supported in opt.py is mismatched with that used here.

Can you please address it? Thanks in advance.

about data source

Hi, memray, can you give more details about the data source? (e.g. which web site does the abstracts in kp20k/semeval/.. come from? ) I find that the results of some test datasets (e.g. semeval, inspec) is relatively worse than others, I feel that there may be differences in data distribution. What do you think of this problem?

Confusion of single-word phrase

Hi, thanks for your great work Deep Keyphrase Generation
I was really confused about the statement in section 4.3:

In the generation of keyphrases, we find that the model tends to assign higher probabilities for shorter keyphrases, whereas most keyphrases contain more than two words. To resolve this problem, we apply a simple heuristic by preserving only the first single-word phrase and removing the rest.
What does that mean "preserve only the first single-word"?
Is it a post-processing step?
Could you give an example?
Thanks so much!

Run the model on Custom Text

Great work. Thank you.

The question is

"What are the steps to get keyphrase for the custom text?" For eg: Some parameters where I could enter my text and the resulting output are the keyphrases or any other way by which I could insert custom documents.

Inference Script

In the Inference.ipynb notebook, one of the modules requires is kp_inference.py in the keyphrases directory, however that file is missing from the source. Is the code in the file going to be similar to the kp_evaluation.py, and if not, can it be uploaded?

Thanks.

Potential bug?

I found that in ./onmt/inputters/inputter.py line 854

    if opt.**model_dtype** == "keyphrase":
        batch_fn = keyphrase_dataset.max_tok_len

model_dtype = 'fp32' and model_type='keyphrase'
So I guess it should be :

    if opt.**model_type** == "keyphrase":
        batch_fn = keyphrase_dataset.max_tok_len

RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #3 'other' in call to _th_ior_

Hi - When running the eval script presented in the README I get the above error -stacktrace below.

var = torch.tensor(arr, dtype=self.dtype, device=device) Translating 32/308 Traceback (most recent call last): File "kp_gen_eval.py", line 164, in <module> opt=opt File "/home/ari/DKG/OpenNMT-kpg-release/onmt/translate/translator.py", line 372, in translate batch, data.src_vocabs, attn_debug File "/home/ari/DKG/OpenNMT-kpg-release/onmt/translate/translator.py", line 593, in translate_batch return_attention=attn_debug or self.replace_unk) File "/home/ari/DKG/OpenNMT-kpg-release/onmt/translate/translator.py", line 766, in _translate_batch beam.update_finished(last_step=(step+1==max_length)) File "/home/ari/DKG/OpenNMT-kpg-release/onmt/translate/beam_search.py", line 217, in update_finished self.top_beam_finished |= self.is_finished[:, 0].eq(1) RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #3 'other' in call to _th_ior_

Are documents without present target keywords used in evaluation?

Hi,

I couldn't find this info in the paper, but am I correct to assume that the documents without any present target keywords (i.e., documents with just absent keywords) are not used in the final averaged f1 score calculation when measuring how well does the model predict present keywords? And also the other way around, documents containing just present keywords are not used when measuring how well does the model predict absent keywords, right? The function 'summarize_score' in kp_evaluate.py would imply that?

Error in inference.ipynb, when loading pre-trained model

Hi,

I am trying to use a pre-trained model from the model.zip, namely,
kp20k-meng17-verbatim_append-rnn-BS64-LR0.05-Layer1-Dim150-Emb100-Dropout0.0-Copytrue-Reusetrue-Covtrue-PEfalse-Contboth-IF1_step_50000.pt

I got an error when running the inference notebook example
https://github.com/memray/OpenNMT-kpg-release/blob/master/notebook/inference.ipynb

one2seq_ckpt_path = '../models/kp20k-meng17-verbatim_append-rnn-BS64-LR0.05-Layer1-Dim150-Emb100-Dropout0.0-Copytrue-Reusetrue-Covtrue-PEfalse-Contboth-IF1_step_50000.pt'

opt, unknown = parser.parse_known_args('-config %s' % (config_path))

#opt = parser.parse_args('-config %s' % (config_path))
setattr(opt, 'models', [one2seq_ckpt_path])

translator = translator.build_translator(opt, report_score=False)

Got error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_17673/2277166719.py in <module>
      6 setattr(opt, 'models', [one2seq_ckpt_path])
      7 
----> 8 translator = translator.build_translator(opt, report_score=False)

/data/OpenNMT-kpg-release/onmt/translate/translator.py in build_translator(opt, report_score, logger, out_file)
     42         else onmt.model_builder.load_test_model
     43     )
---> 44     fields, model, model_opt = load_test_model(opt)
     45 
     46     # (deprecated after dynamic data loading) added by @memray, ignore alignment field during testing for keyphrase task

/data/OpenNMT-kpg-release/onmt/model_builder.py in load_test_model(opt, model_path)
     90                             map_location=lambda storage, loc: storage)
     91 
---> 92     if opt.fairseq_model:
     93         # load a Fairseq-trained model, such as BART
     94         tokenizer = None

AttributeError: 'Namespace' object has no attribute 'fairseq_model'

Can you please help me to run a pretrained model to generate keyphrases from text?

IndexError?

Hello,

I performed one2seq training after the preprocessing, used the 'config-rnn-keyphrase-one2seq-debug.yml'.
but I encountered the following error.


...
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:658: indexSelectLargeIndex: block: [11,0,0], thread: [125,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:658: indexSelectLargeIndex: block: [11,0,0], thread: [126,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:658: indexSelectLargeIndex: block: [11,0,0], thread: [127,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
Traceback (most recent call last):
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/trainer.py", line 397, in _gradient_accumulation
    model=self.model
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 188, in __call__
    loss, stats = self._compute_loss(batch, **shard_state)
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 383, in _compute_loss
    semcov_ending_state=self.semcov_ending_state)
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 486, in _compute_semantic_coverage_loss
    if tgt_sep_idx[i].ne(0).sum() == 0:
RuntimeError: CUDA error: device-side assert triggered
[2021-05-04 03:28:11,106 INFO] At step 1, we removed a batch - accum 0
Traceback (most recent call last):
  File "train.py", line 6, in <module>
    main()
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/bin/train.py", line 274, in main
    train(opt)
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/bin/train.py", line 158, in train
    single_main(opt, 0)
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/train_single.py", line 214, in main
    valid_steps=opt.valid_steps)
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/trainer.py", line 244, in train
    self._accum_batches(train_iter)):
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/trainer.py", line 182, in _accum_batches
    for batch in iterator:
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/inputters/inputter.py", line 1140, in __iter__
    for batch in self._iter_dataset(path):
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/inputters/inputter.py", line 1118, in _iter_dataset
    for batch in cur_iter:
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/inputters/inputter.py", line 993, in __iter__
    self.device)
  File "/usr/local/lib/python3.7/dist-packages/torchtext/data/batch.py", line 36, in __init__
    setattr(self, name, field.process(batch, device=device))
  File "/content/drive/My Drive/OpenNMT-kpg-release-master/onmt/inputters/text_dataset.py", line 121, in process
    base_data = self.base_field.process(batch_by_feat[0], device=device)
  File "/usr/local/lib/python3.7/dist-packages/torchtext/data/field.py", line 234, in process
    tensor = self.numericalize(padded, device=device)
  File "/usr/local/lib/python3.7/dist-packages/torchtext/data/field.py", line 329, in numericalize
    lengths = torch.tensor(lengths, dtype=self.dtype, device=device)
RuntimeError: CUDA error: device-side assert triggered

Then I changed to use CPU for training, but the following error occurred.



Traceback (most recent call last):
  File "/Users/Hwasin/Downloads/OpenNMT-kpg-release-master/onmt/trainer.py", line 389, in _gradient_accumulation
    loss, batch_stats = self.train_loss(
  File "/Users/Hwasin/Downloads/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 188, in __call__
    loss, stats = self._compute_loss(batch, **shard_state)
  File "/Users/Hwasin/Downloads/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 379, in _compute_loss
    semantic_coverage_loss = self._compute_semantic_coverage_loss(model,
  File "/Users/Hwasin/Downloads/OpenNMT-kpg-release-master/onmt/utils/loss.py", line 510, in _compute_semantic_coverage_loss
    input_src_states = src_states.index_select(dim=0, index=input_src_idx)
IndexError: index out of range in self
[2021-05-04 15:22:19,168 INFO] At step 1, we removed a batch - accum 0

Could you tell me how to solve it?

about reproduction

Hi, memray, thanks for your codes, it really helps ! I still have a few questions about the codes:

  1. How to reproduce the results for CatSeq in paper "One Size Does Not Fit All: Generating and Evaluating Variable Number of Keyphrases" ? I have tried to comment out these sentences and keep the others unchanged in 'config-rnn-keyphrase-one2seq-diverse.yml':
...
#orth_reg: 'true'
#lambda_orth_reg: 0.1
#sem_cov: 'true'
#lambda_sem_cov: 0.1

#tgt_enc: 'rnn'
#detach_tgt_enc: 'true'
#num_negsample: 16
#use_ending_state: 'true'
...

The F1@5 on SemEval is 0.281 while the one in the paper is 0.302. Is there anything difference besides the two loss above between CatSeq and CatSeqD ? Does CatSeq use the vanilla attention coverage mechanism by default?

  1. How to reproduce the results for CatSeqD ? After I run your provided pretrained verbatim_append model, the F1@5 on SemEval is 0.268 while the one in the paper is 0.327. And I thought maybe it's due to the different parameters between the given model and the description in the paper. I tried to modify the 'config-rnn-keyphrase-one2seq-diverse.yml' file using the parameters described in Table 7 as follows:
lambda_orth_reg: 1
lambda_sem_cov: 0.03

But the resuls are even worse:

AhtoP8aTRH2JxeW

Can you give me some suggestions on reproducing CatSeq and CatSeqD ?

partial or exact?

Hello, I notice that there are two parts of metrics in the csv result of the test, first part of metrics named by "_exact" and second one name by "_partial". could you please explain which part of metrics are used in your paper?

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.