Skip to content

Instantly share code, notes, and snippets.

@Rocketknight1
Created January 19, 2024 12:02
Show Gist options
  • Save Rocketknight1/da1080b462913c6987968ffe1a046390 to your computer and use it in GitHub Desktop.
Save Rocketknight1/da1080b462913c6987968ffe1a046390 to your computer and use it in GitHub Desktop.
try:
import tf_keras as keras
except (ModuleNotFoundError, ImportError):
import keras
if parse(keras.__version__).major > 2:
raise ValueError(
"Your currently installed version of Keras is Keras 3, but this is not yet supported in "
"Transformers. Please install the backwards-compatible tf-keras package with "
"`pip install tf-keras`."
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment