Testing process of MatchSum !!!
Start loading datasets !!!
Finished in 0:00:03.919354
Information of dataset is:
In total 1 datasets:
test has 11489 instances.
Current model is MatchSum_cnndm_bert.ckpt
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:593: SourceChangeWarning: source code of class 'model.MatchSum' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
Traceback (most recent call last):
File "train_matching.py", line 152, in
test_model(args)
File "train_matching.py", line 111, in test_model
tester.test()
File "/usr/local/lib/python3.7/dist-packages/fastNLP/core/tester.py", line 170, in test
metric(pred_dict, batch_y)
File "/usr/local/lib/python3.7/dist-packages/fastNLP/core/metrics.py", line 293, in call
self.evaluate(**refined_args)
File "/content/drive/MyDrive/MatchSum-master/metrics.py", line 141, in evaluate
ext = int(torch.max(score, dim=1).indices) # batch_size = 1
ValueError: only one element tensors can be converted to Python scalars
Testing process of MatchSum !!!
Start loading datasets !!!
Finished in 0:00:03.919354
Information of dataset is:
In total 1 datasets:
test has 11489 instances.
Current model is MatchSum_cnndm_bert.ckpt
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:593: SourceChangeWarning: source code of class 'model.MatchSum' has changed. you can retrieve the original source code by accessing the object's source attribute or set
torch.nn.Module.dump_patches = Trueand use the patch tool to revert the changes.warnings.warn(msg, SourceChangeWarning)
Traceback (most recent call last):
File "train_matching.py", line 152, in
test_model(args)
File "train_matching.py", line 111, in test_model
tester.test()
File "/usr/local/lib/python3.7/dist-packages/fastNLP/core/tester.py", line 170, in test
metric(pred_dict, batch_y)
File "/usr/local/lib/python3.7/dist-packages/fastNLP/core/metrics.py", line 293, in call
self.evaluate(**refined_args)
File "/content/drive/MyDrive/MatchSum-master/metrics.py", line 141, in evaluate
ext = int(torch.max(score, dim=1).indices) # batch_size = 1
ValueError: only one element tensors can be converted to Python scalars