[feat] Add GLM-Image inference support - #1030
Conversation
Summary of ChangesHello @ShreejithSG, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for the GLM-Image model within the FastVideo framework. It integrates the GLM-Image's diffusion transformer and VAE, along with its unique autoregressive vision-language encoder for prior token generation. The changes include new model implementations, configuration structures, and a dedicated pipeline with distinct stages for preprocessing, denoising, and decoding, ensuring high-quality image generation and architectural compatibility with the original SGLang implementation. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for GLM-Image inference, a significant feature addition. The changes are extensive, including a new DiT model, VAE and pipeline configurations, new pipeline stages, and updates to the model loading infrastructure. The implementation is comprehensive and follows the existing structure of FastVideo well. I've identified a critical issue with how Classifier-Free Guidance (CFG) inputs are prepared, which would lead to incorrect outputs or runtime errors. I've also included several medium-severity suggestions to improve maintainability, flexibility, and robustness. Overall, this is a great contribution, and with the suggested fixes, it will be a solid addition to the project.
0ffb397 to
197ffdf
Compare
|
could you run pre-commit and also rebase to resolve conflicts? thanks |
197ffdf to
daee7e7
Compare
|
@SolitaryThinker I've rebased and fixed pre-commit issues! |
|
would the current CI support SSIM tests for this? @SolitaryThinker |
89dd8be to
9ca8b28
Compare
027c613 to
5c7dfe2
Compare
b9290bc to
f698d27
Compare
fd270f1 to
ee62319
Compare
|
Rebased onto current main ( |
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🙋 you
🔴 PR merge requirementsWaiting for
This rule is failing.
|
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🙋 you
🔴 PR merge requirementsWaiting for
This rule is failing.
|
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews
🔴 PR merge requirementsWaiting for
This rule is failing.
|
SolitaryThinker
left a comment
There was a problem hiding this comment.
Approving per review: all items from the 2026-01-25 request-changes are fixed or moot at head ee62319 (none of the flagged files are touched anymore; SDPAMetadata replaced the attn-mask mutation; all 36 threads resolved), both June pushbacks verified correct, CI 25/25 green.
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 PR merge requirements
|
Ported the GLM-Image architecture to FastVideo, enabling high-quality image generation.
Key features and fixes:
Test Plan
All tests are local (GPU + full
zai-org/GLM-Imageweights required; they skip cleanly in CI). Run on GB200, transformers 5.x, diffusers 0.37.x.Component parity (FastVideo component vs official HF
transformers/diffusers):Pipeline parity — full-pipeline pixel parity is ill-posed (stochastic AR + independent latent RNG), so the test injects matched
(prompt_embeds, prior_token_ids, latents)into both the diffusers pipeline and the realGlmImageDenoisingStage, then compares denoised latents (cosine + relative MAE) and the decoded image (uint8 MAE):End-to-end examples (smoke, real generation):
Test Results
Component parity — all non-skip PASS: