Skip to content

Installing pydantic>=2.4.0 would cause error and fail to load model #27273

Closed
@Luodian

Description

@Luodian

System Info

The error would be as

Failed to import transformers.generation.utils because of the following error (look up to see its traceback): 'FieldInfo' object has no attribute 'required'

I spent a lot of time to spot it's the version change from the installation of upgrading gradio and it caused pydantic==1.10.7 to pydantic==2.4.2.

I downgraded to 1.10.7 then could run smoothly as usual.

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

!pip install pydantic==2.4.2
from transformers import FuyuForCausalLM, AutoTokenizer, FuyuProcessor, FuyuImageProcessor

Expected behavior

Failed to import transformers.generation.utils because of the following error (look up to see its traceback): 'FieldInfo' object has no attribute 'required'

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