fairseq/tests
Myle Ott 88185fcc3f Cleanup new incremental state API (#1005)
Summary:
* Now that we have `FairseqIncrementalState`, we can move `get_incremental_state` and `set_incremental_state` as methods in that class, instead of having the helper functions in `utils.py`. I think this will eventually help with type checking too.
* The incremental ID logic was overly complicated, we can just use `uuid` to generate a unique ID for every instance.
* Add missing `with_incremental_state` to light/dynamic conv modules.
* Add additional unit test: `test_incremental_state_multihead_attention`

Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/1005

Test Plan:
* unit tests

Also confirmed this matches master:
```
$ python generate.py ~/data/data-bin/wmt16_en_de_bpe32k --path /checkpoint/myleott/s3/models/wmt16.en-de.joined-dict.transformer/model.pt --beam 4 --lenpen 0.6 --remove-bpe --quiet
(...)
2020-01-22 09:53:38 | INFO | fairseq_cli.generate | Generate test with beam=4: BLEU4 = 29.28, 60.8/35.1/22.8/15.3 (BP=0.997, ratio=0.997, syslen=62859, reflen=63078)
```

Reviewed By: cndn

Differential Revision: D19517908

Pulled By: myleott

fbshipit-source-id: a406490e342d0d30a9231bf823d3350999bda4c0
2020-01-27 10:25:33 -08:00
..
speech_recognition fix Windows build (#1007) 2020-01-24 10:32:20 -08:00
__init__.py fairseq-py goes distributed (#106) 2018-02-27 17:09:42 -05:00
test_average_checkpoints.py Small fixes 2019-08-19 15:08:25 -07:00
test_backtranslation_dataset.py Add a diverse beam search variant to sequence_generator.py (#953) 2020-01-06 08:24:02 -08:00
test_binaries.py Standalone LSTM decoder language model (#934) 2020-01-24 13:16:22 -08:00
test_bmuf.py Create build.yml 2019-12-17 20:45:11 -08:00
test_character_token_embedder.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_concat_dataset.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_convtbc.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_dictionary.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_export.py Cleanup new incremental state API (#1005) 2020-01-27 10:25:33 -08:00
test_file_io.py Added unit test for PathManager file io (with or without fvcore). 2019-12-09 14:19:51 -08:00
test_iterators.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_label_smoothing.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_memory_efficient_fp16.py Clean up tests 2020-01-22 11:29:20 -08:00
test_metrics.py Fix logging of training sets (fixes #1632) (#1634) 2020-01-20 16:34:33 -08:00
test_multi_corpus_sampled_dataset.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_multihead_attention.py Fixing key padding mask during transformer generation 2019-11-05 06:50:53 -08:00
test_noising.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_reproducibility.py Script MultiheadAttention (#1002) 2020-01-21 18:35:28 -08:00
test_resampling_dataset.py Add dataset class for weighted sampling with replacement. (#861) 2019-09-19 10:36:00 -07:00
test_sequence_generator.py Add a diverse beam search variant to sequence_generator.py (#953) 2020-01-06 08:24:02 -08:00
test_sequence_scorer.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_sparse_multihead_attention.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_token_block_dataset.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_train.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
test_utils.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00
utils.py Relicense fairseq under MIT license (#786) 2019-07-30 07:48:23 -07:00