keras
keras copied to clipboard
Question about Tensorflow compatibility
Hi team!
I have a few questions about the Tensorflow compatibility, could you help clarify?
- In future Tensorflow versions (I assume it's starting from 2.16), will TF depend on Keras 3 instead of tf-keras?
- If 1 is correct, does it mean tf-keras will be a frozen package?
- Will
from tensorflow import keras
ortf.keras
keep working? This is not the best practice, but MLflow (the package I am maintaining now) needs to keep the backward compatibility, sofrom tensorflow import keras
will be the simplest solution.
Thanks for the help!
Best, Chen Money
from my experiences (i am porting over my models to keras 3)
- tf works as is, i think the minimum required tf version is ~2.12
- tf.keras and keras cannot be imported at the same time (meaning that your code should either do all
tf.keras
or allkeras.
) - you can still mix tf code in keras3 (eg. calling
tf.boolean_mask
or some other ops). onlytf.keras
need to be changed
@chenmoneygithub - Thanks for raising this issue.
- Starting in TF 2.16, Keras 3 will be installed with TensorFlow. But TF will also remain compatible with
tf-keras
and users can switch via env. variableTF_USE_LEGACY_KERAS=1
and installingtf-keras
pip package.
does it mean tf-keras will be a frozen package?
-
We will continue to release a
tf-keras
version that's aligned with TensorFlow version for users wanting to use Keras 2. -
from tensorflow import keras
will use Keras 3 from TF 2.16 unless the env variable is set, which will then importtf_keras
package (keras 2).
@sampathweb Thanks for the clarification!
Hi @chenmoneygithub ,
Could you please confirm whether we can mark it as resolved ?
@SuryanarayanaY Yes, by the way could you make sure this information is included somewhere? thanks!
Hi @chenmoneygithub ,
This is already documented here. Could you please check and confirm if still missing any info there. Thanks!
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.