Skip to content

Transformers need keras updates for tf-nightly + tf_keras (Keras 2.0) & keras 3.0 #27377

@jojivk

Description

@jojivk

System Info

With new changes for Keras (https://groups.google.com/g/keras-users/c/jgGcX730WGE), we are seeing issues with using Huggingface models (GPT-J, Stable Diffusion, & Vision Transformer). We saw that transformers restrict the versions for Tensorflow and Keras. https://github.com/huggingface/transformers/blob/main/setup.py#L129.

To use the models with tf-keras (keras 2.0), we could resolve issues in Transformers by changing import of keras in transformers to import tf_keras. -ie change
import keras.*
to
import tf_keras.*

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. Install tf-nightly
  2. Install tf-keras-nightly
  3. export TF_USE_LEGACY_KERAS=1
  4. Run Huggingface Tensorflow GPT-J

Expected behavior

Fails to run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions