I guess you are using tensorflow version greater than 2.15 which contains keras3.0 which was causing the error. Could you please try to import tf_keras with the below commands.!pip install tf-keras
, import tf_keras
.Also i have modified some steps and code was executed without error.Kindly refer to this gist