Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD3 - data did not match any variant of untagged enum PyPreTokenizerTypeWrapper #8495

Closed
TEGNoV opened this issue Jun 12, 2024 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@TEGNoV
Copy link

TEGNoV commented Jun 12, 2024

Describe the bug

Error while execution of demo code:

Traceback (most recent call last):
File "/Users/fp/Library/CloudStorage/OneDrive-Personal/1. Projekte/Code/Adobe StableDiffusion/mlx/mydiffusers.py", line 34, in
pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16 , use_auth_token="")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 881, in from_pretrained
loaded_sub_model = load_sub_model(
^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 703, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/transformers/tokenization_utils_base.py", line 1825, in from_pretrained
return cls._from_pretrained(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/transformers/tokenization_utils_base.py", line 1988, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/transformers/models/t5/tokenization_t5_fast.py", line 133, in init
super().init(
File "/Users/fp/.pyenv/versions/3.11.9/lib/python3.11/site-packages/transformers/tokenization_utils_fast.py", line 111, in init
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: data did not match any variant of untagged enum PyPreTokenizerTypeWrapper at line 960 column 3

Reproduction

import torch
from diffusers import StableDiffusion3Pipeline

pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16 , use_auth_token="")
pipe = pipe.to("mps")

image = pipe(
"A cat holding a sign that says hello world",
negative_prompt="",
num_inference_steps=28,
guidance_scale=7.0,
).images[0]
image

Logs

No response

System Info

Latest source pull
Macbook M1 Pro

Who can help?

No response

@TEGNoV TEGNoV added the bug Something isn't working label Jun 12, 2024
@yiyixuxu
Copy link
Collaborator

hi can you try install /upgrade accelerate?

pip install --upgrade accelerate

@xingy038
Copy link

I have same problem.

@wenqsun
Copy link

wenqsun commented Jun 13, 2024

Hello, I also have this problem, have you solved this issue?

@wenqsun
Copy link

wenqsun commented Jun 13, 2024

I solved this problem by updating the transformers. Hope this helps you.
pip install transformers -U

@yiyixuxu
Copy link
Collaborator

what was your transformer version?

cc @sayakpaul here - we might need to pin a newer version for transformer

@wenqsun
Copy link

wenqsun commented Jun 13, 2024

what was your transformer version?

cc @sayakpaul here - we might need to pin a newer version for transformer

@yiyixuxu I updated the transformers from 4.37.2 to 4.41.2, it may be related to the tokenizers package.

@sayakpaul
Copy link
Member

Thanks for reporting and for the information. Could you try with the latest version of tokenizers?

@sayakpaul
Copy link
Member

@yiyixuxu #8522

@TEGNoV
Copy link
Author

TEGNoV commented Jun 13, 2024

Fixed by:

pip install --upgrade accelerate
pip install transformers -U
pip install git+https://github.com/huggingface/diffusers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants