Skip to content

name 'PreTrainedTokenizer' is not defined in diffusers 0.22.1 #5661

@WiNE-iNEFF

Description

@WiNE-iNEFF

Describe the bug

when i try to loading pretrained model using DDPMPipeline or DiffusionPipeline, i take error Failed to import diffusers.models.unet_2d because of the following error (look up to see its traceback): name 'PreTrainedTokenizer' is not defined

Reproduction

from diffusers import DiffusionPipeline image_pipe = DiffusionPipeline.from_pretrained(huggan/fastgan-few-shot-painting).to(device)

Logs

NameError                                 Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name)
    683         try:
--> 684             return importlib.import_module("." + module_name, self.__name__)
    685         except Exception as e:

20 frames
NameError: name 'PreTrainedTokenizer' is not defined

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name)
    684             return importlib.import_module("." + module_name, self.__name__)
    685         except Exception as e:
--> 686             raise RuntimeError(
    687                 f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its"
    688                 f" traceback):\n{e}"

RuntimeError: Failed to import diffusers.models.unet_2d because of the following error (look up to see its traceback):
name 'PreTrainedTokenizer' is not defined

System Info

- diffusers` version: 0.22.1

  • Platform: Linux-5.15.120+-x86_64-with-glibc2.35
  • Python version: 3.10.12
  • PyTorch version (GPU?): 2.1.0+cu118 (True)
  • Huggingface_hub version: 0.18.0
  • Transformers version: not installed
  • Accelerate version: 0.24.1
  • xFormers version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?: `

Who can help?

@DN6 @yiyixuxu @sayakpaul @patrickvonplaten

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions