Skip to content

--nce #20

@drtonyr

Description

@drtonyr

README.md refers to option --nce, for example python main.py --cuda --noise-ratio 10 --norm-term 9 --nce --train

example/utils.py does not have --nce in setup_parser()

Result:

think0 tonyr: python main.py --nce
usage: main.py [-h] [--data DATA] [--vocab VOCAB] [--min-freq MIN_FREQ]
               [--emsize EMSIZE] [--nhid NHID] [--nlayers NLAYERS] [--lr LR]
               [--bptt BPTT] [--concat] [--weight-decay WEIGHT_DECAY]
               [--lr-decay LR_DECAY] [--clip CLIP] [--epochs EPOCHS]
               [--batch-size N] [--dropout DROPOUT] [--seed SEED] [--cuda]
               [--log-interval N] [--save SAVE] [--loss LOSS]
               [--index-module INDEX_MODULE] [--noise-ratio NOISE_RATIO]
               [--norm-term NORM_TERM] [--train] [--tb-name TB_NAME] [--prof]
main.py: error: unrecognized arguments: --nce

It looks like --nce has been replaced by --loss nce and README.md should be updated.

It's not clear that the rest of the code still works. This has two issues:

think7 tonyr: python main.py --cuda --noise-ratio 10 --norm-term 9 --train --index-module gru --dropout 0
...
Falling into one layer GRU due to Index_GRU supporting
/usr/lib/python3/dist-packages/torch/nn/modules/rnn.py:71: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.2 and num_layers=1
  warnings.warn("dropout option adds dropout after all but last "
Training PPL 0.0:  11%|██▎                  | 227/2104 [00:02<00:17, 108.01it/s]

firstly is the warning from rnn.py, secondly the perplexities are all zero.

Moving on to NCE, the reported train PPL is very low, the valid PPL very high.

...
Training PPL 34.3: 100%|████████████████████| 2104/2104 [00:32<00:00, 64.85it/s]
| end of epoch   1 | time: 33.14s |valid ppl   895.19
...
Training PPL 9.8: 100%|█████████████████████| 2104/2104 [00:32<00:00, 64.55it/s]
| end of epoch  40 | time: 33.25s |valid ppl   187.99
| End of training | test ppl   183.84

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions