When running the Pytorch expression recognition code during hands-on training, the following error occurred:
RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__main__': freeze_support() ... The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable.
Here is to take multi-threaded tasks, using a single thread to complete, the solution is also very simple, there are the following two.
1. remove the num_workers parameter
train_dataloader = torch.utils.data.DataLoader(train_dataset,batch_size=batchsize,shuffle=True,num_workers=0) val_dataloader = torch.utils.data.DataLoader(val_dataset,batch_size=100,shuffle=False,num_workers=0)
if __name__=='__main__' before
if __name__ == '__main__': for epoch in range(epochs): loss = 0.0 acc = 0.0 n = 0 for image,label in train_dataloader:
Then it can run normally.
- Python Importerror: DLL load failed: the page file is too small to complete the operation.
- [Solved] RuntimeError: each element in list of batch should be of equal size
- [Solved] torch Do Targer Detection Error: RuntimeError: CUDA error: device-side assert triggered
- [Solved] pytorch CrossEntropyLoss Error: RuntimeError: 1D target tensor expected, multi-target not supported
- [Solved] RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
- [Solved] RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of s
- [Solved] TFrecords Create Datas Error: Number of int64 values != expected. Values size: 1 but output shape: 
- [Solved] Runtimeerror during dcgan training: found dtype long but expected float
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- [Solved] RuntimeError: CUDA error: out of memory
- RuntimeError: CUDNN_STATUS_EXECUTION_FAILED [How to Solve]
- MOTR compiling error: cannot call member function ‘void std::basic_string＜_CharT, _Traits, _Alloc＞::_R
- [Solved] Tensorflow error or keras error and tf.keras error: oom video memory is insufficient
- How to Solve Pydicom Read Dicom File Error: OSError
- [Solved] Data Set reproduct loam_velodyne Fully error: [multiscanregistration-1]
- [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
- [Solved] Doris StreamLoad Error: load by MERGE or DELETE need to upgrade table to support batch delete
- The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- Cv2.dnn read model error [How to Solve]