You should check your tensorflow and keras version. They must be compatible. For example: tensorflow==2.18 and keras==2.08 incompatible.