clay-lab / transductions

A PyTorch framework for creating, running, and reproducing experiments on seq2seq models.
6 stars 3 forks source link

Does test code fail if prediction is longer than target? #18

Closed NoahAmsel closed 4 years ago

NoahAmsel commented 4 years ago

Got this bug

Traceback (most recent call last):
  File "main.py", line 386, in <module>
    args.func(args)
  File "main.py", line 249, in test_model
    test.test(model, name = args.model, data = iterators)
  File "/Users/noah/Documents/Senior/Clay/Code/transductions/test.py", line 131, in test
    meter.process_batch(logits_narrow, batch.target, model)
  File "/Users/noah/Documents/Senior/Clay/Code/transductions/metrics.py", line 59, in process_batch
    correct = (prediction == target).prod(axis=0)
  File "//miniconda3/lib/python3.7/site-packages/torch/tensor.py", line 28, in wrapped
    return f(*args, **kwargs)
RuntimeError: The size of tensor a (13) must match the size of tensor b (15) at non-singleton dimension 0
NoahAmsel commented 4 years ago

This is fixed except for the loss meter in evaluate function of training.py. The other meters in test and train work now.

NoahAmsel commented 4 years ago

Fixed that last part too^