HobbyLM-image-2

rootxhacker/HobbyLM-image-2

作者
rootxhacker
任务
图像生成
下载量
0
点赞数
7
趋势分
7
许可证
apache-2.0
收录时间
2026/12/1

license: apache-2.0 pipeline_tag: text-to-image tags:

  • text-to-image
  • image-to-image
  • image-editing
  • text-rendering
  • flow-matching
  • dit
  • dc-ae language:
  • en base_model:
  • rootxhacker/HobbyLM-Image

HobbyLM-image-2

Try it in the browser: 🎨 HobbyLM Image 2 Space — generate, edit and spell, no setup.

Latest checkpoint of hobbylm-image-2. It does three things from one set of weights:

  1. Text-to-image at 512px and 768px.
  2. Instruction editing at 512px: give it an image and an instruction such as "make the car blue".
  3. Text rendering at 512px: words in double quotes in the prompt are drawn into the image.

All sample images below are first-seed outputs with no selection.

I post trained my previous version of Image Generation model to build HobbyLM-Image-2

Model

  • Size: 333M-parameter flow-matching DiT with a small text-fusion module.
  • Text encoders (not included): openai/clip-vit-large-patch14 (64 tokens) and google/flan-t5-large (96 tokens).
  • Autoencoder (not included): mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers (32x compression, 32 channels).
  • Tasks: the DiT takes a task id. 0 is text-to-image on one panel. 1 is editing on two panels, [noisy target | source image]. 2 is text rendering on two panels, [noisy target | glyph panel], where the glyph panel is the requested words in a plain font on white.

Text-to-image

768px, Euler 50 steps, CFG 4.5, timestep shift 1.5 (stored in the checkpoint).

Text-to-image samples

More text-to-image samples

Instruction editing

Each pair is a 512px image generated by the model (left) and the same model's edit of it (right). Text guidance 7.5, image guidance 1.2.

Editing samples

Ten of these twelve edits are clean. "Add a croissant beside the cup" replaced the cup, and "change the background to a beach" changed the ground but kept the buildings.

Text rendering

512px. The quoted words are placed in the glyph panel one word per line around the image centre.

Mixed samples: plain prompts and prompts with text

Text rendering on scene prompts

The second grid shows the limits: bold print on flat surfaces (shirts, road signs, book covers) is usually right, while neon, chalk, handwriting and words of seven or more letters are often misspelled. Without the glyph panel the model cannot spell.

Usage

from PIL import Image
from hobby_image.inference import HobbyImage

m = HobbyImage("model_v2_768u.pt")

# text-to-image (768px)
m.generate(["a red fox sitting in a snowy forest, golden hour light, photo"])[0].save("fox.jpg")

# instruction editing (any aspect ratio in, same size out)
m.edit([Image.open("fox.jpg")], ["make it autumn"])[0].save("fox_autumn.jpg")

# text rendering (words in double quotes)
m.text(['a wooden sign that says "OPEN" hanging on a cafe door'])[0].save("open.jpg")

Command line:

python -m hobby_image.inference --ckpt model_v2_768u.pt --prompt "a lighthouse on a cliff at sunset" --out out.jpg
python -m hobby_image.inference --ckpt model_v2_768u.pt --image in.jpg --prompt "make the car blue" --out edit.jpg
python -m hobby_image.inference --ckpt model_v2_768u.pt --text --prompt 'a road sign that says "NEXT EXIT"' --out sign.jpg

Requires torch, diffusers>=0.32, transformers, sentencepiece and pillow. samples/inference_check.jpg is the output of this script run end to end (generate, crop to a wide image, edit, text).

ComfyUI

comfyui/ComfyUI-HobbyLM-Image/ is a custom-node pack with four nodes: Loader, Generate, Edit and Text.

  1. Copy the folder to ComfyUI/custom_nodes/ComfyUI-HobbyLM-Image and install its requirements.txt.
  2. Put model_v2_768u.pt in ComfyUI/models/hobbylm/.
  3. Restart ComfyUI. The nodes are under HobbyLM-Image, and example_workflows/ has three workflows in API format.

These are wrapper nodes that run the model's own sampler; they do not connect to KSampler, CLIP Text Encode or VAE Decode. Their outputs are standard ComfyUI images. The pack was run in ComfyUI 0.46.0 through the /prompt endpoint: all three example workflows completed, and their outputs are below (text-to-image, edit source, edit result, glyph panel, text result). It was not tested by hand in the browser interface.

ComfyUI outputs

Scores (self-run, one seed)

Benchmarkmodel_v2_768model_v2_768u
GenEval 2 Soft-TIFA at 768px, GM / AM15.99 / 59.5515.92 / 61.06
GEdit-Bench-EN, Qwen2.5-VL-72B judge, SC / PQ / Ono editing6.03 / 6.00 / 5.35
Text benchmark, all words spelled rightcannot spell74%
  • GenEval 2: 800 prompts, Qwen3-VL-8B judge, official code. Differences under about 2 GM are noise.
  • GEdit-Bench-EN: all 606 English edits, official VIEScore prompts, judge served with vLLM. The same setup scores the released Step1X-Edit v1.0 outputs at 7.43 / 7.25 / 7.01 against a published 7.39 / 7.28 / 7.07. Sources are padded to a square, edited at 512px and cropped back.
  • Text benchmark: 100 prompts of my own (40 one-word, 40 two-word, 20 three-word texts on signs, shirts, mugs, posters and similar), read back by Qwen3-VL-8B. 74% have every requested word spelled correctly and 68% match exactly with no stray text. It is not a published benchmark, and scene-heavy prompts do worse (about half correct).
  • Emu Edit test set (previous checkpoint model_v2_768t, 500 edits): CLIP-dir 0.090, CLIP-im 0.859, L1 0.120, DINO 0.787. InstructPix2Pix through the same code scores 0.075 / 0.852 / 0.123 / 0.772.

Against other sub-1B models

Published numbers from each model's own paper or model card; generation settings differ, and the GenEval 2 hobby baselines are self-reported at 256px.

Sub-1B models on GenEval

Sub-1B models on GenEval 2

Files

  • model_v2_768u.pt: current EMA weights, all three tasks. Keys: sd (DiT), fusion (text fusion), cfg_dict, lat_std, sf, steps, v2 (metadata, including the timestep shifts).
  • model_v2_768.pt: the 23 November checkpoint, text-to-image only.
  • hobby_image/inference.py: the three entry points shown above.
  • hobby_image/dit.py, hobby_image/v2.py, hobby_image/glyph.py: model, text conditioning and glyph panel code.
  • comfyui/ComfyUI-HobbyLM-Image/: ComfyUI custom nodes, with their own copy of the hobby_image code.
  • samples/: the grids on this page, plus text_benchmark_768u.jpg (twelve images from the text benchmark).

Known weaknesses

  • Faces smaller than about 100px, hands, and wide laughing mouths.
  • Editing follows the instruction less reliably than large editors (GEdit-Bench overall 5.35 against about 7 for Step1X-Edit). Changing text inside an image, style transfer and motion changes are the weakest edit types.
  • The editor and the text mode are square, 512px only. Non-square edit inputs are padded.
  • Text rendering needs the glyph panel and works for one to three short words.
  • Counts above three people.

Credits

I would not be possible to train this model without credits from Modal.com

内容来源:Hugging Face 模型卡

在 Hugging Face 查看