Paste everything below into the Content box. The part before “Instructions” is the record of what happened, and the instructions come after it.
Title: What I got wrong training a manga style LoRA on GLM-Image, and why my lines came out flat
What I was trying to do
I wanted an open model that follows plain-English panel descriptions and draws in my hand-inked manga style. I’d already trained the style on SDXL. I wanted something that follows plain descriptions better than tag prompts do.
What I tried first
Qwen-Image 2.1: the style attached early, but the lines stayed thinner and less solid than my SDXL output.
FLUX.2 Klein 9B: the 6500-step checkpoint looked right to me, but it’s a diffusion model and doesn’t take instructions like “remove the guy on the left”, which is what I wanted.
NextStep-1: glitches at 1024. The plain base model glitched too, so it wasn’t my training.
GLM-Image: a 9B AR planner plus a 7B diffusion decoder, which is where I ended up.
What happened with GLM-Image
The official finetune script only trains the AR model. I used it as it was and trained about 27 epochs, then kept epoch 25. The layout and anatomy followed my style, but the lines were even and too clean next to my hand-inked originals. I kept waiting for more epochs to fix the lines, but they never did, because the AR model only decides what is drawn and where. The decoder paints the strokes, and it was frozen the whole time.
I only worked out why after I took one of my own pages, turned it into tokens and repainted it with the stock decoder and no LoRA. The strokes came out straighter and more uniform than my original. Training a separate LoRA on the decoder fixed it: epochs 2 to 3 already showed my ink texture, and AR epoch 25 plus decoder epoch 3 gave varied line weight and scratchy hatching from a plain text prompt. That’s one prompt on one seed so far, so it’s an early result.
The mistakes
I used the training script without checking which parts of the model it actually trains.
I never compared the stock decoder’s output against my originals before the long run. That repaint test is cheap and would have shown the problem on day one.
I judged runs from single images and kept changing my mind. Use the same prompt and seed for every checkpoint and compare against the original.
I kept training the AR model long after it plateaued. Epochs 13 and 25 looked similar.
I judged earlier runs with the wrong preview settings (low CFG, few steps, no negative prompt), which made good models look bad.
I ran training attached to a terminal, and closing it killed the run. I also let checkpoints sit only on the pod instead of uploading them as they saved.
Files
The decoder trainer (train_decoder_lora.py) and the generation script (glm_gen.py) are attached.
Instructions
Captioning (do this before training)
Captioner: JoyCaption Beta One, fancyfeast/llama-joycaption-beta-one-hf-llava on Hugging Face, loaded in bf16 through transformers. I ran it on an A40, and it captioned 628 images in about 41 minutes.
Settings: system prompt “You are a helpful image captioner.”, the prompt below as the user message, sampling on, temperature 0.6, top_p 0.9, max 200 new tokens. One gotcha: the chat template plus the processor can put two BOS tokens at the start. If the input starts with two, drop one, or the captions come out worse.
Prompt for character images:
Describe only the subjects, how many people there are, pose, expression, clothing, composition, camera framing, and scene in this image, in 2 to 4 plain sentences. Do not mention the art style, line work, black and white, manga, screentones, hatching, or any artistic technique. Describe only what is clearly visible. Do not start with "This image shows" or similar phrases.Prompt for background images:
Describe the place shown in this image in 2 to 4 plain sentences: the type of location, the buildings or landscape, the main objects, the composition, the camera angle, and the time of day or weather if visible. Do not mention the art style, line work, black and white, manga, screentones, hatching, or any artistic technique. Describe only what is clearly visible. Do not start with "This image shows" or similar phrases.Filter: after each caption, strip any leading “This image shows” style opener. If the caption still contains a style word (art style, style, ink, line work, line art, hatching, outlines, manga, anime, comic, screentones, black and white, monochrome, greyscale, illustration, drawing, sketch, cartoon, artwork, panels and similar), regenerate it, up to 3 more times. If it still has one, delete the sentences that contain it. About 14% of my captions lost a sentence that way.
Final format: u616, <description> (use your own trigger word), saved as a .txt with the same name as the image. Strip filler endings like “time of day is not clearly visible” from the background captions.
For the decoder LoRA, captions barely matter, because the decoder only reads text inside quotation marks. They matter for the AR LoRA, which is what learns to follow your descriptions.
Data
A folder of images, each with an optional same-name .txt caption. Width and height must be divisible by 32 or the trainer skips the image. Images are used at their native size, with no cropping or resizing. I trained on 628 images.
Install (GlmImagePipeline needs recent transformers and diffusers from git):
pip install git+https://github.com/huggingface/transformers.git git+https://github.com/huggingface/diffusers.git peft accelerate safetensors pillow huggingface_hubTrain the decoder LoRA. It needs a GPU with about 40+ GB of memory and downloads GLM-Image the first time. It ran at about 19 minutes per epoch on an L40S with my 628 images:
python train_decoder_lora.py --data_dir my_images --out_dir my_decoder_loraIt saves one folder per epoch (epoch-1, epoch-2, ...). Resume with --resume my_decoder_lora/epoch-N. My settings were rank 32, alpha 32, learning rate 1e-4, 8 epochs.
Generate with both LoRAs stacked:
python glm_gen.py --lora my_ar_lora/epoch-25 --decoder_lora my_decoder_lora/epoch-3 --size 1024x1024 --steps 50 --guidance 1.5 --seed 7 --prompt "..."Pick an epoch: generate with each epoch on the same prompt and seed, and keep the earliest one that looks right.





Comments