$ show zai-org/GLM-Image
GLM-Image is an image generation model implementing a hybrid autoregressive + diffusion decoder architecture. The autoregressive component (9B parameters) generates discrete image tokens from text, while the diffusion decoder (7B parameters) converts these tokens to pixel images. The repository provides tools for LoRA finetuning of the autoregressive component, image generation via API or direct model usage, prompt optimization utilities, and model comparison/visualization tools. Entry points include finetune_lora.py for training, glm_image_cli.py for API-based generation, and compare.py/plot_loss.py for evaluation and monitoring.
The LLM identified 3 files worth highlighting for reuse:
Comprehensive dataset loading utility supporting multiple formats (HuggingFace, local, webdataset) for text-to-image and image-to-image tasks. Handles image transformations, tokenization, batching, and streaming with proper error handling. Demonstrates strong data engineering practices through modular design, clear separation of concerns, and robust processing pipelines that could be extracted for other vision-language modeling projects.
Standardized tool for comparing base model vs LoRA-finetuned model outputs through side-by-side visual comparison grids. Handles multiple checkpoints, prompts, and generation parameters while gracefully managing generation failures. Features include automatic label placement, prompt display, and individual image export. The component demonstrates reusable evaluation patterns applicable to any generative model comparison scenario.
Sophisticated prompt optimization system with language-specific rules (Chinese/English) for enhancing image generation quality. Implements detailed guidelines for different image categories (portraits, text-containing scenes, general images) including entity preservation, style specification, and logical detail enhancement. Shows non-obvious prompt engineering skill through structured, rule-based transformation that could be adapted for other text-to-image systems.