Fix how we detect the TF package
Our framework detection code calls `_is_package_available()` for TensorFlow, but this code fails when only the `tensorflow-cpu` package is present. The failure occurs because `importlib_metadata.version("tensorflow")` throws an error in the version detection branch of `_is_package_available` unless the core `tensorflow` package is installed.

I solved this by just calling `importlib.util.find_spec("tensorflow")` instead of `_is_package_available()`. However, we could also resolve this issue by rewriting `_is_package_available()` so that it only takes the version check branch when `return_version` is `True`. The `importlib_metadata.version()` call is only used to get the package version, but it causes the entire `_is_package_available()` call to fail if it can't find a version, even if the `importlib.util.find_spec()` call was a success.

ccing @sgugger because there's a `TODO` above that function [requesting his attention](https://github.com/huggingface/transformers/blob/main/src/transformers/utils/import_utils.py#L40), so I'd like his input on the right approach here!

Fixes #24253 
cc @apbard as well since I think the issue was introduced in #23163, but thankfully it's a relatively easy fix!<|||||>_The documentation is not available anymore as the PR was closed or merged._