cpickle.picklingerror can’t pickle type ‘module’ attribute lookup __builtin__.module failed

recently noticed this error while using the process pool! The following is a simplified version of the call itself. Regardless of the syntax error, the second parameter of the map function contains an iterator containing an instance of the class that contains the session

of tensorflow initialized by a model parameter

def func(net):
return net.predict()
class Detecter(object):
def __init__(self, file):
with tf.Graph().as_default():
self.sess = tf.Session()
def predict(self):
detecter = [Detecter('./model.ckpt')]*4
for batch in range(0,4,4):
bb = multiprocessing.pool.map(func, izip(detecter[:4]))

solution: change the original “from multiprocessing import Pool” to “from multiprocessing. Pool import ThreadPool as Pool”

Read More: