Instructions to use stabilityai/stable-diffusion-3-medium-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stabilityai/stable-diffusion-3-medium-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Exception: data did not match any variant of untagged enum PyPreTokenizerTypeWrapper at line 960 column 3
Loading pipeline components...: 33%|█████████████████████████████████████████████████ | 3/9 [00:00<00:01, 4.89it/s]
Traceback (most recent call last):
File "~/work/stable-diffusion-3-medium-diffusers/demo/test.py", line 4, in
pipe = StableDiffusion3Pipeline.from_pretrained("../stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16)
File "/root/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/root/.local/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 881, in from_pretrained
loaded_sub_model = load_sub_model(
File "/root/.local/lib/python3.10/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 "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 2028, in from_pretrained
return cls._from_pretrained(
File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 2260, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "/usr/local/lib/python3.10/dist-packages/transformers/models/t5/tokenization_t5_fast.py", line 135, in init
super().init(
File "/usr/local/lib/python3.10/dist-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
I need some help to run the demo.
I have downloaded stabilityai/stable-diffusion-3-medium-diffusers.
My command:
pip3 install -U diffusers --user
pip3 install torch
python3 test.py
My test.py is:
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained("../stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16)
#pipe = pipe.to("cuda")
image = pipe(
"A cat holding a sign that says hello world",
negative_prompt="",
num_inference_steps=28,
guidance_scale=7.0,
).images[0]
image
Finally, I solved all the problem and run the model successfully in 7 days. TT
Could u please share your solution? I just encounter this error.
solved by 'pip install transformers -U'
solved by 'pip install transformers -U'
thanks, it works.