Instructions to use Qwen/Qwen-Image-2512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Qwen/Qwen-Image-2512 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-2512", 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
Error running the example code: RuntimeError: cannot reshape tensor of 0 elements into shape [1, 0, -1] because the unspecified dimension size -1 can be any value and is ambiguous
#17
by ivoras - opened
I'm getting this error while trying to run the example code on Windows with ROCm 7:
File "C:\temp\qwenimage\gen.py", line 38, in <module>
image = pipe(
^^^^^
File "C:\temp\venvrocm7\Lib\site-packages\torch\utils\_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\temp\venvrocm7\Lib\site-packages\diffusers\pipelines\qwenimage\pipeline_qwenimage.py", line 606, in __call__
prompt_embeds, prompt_embeds_mask = self.encode_prompt(
^^^^^^^^^^^^^^^^^^^
File "C:\temp\venvrocm7\Lib\site-packages\diffusers\pipelines\qwenimage\pipeline_qwenimage.py", line 261, in encode_prompt
prompt_embeds = prompt_embeds.view(batch_size * num_images_per_prompt, seq_len, -1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: cannot reshape tensor of 0 elements into shape [1, 0, -1] because the unspecified dimension size -1 can be any value and is ambiguous