Skip to content

Missing transformers requirement #10

Closed

Description

@LysandreJik

Dependencies don't mention transformers

diffusers/setup.py

Lines 78 to 91 in 850d434

_deps = [
"Pillow",
"black~=22.0,>=22.3",
"filelock",
"flake8>=3.8.3",
"huggingface-hub",
"isort>=5.5.4",
"numpy",
"pytest",
"regex!=2019.12.17",
"requests",
"torch>=1.4",
"torchvision",
]

However, importing from the quickstart fails without transformers installed:

In [1]: import torch

In [2]: from diffusers import UNetModel, DDPMScheduler
Einops is not installed
Einops is not installed
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 from diffusers import UNetModel, DDPMScheduler

File ~/Workspaces/Python/diffusers/src/diffusers/__init__.py:13, in <module>
     11 from .models.unet_grad_tts import UNetGradTTSModel
     12 from .pipeline_utils import DiffusionPipeline
---> 13 from .pipelines import DDIM, DDPM, GLIDE, LatentDiffusion, PNDM, BDDM
     14 from .schedulers import DDIMScheduler, DDPMScheduler, SchedulerMixin, PNDMScheduler
     15 from .schedulers.classifier_free_guidance import ClassifierFreeGuidanceScheduler

File ~/Workspaces/Python/diffusers/src/diffusers/pipelines/__init__.py:4, in <module>
      2 from .pipeline_ddpm import DDPM
      3 from .pipeline_pndm import PNDM
----> 4 from .pipeline_glide import GLIDE
      5 from .pipeline_latent_diffusion import LatentDiffusion
      6 from .pipeline_bddm import BDDM

File ~/Workspaces/Python/diffusers/src/diffusers/pipelines/pipeline_glide.py:27, in <module>
     24 from torch import nn
     26 import tqdm
---> 27 from transformers import CLIPConfig, CLIPModel, CLIPTextConfig, CLIPVisionConfig, GPT2Tokenizer
     28 from transformers.activations import ACT2FN
     29 from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling

ModuleNotFoundError: No module named 'transformers'

Is the end goal to have transformers as a hard or soft dependency?

Activity

  1. patrickvonplaten commented on Jun 15, 2022

    @patrickvonplaten
    Contributor

    Thanks we should def make this a soft dependency

  2. anton-l commented on Jun 22, 2022

    @anton-l
    Member

    Using dummy imports now instead of hard dependencies and try-catch blocks, thanks to Patrick ff885b0

  3. added a commit that references this issue on Mar 12, 2023
  4. added a commit that references this issue on Sep 18, 2023
  5. added a commit that references this issue on Jan 21, 2024
  6. added a commit that references this issue on Aug 1, 2024
  7. added a commit that references this issue on Jan 6, 2026
  8. added a commit that references this issue on Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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