Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TF wrappers: Performance of Keras vs Tensorpack

I've a question regarding the training performance of Keras vs other TF Wrappers like Tensorpack.

During a Q&A session, the author of Keras stated that the package comes with no performance cost:

Keras provides a simpler, quicker way to build and train models in TensorFlow, at no performance cost since the models are still being run by the same TensorFlow engine.

On the other hand though, the Tensorpack github claims that it's 2 times faster than Keras, even with a tiny CNN:

Tensorpack trainer is almost always faster than feed_dict based wrappers. Even on a tiny CNN example, the training runs 2x faster than the equivalent Keras code.

So now I wonder the following: Who is right? A factor of two would be very significant for me in training.

like image 489
0vbb Avatar asked Dec 11 '22 10:12

0vbb


1 Answers

I'm the author of tensorpack. The reasons for major performance improvements are summarized in the Input Pipeline page in the documentation: https://tensorpack.readthedocs.io/tutorial/extend/input-source.html These arguments are for single GPU training case. For multi GPU training we have more performance improvements to match Google's benchmark code.

The answer by @jdehesa is not right, we never use TFRecord to read data (although it is capable of doing so, I don't see much advantage). You can read everything by pure Python and get this speed.

Also, the 2x speedup might be a bit outdated, I know Keras has been making improvements on reducing framework overhead.

like image 88
ppwwyyxx Avatar answered Jan 28 '23 07:01

ppwwyyxx