Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing test flakiness #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sleepy-owl
Copy link

The test MultiHeadSelfAttentionTest::test_multi_head_self_attention_respects_masking in pymagnitude/third_party/allennlp/tests/modules/seq2seq_encoders/multi_head_self_attention_test.py fails intermittently with the following assertion error:

E       AssertionError:                                                                                                                                                                                            
E       Arrays are not almost equal to 7 decimals                                                                                                                                                                  
E                                                                                                                                                                                                                  
E       Mismatched elements: 1 / 30 (3.33%)                                                                                                                                                                        
E       Max absolute difference: 2.3841858e-07                                                                                                                                                                     
E       Max relative difference: 4.042717e-06                                                                                                                                                                      
E        x: array([[-0.352625 ,  0.1294522, -0.6926192, -0.1527835, -0.1780743],                                                                                                                                   
E              [-0.403197 ,  0.16395  , -0.654655 , -0.1818076, -0.2412511],                                                                                                                                       
E              [-0.4987849,  0.0612553, -0.7484417, -0.2248259, -0.2507692],...                                                                                                                                    
E        y: array([[-0.352625 ,  0.1294521, -0.6926192, -0.1527835, -0.1780743],                                                                                                                                   
E              [-0.403197 ,  0.16395  , -0.654655 , -0.1818076, -0.2412511],                                                                                                                                       
E              [-0.498785 ,  0.0612553, -0.7484417, -0.2248259, -0.2507692],...    

This fix addresses this problem. I looked at the differences in the values that are being compared from several samples and changing the decimal places from 7 (default) to 6 fixes this problem and reduces the flakiness of the test.

Please let me know if this looks good or if you have any other suggestions for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant