Fix functional TF Whisper and modernize tests
There was a regression in 4.30 that affects functional construction of Whisper models in certain cases, my bad!

In an attempt to avoid this in future, I modified the `test_compile_tf_model` test. These tests were quite old and weren't that relevant for how we do things now, and were also quite slow. I pared the test down to the actual thing we want to test (functional construction with `tf.keras.Input` and potentially-unknown shape dimensions), which should make it fast enough to run in the live CI, as well as giving us more useful info about regressions like this in future.

Fixes #24291 
_The documentation is not available anymore as the PR was closed or merged._<|||||>Update: The test is still very slow in some cases in the CI. I'm going to mark it as `@slow` before merging this PR after all, but I'll leave it as-is for now so I can fix any issues it raises before merging.<|||||>Quick note: I marked the test as slow (it was slow before too). I ran everything locally and all models passed, so hopefully it should still look good on the nightly CI after this is merged.<|||||>cc @amyeroberts for core maintainer review and we should be good to go! (Also sorry Amy if I'm spamming you with lots of PRs this week)<|||||>Thanks for the ping re-regression. This is way too big of a PR to be included in a patch though so I suggest making a separate small PR for the part that would need to go in a patch, or decide this won't go in a patch and tell users to wait for 4.31.<|||||>Ah, sorry! I didn't mean to imply there'd be a patch release - this doesn't affect too many people (only a very specific subset of Whisper users who are exporting models using the functional API), so it should be fine to wait until 4.31. I can just tell affected people to install from `main` until then.