Run the training Model in Python3 now how to fix Testing

I have run the training with Pytorch in Python3 how to fix this code for Python 3

I am facing this error

Traceback (most recent call last):
File “”, line 140, in
File “”, line 48, in main
checkpoint = torch.load(args.weights)
File “/home/kanza/.local/lib/python3.5/site-packages/torch/”, line 303, in load
return _load(f, map_location, pickle_module)
File “/home/kanza/.local/lib/python3.5/site-packages/torch/”, line 459, in _load
magic_number = pickle_module.load(f)
TypeError: file must have ‘read’ and ‘readline’ attributes