Skip to content

AutoPipelineForText2Image requiring sentencepiece, which isn't a diffusers requirement #9034

Description

@evanscho

Describe the bug

Importing AutoPipelineForText2Image throws an error if sentencepiece isn't installed, even though sentencepiece is not required for users who just use AutoPipelineForText2Image for SD 1.5 / SD XL and isn't a core diffusers requirement.

Reproduction

git clone --depth 1 https://github.com/huggingface/diffusers &&
cd diffusers &&
git fetch origin 73acebb &&
git reset --hard 73acebb &&
pipenv run pip install .

Then in any python file:
import AutoPipelineForText2Image

Logs

2024-08-01T06:14:56.576275296Z from diffusers import AutoPipelineForText2Image
2024-08-01T06:14:56.576280729Z File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
2024-08-01T06:14:56.576285313Z File "/root/.local/share/virtualenvs/api-ORERwo9D/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 784, in __getattr__
2024-08-01T06:14:56.576364429Z value = getattr(module, name)
2024-08-01T06:14:56.576370913Z ^^^^^^^^^^^^^^^^^^^^^
2024-08-01T06:14:56.576375236Z File "/root/.local/share/virtualenvs/api-ORERwo9D/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 783, in __getattr__
2024-08-01T06:14:56.576485760Z module = self._get_module(self._class_to_module[name])
2024-08-01T06:14:56.576503570Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-01T06:14:56.576507880Z File "/root/.local/share/virtualenvs/api-ORERwo9D/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 795, in _get_module
2024-08-01T06:14:56.576759296Z raise RuntimeError(
2024-08-01T06:14:56.576777586Z RuntimeError: Failed to import diffusers.pipelines.auto_pipeline because of the following error (look up to see its traceback):
2024-08-01T06:14:56.576782880Z Failed to import diffusers.pipelines.kolors.pipeline_kolors_img2img because of the following error (look up to see its traceback):
2024-08-01T06:14:56.576787469Z No module named 'sentencepiece'

System Info

Ubuntu 22.04.4 LTS
Python 3.11.9
Diffusers checkpoint 73acebb

Who can help?

@sayakpaul@yiyixuxu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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