add doctests for bart like seq2seq models#15987
Merged
patil-suraj merged 15 commits intohuggingface:masterfrom Mar 9, 2022
Merged
add doctests for bart like seq2seq models#15987patil-suraj merged 15 commits intohuggingface:masterfrom
patil-suraj merged 15 commits intohuggingface:masterfrom
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
reviewed
Mar 8, 2022
Collaborator
sgugger
left a comment
There was a problem hiding this comment.
Ah, GitHub was not showing me everything. ELLIPSIS is activated by default, so there is no need to add it in comments. We do have one that ignores the outputs and should be uses for those torch Generators.
You seem to have one badly closed docstring or something like that.
351d5ec to
3d58654
Compare
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
3d58654 to
2be54e2
Compare
|
|
||
| >>> end_scores = outputs.end_logits | ||
| >>> list(end_scores.shape) | ||
| {expected_output} |
| >>> outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions) | ||
| >>> loss = outputs.loss | ||
| >>> round(loss.item(), 2) | ||
| {expected_loss} |
Contributor
There was a problem hiding this comment.
I went over this PR too quickly :-/ Why didn't we check for the actual answer of the model here?
The model is a QA model -> it's not very descriptive to just test for the output shape
| >>> outputs = model(**inputs, labels=labels) | ||
| >>> loss = outputs.loss | ||
| >>> logits = outputs.logits | ||
| >>> list(logits.shape) |
Contributor
There was a problem hiding this comment.
same here -> we should test that the logits give a sensible answer
| >>> labels = torch.tensor([[1, 1]], dtype=torch.float) # need dtype=float for BCEWithLogitsLoss | ||
| >>> outputs = model(**inputs, labels=labels) | ||
| >>> loss = outputs.loss | ||
| >>> logits = outputs.logits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Enable doctests for bart like seq2seq models.