TensorFlow has deprecated the API and it has become more of a legacy. You have reinstall an older version of TensorFlow. You can use !pip install tensorflow==2.13.0, or even an older version of TensorFlow, depending the model you're using.