0

I'm trying to use multiprocessing to create a process that performs an inference operation using Keras, so I can monitor the resource usage of that operation (as suggested in response to my previous question here).

For some reason the start method is causing a TypeError that I can't figure out.

worker_process = mp.Process(target=small_model.predict(x_test[0:1]))
worker_process.start()


Process Process-13:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
TypeError: 'numpy.ndarray' object is not callable
Philip O'Brien
  • 4,146
  • 10
  • 46
  • 96

1 Answers1

1

I assume that small_model.predict is the function for wich you want to create a new process.

worker_process = mp.Process(target=small_model.predict, args=(x_test[0:1],))
worker_process.start()
Yassine Faris
  • 951
  • 6
  • 26