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

[docs] Add integration test example to copy pasta template #5961

Merged
merged 8 commits into from
Jul 22, 2020

Conversation

sshleifer
Copy link
Contributor

Encourage testing practices that have been encouraged since last update, namely:

  • @slow tests that run on cuda and fp16 if possible and show that your model produces good outputs.
  • more tests ~= better
  • unindent the ModelTester
  • call get_extended_attention_mask and delete massive comment.

My code is probably broken because this thing isn't tested!

Add:
"""
Try to make this test take a string and check that a resultant string == desired_result using your tokenizers encode and decode functions
""

@@ -268,7 +270,33 @@ def test_for_token_classification(self):
self.model_tester.create_and_check_xxx_for_token_classification(*config_and_inputs)

@slow
def test_model_from_pretrained(self):
Copy link
Contributor Author

@sshleifer sshleifer Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a fan of this thing.
It wastes time and money and is very very shallow.

self.attention_probs_dropout_prob = attention_probs_dropout_prob
self.max_position_embeddings = max_position_embeddings
self.type_vocab_size = type_vocab_size
self.type_sequence_label_size = type_sequence_label_size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would love to not have this take any kwargs./

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

Will add another PR since the template does not mention doc at all :-(

@codecov
Copy link

codecov bot commented Jul 22, 2020

Codecov Report

Merging #5961 into master will decrease coverage by 1.22%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5961      +/-   ##
==========================================
- Coverage   78.50%   77.27%   -1.23%     
==========================================
  Files         146      146              
  Lines       26214    26218       +4     
==========================================
- Hits        20578    20259     -319     
- Misses       5636     5959     +323     
Impacted Files Coverage Δ
src/transformers/testing_utils.py 72.72% <25.00%> (-3.75%) ⬇️
src/transformers/modeling_tf_mobilebert.py 23.38% <0.00%> (-73.39%) ⬇️
src/transformers/generation_tf_utils.py 83.95% <0.00%> (-1.26%) ⬇️
src/transformers/generation_utils.py 96.82% <0.00%> (-0.29%) ⬇️
src/transformers/modeling_tf_roberta.py 93.36% <0.00%> (+49.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e714412...a57f645. Read the comment docs.

@@ -55,4 +55,5 @@ jobs:
USE_CUDA: yes
run: |
source .env/bin/activate
pip install -r examples/requirements.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff is wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? That's weird

"loss": loss,
"logits": logits,
}
self.parent.assertListEqual(list(result["logits"].size()), [self.batch_size, self.num_labels])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh

@@ -55,4 +55,5 @@ jobs:
USE_CUDA: yes
run: |
source .env/bin/activate
pip install -r examples/requirements.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? That's weird

@sshleifer sshleifer changed the title Add integration test example to copy pasta template [docs] Add integration test example to copy pasta template Jul 22, 2020
@sshleifer sshleifer merged commit feeb956 into huggingface:master Jul 22, 2020
@sshleifer sshleifer deleted the install-example-requirements branch July 22, 2020 16:48
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.

3 participants