-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
speed issue after conversion #54
Comments
When Tensorflow performance sucks, these are the usual culprits:
|
I use as much as I can tf.keras instead of keras import I compare the two code speeds:
and your code (little modified):
I got almost same speed with a very little improvement in version "1" |
@thegodone One important thing I almost forgot about: Tensorflow really hates dynamic tensor shapes. To infer language models with varying context length, you should do input padding (see this example and the accompanying issue). |
Turns out, the inference is much faster if the Keras model is exported as keras_model.export(model_path)
saved_model = tf.saved_model.load(model_path)
saved_model.serve(inputs) |
nice catch, look like there are optimization during the savedmodel. I will try that thanks a lot |
indeed almost all is faster now, except the "first line" built-in method tensorflow.python._pywrap_tfe.TFE_Py_Execute this is strange:
|
probably deserves mentioning on readme that performances suffers until model is saved. |
After conversion I have issue on speed:
What is also strange is the number of operations between torch and keras.
The text was updated successfully, but these errors were encountered: