Skip to content

Cannot load TensorFlow model from PyTorch weights split to multiple files #19965

@stancld

Description

@stancld

System Info

  • transformers version: 4.24.0.dev0
  • Platform: Linux-5.15.0-46-generic-x86_64-with-glibc2.29
  • Python version: 3.8.10
  • Huggingface_hub version: 0.10.1
  • PyTorch version (GPU?): 1.13.0+cu117
  • Tensorflow version (GPU?): 2.9.2

Who can help?

@LysandreJik @patrickvonplaten

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

$ git clone https://github.com/stancld/transformers.git -b tf_longt5
$ cd transformers
$ pip install -e .
$ python
>>> from transformers import TFLongT5ForConditionalGeneration
>>> m = TFLongT5ForConditionalGeneration.from_pretrained("google/long-t5-tglobal-xl", from_pt=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/transformers/src/transformers/modeling_tf_utils.py", line 2613, in from_pretrained
    raise EnvironmentError(
OSError: google/long-t5-tglobal-xl does not appear to have a file named tf_model.h5 or pytorch_model.bin.
>>> m = TFLongT5ForConditionalGeneration.from_pretrained(MODEL_NAME, from_flax=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/transformers/src/transformers/modeling_tf_utils.py", line 2613, in from_pretrained
    raise EnvironmentError(
OSError: google/long-t5-tglobal-xl does not appear to have a file named tf_model.h5 or pytorch_model.bin.

Expected behavior

Being able to load TensorFlow model from PyTorch checkpoint when split to multiple files due to a large size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WIPLabel your PR/Issue with WIP for some long outstanding Issues/PRs that are work in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions