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] awtk scons Error: unsupported pickle protocol: 4
- [Solved] Can‘t pickle local object ‘_createenviron.<locals>.encodekey‘
- To solve the problem that the loss of verification set of resnet50 pre-training model remains unchanged
- [Solved] YOLOv5 Model training error: TypeError: new(): invalid data type ‘str’
- `Model.XXX` is not supported when the `Model` instance was constructed with eager mode enabled
- Mxnet.gluon Load Pre Training
- How to Solve Yolox Training C Disk Full Issue
- Pytorch ValueError: Expected more than 1 value per channel when training, got input size [1, 768
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] Training yolov5 Error: attributeerror: can get attribute sppf on Module
- [ONNXRuntimeError] : 10 : INVALID_Graph loading model error
- How to Solve keras load_model() Error
- pytorch model.load_state_dict Error [How to Solve]
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model
- The lenet model trained by Python failed to predict its own handwritten pictures
- Keras import a custom metric model error: unknown metric function: Please ensure this object is passed to`custom_object‘
- [Solved] module ‘numpy.random‘ has no attribute ‘default_rng‘ gensim.model
- [Solved] PyTorch Load Model Error: Missing key(s) RuntimeError: Error(s) in loading state_dict for
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- YOLOX Model conversion error: [TensorRT] ERROR: runtime.cpp (25) – Cuda Error in allocate: 2 (out of memory)