feat: add PixArt model family support - #2047
Merged
Merged
Conversation
Add PixArt-Sigma DiT support: standalone diffusers-format checkpoints are detected via pos_embed.proj and routed to a new PixArtRunner implementing adaLN-single modulation, 2D sincos position embedding and learned-variance (8ch -> 4ch) output slicing. - linear beta schedule (0.0001 -> 0.02) for the compvis denoiser - SD1.x VAE latent config (z=4, scale_factor=0.18215) - keep scale_shift_table in f32 (element-wise views are invalid on quantized layouts); dequantize defensively when already quantized - t5 unigram tokenizer: emit no pieces for empty input, matching HF so uncond conditioning is <eos> + padding
Owner
|
Thank you for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1965.
Add support for the PixArt-Sigma transformer (DiT architecture with adaLN-single modulation):
src/model/diffusion/pixart.hpp: patch embed via strided conv, 2D sincos position embedding with multi-resolution coordinate scaling, 28× adaLN-single blocks (self-attn + T5 cross-attn + ffn), learned-variance output (8ch → 4ch slice). Config is detected from weight names/shapes rather than hardcoded.adaln_single.emb.timestep_embeddersignature with LTX-AV; disambiguated bypos_embed.projwhich is PixArt-only.calculate_alphas_cumprod_linear_betaused when version is PixArt.▁piece; uncond conditioning now produces<eos>+ padding, matching Hugging Face. This affects all T5-based models' negative-prompt path — happy to split into a separate PR if preferred.scale_shift_tableis excluded from conversion (element-wise views are invalid on quantized block layouts, and modulation params shouldn't lose precision anyway — same latent issue exists in LTXV). A defensiveggml_castdequantizes the table if a pre-quantized file is loaded.Tested with PixArt-Sigma-XL-2-1024-MS (standalone diffusers-format transformer + T5-XXL + SD VAE):
Test plan
--diffusion-fapath OK--model-argsfor pos-embed base size — documented)