Multiprocessing in the test dataset of reinforcement learning

I have a problem with running speed of test phase of reinforcement learning. I use DQN for localization. In my case, different test samples take different numbers of steps to localize the target. I can’t use batch here. But for loop takes very long time to sequentially go through all the samples in testset. I tried multiprocessing for for loop to parallel the running for test samples. But it always give me errors. Eg. errors usually happen at .jstart(), and show TypeError: can’t pickle generator objects. Does anyone have a solution for it? Or an example would be better. Thank you.