Skip to content

Enable MPS backend for bitsandbytes quantization #13361

Closed

Description

@LucasSte

Is your feature request related to a problem? Please describe.

Bitsandbytes now has basic support for the Apple MPS backend, as I can tell by bitsandbytes-foundation/bitsandbytes#1818 and
bitsandbytes-foundation/bitsandbytes#1875.

The issue is that diffusers does not allow me to use the quantization on Apple hardware, because of the error No GPU found. A GPU is needed for quantization. from here

if not (torch.cuda.is_available() or torch.xpu.is_available()):
raise RuntimeError("No GPU found. A GPU is needed for quantization.")
.

Describe the solution you'd like.

I modified the above lines to

if not (torch.cuda.is_available() or torch.xpu.is_available() or torch.mps.is_available()):
    raise RuntimeError("No GPU found. A GPU is needed for quantization.")

and tested the change with the quantized version of FLUX.2-dev as described in https://github.com/black-forest-labs/flux2/blob/main/docs/flux2_dev_hf.md#4-bit-transformer-and-4-bit-text-encoder-20g-of-vram, and all worked fine.

I am wondering if that solution could be adopted in the repository. I can open a PR if that is the case.

Describe alternatives you've considered.

None.

Additional context.
Add any other context or screenshots about the feature request here.

Activity

  1. Vargol commented on Jun 9, 2026

    @Vargol

    Hi, I've just had a go a getting ideogram working and it required the change flagged above and a change to update_device_map

        def update_device_map(self, device_map):
            if device_map is None:
                if torch.xpu.is_available():
                    current_device = f"xpu:{torch.xpu.current_device()}"
                elif torch.mps.is_available():
                    current_device = "mps"
                else:
    

    I'd really like to see the mps restriction lifted without me having to change the code

  2. asomoza commented on Jun 9, 2026

    @asomoza
    Member

    cc: @sayakpaul WDYT?

  3. sayakpaul commented on Jun 10, 2026

    @sayakpaul
    Member

    Sure why not.

  4. akshan-main commented on Jun 10, 2026

    @akshan-main
    Contributor

    @LucasSte are you still planning to PR it? I'd be happy to take this

  5. LucasSte commented on Jun 10, 2026

    @LucasSte
    ContributorAuthor

    @LucasSte are you still planning to PR it? I'd be happy to take this

    Now that someone has approved the change, I'll open a PR.

  6. LucasSte commented on Jun 10, 2026

    @LucasSte
    ContributorAuthor

    The PR is here: #13915

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions