Instructions to use unsloth/Qwen-Image-2512-unsloth-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use unsloth/Qwen-Image-2512-unsloth-bnb-4bit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("unsloth/Qwen-Image-2512-unsloth-bnb-4bit", dtype=torch.bfloat16, device_map="cuda") prompt = "two friends posing in front of a tourist attraction" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
- Unsloth Desktop
Error initializing pipeline: 'tuple' object has no attribute 'numel'
When I initialized the pipeline using the example code, the following issues occurred:
pipe = DiffusionPipeline.from_pretrained(
"unsloth/Qwen-Image-2512-unsloth-bnb-4bit",
torch_dtype=torch.bfloat16,
).to('cuda')
'tuple' object has no attribute 'numel'
Also encountered an error when running it on ZeroGPU Spaces: CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling cublasSgemmStridedBatched( handle, opa, opb, m, n, k, &alpha, a, lda, stridea, b, ldb, strideb, &beta, c, ldc, stridec, num_batches)
When I initialized the pipeline using the example code, the following issues occurred:
pipe = DiffusionPipeline.from_pretrained( "unsloth/Qwen-Image-2512-unsloth-bnb-4bit", torch_dtype=torch.bfloat16, ).to('cuda')'tuple' object has no attribute 'numel'
You may need to upgrade packages in your environment. These package versions are working for me
torch: 2.9.0+cu126
diffusers: 0.36.0
transformers: 4.57.6
bitsandbytes: 0.49.1
accelerate: 1.12.0
Also encountered an error when running it on ZeroGPU Spaces: CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling
cublasSgemmStridedBatched( handle, opa, opb, m, n, k, &alpha, a, lda, stridea, b, ldb, strideb, &beta, c, ldc, stridec, num_batches)
Not sure, but you can try taking out the to('cuda') call.
The pipeline initialization can only run on @spaces.GPU. The error during execution was due to insufficient VRAM, as other programs were using the GPU. The problem has now been resolved.