Skip to content

Failed to import transformers.models.bart.modeling_tf_bart because no module named 'keras' #18912

@jybsuper

Description

@jybsuper

The following line of code causes an error: ModuleNotFoundError: No module named 'keras' whenever I try to initialize a Bart model:

from keras.saving.hdf5_format import save_attributes_to_hdf5_group

Replaced it with from tensorflow.python.keras.saving.hdf5_format import save_attributes_to_hdf5_group and the error was gone.
Is this a bug or I didn't install all necessary packages?

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