dmlc / gluon-nlp

NLP made easy
https://nlp.gluon.ai/
Apache License 2.0
2.55k stars 538 forks source link

Flaky test: scripts/tests/test_encoder_decoder.py::test_transformer_encoder_decoder #1053

Open eric-haibin-lin opened 4 years ago

eric-haibin-lin commented 4 years ago

https://ci.mxnet.io/blue/organizations/jenkins/GluonNLP-py3-master-cpu-unittest/detail/PR-1050/1/pipeline

[2019-12-13T22:50:21.486Z] =================================== FAILURES ===================================

[2019-12-13T22:50:21.486Z] ________ test_transformer_encoder_decoder[src_tgt_seq_len1-4-True-True] ________

[2019-12-13T22:50:21.486Z] [gw0] linux -- Python 3.5.5 /var/lib/jenkins/gluon-nlp-cpu-py3@2/conda/cpu/py3-master/bin/python

[2019-12-13T22:50:21.486Z] 

[2019-12-13T22:50:21.486Z] output_attention = True, use_residual = True, batch_size = 4

[2019-12-13T22:50:21.486Z] src_tgt_seq_len = (10, 5)

[2019-12-13T22:50:21.486Z] 

[2019-12-13T22:50:21.486Z]     @pytest.mark.parametrize('output_attention', [False, True])

[2019-12-13T22:50:21.486Z]     @pytest.mark.parametrize('use_residual', [False, True])

[2019-12-13T22:50:21.486Z]     @pytest.mark.parametrize('batch_size', [4])

[2019-12-13T22:50:21.486Z]     @pytest.mark.parametrize('src_tgt_seq_len', [(5, 10), (10, 5)])

[2019-12-13T22:50:21.486Z]     def test_transformer_encoder_decoder(output_attention, use_residual, batch_size, src_tgt_seq_len):

[2019-12-13T22:50:21.486Z]         ctx = mx.current_context()

[2019-12-13T22:50:21.486Z]         units = 16

[2019-12-13T22:50:21.486Z]         encoder = TransformerEncoder(num_layers=3, units=units, hidden_size=32, num_heads=8, max_length=10,

[2019-12-13T22:50:21.486Z] >                                    dropout=0.0, use_residual=True, prefix='transformer_encoder_')

[2019-12-13T22:50:21.486Z] 

[2019-12-13T22:50:21.486Z] scripts/tests/test_encoder_decoder.py:171: 

[2019-12-13T22:50:21.486Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

[2019-12-13T22:50:21.486Z] src/gluonnlp/model/transformer.py:337: in __init__

[2019-12-13T22:50:21.486Z]     'const', _position_encoding_init(max_length, units))

[2019-12-13T22:50:21.486Z] conda/cpu/py3-master/lib/python3.5/site-packages/mxnet/gluon/parameter.py:842: in get_constant

[2019-12-13T22:50:21.486Z]     param = Constant(name, value)

[2019-12-13T22:50:21.486Z] conda/cpu/py3-master/lib/python3.5/site-packages/mxnet/gluon/parameter.py:684: in __init__

[2019-12-13T22:50:21.486Z]     initializer.alias(init_name)(Init)

[2019-12-13T22:50:21.486Z] conda/cpu/py3-master/lib/python3.5/site-packages/mxnet/registry.py:109: in reg

[2019-12-13T22:50:21.486Z]     register(klass, name)

[2019-12-13T22:50:21.486Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

[2019-12-13T22:50:21.486Z] 

[2019-12-13T22:50:21.486Z] klass = <class 'mxnet.gluon.parameter.Constant.__init__.<locals>.Init'>

[2019-12-13T22:50:21.486Z] name = 'constant_transformer_encoder_const_139737901187872'

[2019-12-13T22:50:21.486Z] 

[2019-12-13T22:50:21.486Z]     def register(klass, name=None):

[2019-12-13T22:50:21.486Z]         """Register functions"""

[2019-12-13T22:50:21.486Z]         assert issubclass(klass, base_class), \

[2019-12-13T22:50:21.486Z]             "Can only register subclass of %s"%base_class.__name__

[2019-12-13T22:50:21.486Z]         if name is None:

[2019-12-13T22:50:21.486Z]             name = klass.__name__

[2019-12-13T22:50:21.486Z]         name = name.lower()

[2019-12-13T22:50:21.486Z]         if name in registry:

[2019-12-13T22:50:21.486Z]             warnings.warn(

[2019-12-13T22:50:21.486Z]                 "\033[91mNew %s %s.%s registered with name %s is"

[2019-12-13T22:50:21.486Z]                 "overriding existing %s %s.%s\033[0m"%(

[2019-12-13T22:50:21.486Z]                     nickname, klass.__module__, klass.__name__, name,

[2019-12-13T22:50:21.486Z]                     nickname, registry[name].__module__, registry[name].__name__),

[2019-12-13T22:50:21.486Z] >               UserWarning, stacklevel=2)

[2019-12-13T22:50:21.486Z] E           UserWarning: New initializer mxnet.gluon.parameter.Init registered with name constant_transformer_encoder_const_139737901187872 isoverriding existing initializer mxnet.gluon.parameter.Init

I cannot reproduce it locally.

leezu commented 4 years ago

https://ci.mxnet.io/blue/organizations/jenkins/GluonNLP-py3-master-cpu-unittest/detail/PR-950/4/pipeline

[2019-12-16T01:01:08.025Z] E UserWarning: New initializer mxnet.gluon.parameter.Init registered with name constant_transformer_encoder_const_140437917533184 isoverriding existing initializer mxnet.gluon.parameter.Init

eric-haibin-lin commented 4 years ago

Are you able to reproduce it? I cannot reproduce it by running test_encoder_decoder.py alone.