Skip to content

gguf new quant type support (with demo) - #12076

Merged
DN6 merged 3 commits into
huggingface:mainfrom
calcuis:main
Sep 9, 2025
Merged

gguf new quant type support (with demo)#12076
DN6 merged 3 commits into
huggingface:mainfrom
calcuis:main

Conversation

@calcuis

Copy link
Copy Markdown
Contributor

not perfect but works; thanks @a-r-r-o-w@DN6

engine:
https://github.com/calcuis/gguf-connector/blob/main/src/gguf_connector/quant2c.py

inference example(s):
https://github.com/calcuis/gguf-connector/blob/main/src/gguf_connector/k6.pyhttps://github.com/calcuis/gguf-connector/blob/main/src/gguf_connector/k5.py

gguf file sample(s):
https://huggingface.co/calcuis/kontext-gguf/tree/mainhttps://huggingface.co/calcuis/krea-gguf/tree/main

Screenshot 2025-08-02 224103Screenshot 2025-08-02 224124

What does this PR do?

Before submitting

  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.

calcuis/gguf-connector#3

  • Did you write any new necessary tests?

could simply test it with the the inference example(s) above or the code below:

importtorchfromtransformersimportT5EncoderModelfromdiffusersimportFluxPipeline, GGUFQuantizationConfig, FluxTransformer2DModelmodel_path="https://huggingface.co/calcuis/krea-gguf/blob/main/flux1-krea-dev-iq4_nl.gguf"transformer=FluxTransformer2DModel.from_single_file(
model_path,
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
torch_dtype=torch.bfloat16,
config="callgg/krea-decoder",
subfolder="transformer"
)
text_encoder=T5EncoderModel.from_pretrained(
"chatpig/t5-v1_1-xxl-encoder-fp32-gguf",
gguf_file="t5xxl-encoder-fp32-q2_k.gguf",
torch_dtype=torch.bfloat16
)
pipe=FluxPipeline.from_pretrained(
"callgg/krea-decoder",
transformer=transformer,
text_encoder_2=text_encoder,
torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload() # could change it to cuda if you have good gpuprompt="a pig holding a sign that says hello world"image=pipe(
prompt,
height=1024,
width=1024,
guidance_scale=2.5,
).images[0]
image.save("output.png")

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

DN6
DN6 approved these changes Aug 14, 2025

@DN6DN6 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @calcuis! 👍🏽

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@DN6

DN6 commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator

@bot /style

@github-actions

github-actionsBot commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

Style bot fixed some files and pushed the changes.

@DN6
DN6 merged commit 28106fc into huggingface:mainSep 9, 2025
10 checks passed
@DN6

DN6 commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator

Sorry for the delay here @calcuis. I missed merging this one in for the previous release.

@calcuis

Copy link
Copy Markdown
ContributorAuthor

Sorry for the delay here @calcuis. I missed merging this one in for the previous release.

thanks @DN6 ; @a-r-r-o-w; and all of you 🤗

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@calcuis@HuggingFaceDocBuilderDev@DN6