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

1 Answer 1

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()
Sign up to request clarification or add additional context in comments.

3 Comments

I just noticed that when run this way the worker process never seems to terminate
When you run the function without multi process do it terminate?
Yes, it returns the result very quickly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.