How to Solve Model training Error: _pickle.Picklingerror: can’t pickle
1. Problem description
Recently, when learning the target tracking model of siamfc model, it is found that the following problems always occur during model training on window platform:
_pickle.PicklingError: Can’t pickle <class ‘pairwise.GenericDict’>: attribute lookup GenericDict on pairwise failed
See the following figure for details:
2. Solution
The main problem is that the code is written on Linux platform, test.py has no problem in actual operation, but train.py has problem in window platform, the main problem is on Dataloader, so we can modify this part of the code. The main problem lies in the Dataloader, so we can modify this part of the code. Or we can directly train and test the model under Linux with the source code.
The solution to this problem on Window platform is as follows:
Modify the original code from num_workers = 4 to num_workers = 0 and it will work as follows.
after the modification is completed, the operation effect is as follows:
Read More:
- [Solved] Python Error: An attempt has been made to start a new process before the current process has finished …
- Pytorch Run Error: BrokenPipeError [How to Solve]
- AttributeError: lower not found (NLP extracted tfidf features)
- [Solved] RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the
- Mxnet.gluon Load Pre Training
- [Solved] Pytorch Download CIFAR1 Datas Error: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certi
- [Solved] RuntimeError: Numpy is not available (Associated Torch or Tensorflow)
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
- [Solved] Pyg load dataset Error: attributeerror [pytorch geometry]
- [Solved] Python Keras Error: AttributeError: ‘Sequential‘ object has no attribute ‘predict_classes‘
- How to Solve Pytorch DataLoader Loading Error: UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xe5 in position 1023
- Python: How to Processe “return multiple values”
- Error:output with shape [1, 224, 224] doesn‘t match the broadcast shape [3, 224, 224]
- Keras import a custom metric model error: unknown metric function: Please ensure this object is passed to`custom_object‘
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- Pytorch ValueError: Expected more than 1 value per channel when training, got input size [1, 768
- How to Solve word2vec Module Error: AttributeError & UnicodeDecodeError
- ModuleNotFoundError: No module named ‘tensorflow.python’ And the pits encountered after installation
- [Solved] AttributeError: ‘DataParallel‘ object has no attribute ‘save‘