dkeras
dkeras copied to clipboard
Dkeras on a local machine (Intel® Xeon(R) Gold 6128 CPU @ 3.40GHz × 12 ) takes for ever
I have a model based on keras and it takes about 25 seconds for inference. I wanted to speed this up and implemented dkreas but I didnt get the performance improvment that I was expecting. Instead it takes for ever. Do you know why this happen or have I done anything wrong?
from dkeras import dKeras
import ray
ray.init()
model = dKeras(my_model, init_ray=False, wait_for_workers=True, n_workers=None)
segmented = model.predict(data)
model.close()
n_workers=None will cause an error as you don't initialize any workers, try n_workers=10.
I have tried by setting n_workers to 4, 10 and None but it didn't help. Instead I get the following warning which I think it wont be a problem.
(pid=128326) Using TensorFlow backend.
(pid=128326) /home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
(pid=128326) _np_qint8 = np.dtype([("qint8", np.int8, 1)])
(pid=128326) /home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
(pid=128326) _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
(pid=128326) /home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
(pid=128326) _np_qint16 = np.dtype([("qint16", np.int16, 1)])
(pid=128326) /home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
(pid=128326) _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
(pid=128326) /home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
(pid=128326) _np_qint32 = np.dtype([("qint32", np.int32, 1)])
Those warning shouldn't be a problem. As a quick test, what happens when you run a keras.applications ResNet50?
I get the following error when I run keras.applications ResNet50
TypeError: predict() got an unexpected keyword argument 'callbacks'
2020-03-11 10:10:24,965 ERROR worker.py:998 -- Possible unhandled error from worker: ray::dkeras.workers.worker.worker_task() (pid=22884, ip=10.2.21.44)
File "python/ray/_raylet.pyx", line 452, in ray._raylet.execute_task
File "/home/bisrat/anaconda3/envs/cpu_fast/lib/python3.6/site-packages/dkeras/workers/worker.py", line 109, in worker_task
use_multiprocessing=use_multiprocessing)
TypeError: predict() got an unexpected keyword argument 'callbacks'