报错解决——TypeError: Caught TypeError in replica 0 on device 0.-报错内容:

时间:2024-04-13 22:27:35

网络推理的时候,出现下面错误:

Traceback (most recent call last):
  File "test.py", line 230, in <module>
    output = test_tracking(model, dataloader)
  File "test.py", line 145, in test_tracking
    similarity = model(inputs)['logits'].cpu()
  File "/mnt/A/hust_csj/anaconda3/envs/iKUN/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/mnt/A/hust_csj/anaconda3/envs/iKUN/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 167, in forward
    outputs = self.parallel_apply(replicas, inputs, kwargs)
  File "/mnt/A/hust_csj/anaconda3/envs/iKUN/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 177, in parallel_apply
    return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
  File "/mnt/A/hust_csj/anaconda3/envs/iKUN/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
    output.reraise()
  File "/mnt/A/hust_csj/anaconda3/envs/iKUN/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in replica 0 on device 0.