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

fix bert unittest bug #3422

Merged
merged 2 commits into from
Oct 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions tests/transformers/bert/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,12 @@ def create_and_check_for_question_answering(
start_positions=sequence_labels,
end_positions=sequence_labels,
return_dict=self.return_dict)
if token_labels is not None:
if sequence_labels is not None:
result = result[1:]
elif paddle.is_tensor(result):
result = [result]

self.parent.assertEqual(result[1].shape,
self.parent.assertEqual(result[0].shape,
[self.batch_size, self.seq_length])
self.parent.assertEqual(result[2].shape,
self.parent.assertEqual(result[1].shape,
Copy link
Contributor

Choose a reason for hiding this comment

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

是否需要与ERNIE、RoBERTa一致,而且看这里实际使用的是sequence_labels 并非是if中的token_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.

嗯嗯,好的

[self.batch_size, self.seq_length])

def create_and_check_for_sequence_classification(
Expand Down