adventuresinML / adventures-in-ml-code

This repository holds all the code for the site http://www.adventuresinmachinelearning.com
1.04k stars 640 forks source link

Keras word2vec is much more faster than tensorflow word2vec ? #3

Open muthiyanbhushan opened 6 years ago

muthiyanbhushan commented 6 years ago

Thanks for your work. I had a question about word2vec.

I ran both of your codes of word2vec viz Keras_word2vec.py and tf_word2vec.py !!

Keras word2vec with Tensorflow backend seems faster than Tensorflow word2vec. Ideally it should not. Keras is indirectly calling Tensorflow. Tensorflow code took 1182 sec to run 15 iterations whereas Keras just took 796 seconds to run 15 iterations.

How is Keras faster than Tensorflow?

Can you please help me? My CPU instance:

AWS Instance: C4.4 Large (Compute Optimized). Intel® Xeon® CPU ES-2666 V3 @ 2.90 GHz No. of CPU Cores = 16 2-CPU with 8 Cores/CPU Memory = 30 GB FPU = Yes

Thanks.

Santosh-Gupta commented 5 years ago

it looks like the tensorflow uses a different function to calculate loss compared to the keras version, so the two are not comparable.