老师,这段代码运行时,我报错了,错误如下:
来源:3-4 卷积神经网络实战
战战的坚果
2020-05-05
#预测
test_predict = model.predict_generator(test_generator,
workers = 5,#并行度
use_multiprocessing = True) #多进程做并行化
老师,这段代码运行时,我报错了,错误如下:
Exception in thread Thread-52:
Traceback (most recent call last):
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\threading.py”, line 917, in _bootstrap_inner
self.run()
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\threading.py”, line 865, in run
self._target(*self._args, **self._kwargs)
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\site-packages\tensorflow_core\python\keras\utils\data_utils.py”, line 748, in _run
with closing(self.executor_fn(_SHARED_SEQUENCES)) as executor:
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\site-packages\tensorflow_core\python\keras\utils\data_utils.py”, line 727, in pool_fn
initargs=(seqs, None, get_worker_id_queue()))
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\context.py”, line 119, in Pool
context=self.get_context())
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\pool.py”, line 176, in init
self._repopulate_pool()
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\pool.py”, line 241, in _repopulate_pool
w.start()
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\process.py”, line 112, in start
self._popen = self._Popen(self)
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\context.py”, line 322, in _Popen
return Popen(process_obj)
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\popen_spawn_win32.py”, line 65, in init
reduction.dump(process_obj, to_child)
File “C:\Users\LanJun.conda\envs\tensorflow2_0_0\lib\multiprocessing\reduction.py”, line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: can’t pickle _thread.lock objects
请问怎么办啊?
1回答
-
正十七
2020-05-07
同学你好,我记得好像有个tf版本会出这个问题。你试试我在git上的代码在你的tf版本下会不会出这个问题先?如果有的话再报一下这个问题。
00
相似问题
回答 1
回答 1