WeGen2 / README.md
GrayShine's picture
Link the released WeGen2 paper and announce public weights
2801baa verified
|
Raw History Blame Contribute Delete
16.2 kB
---
language:
- en
- zh
tags:
- image-generation
- image-editing
- multimodal
- pixel-space
- mixture-of-experts
- arxiv:2612.01618
pipeline_tag: text-to-image
---
<p>
<a href="https://wechatcv.github.io/WeGen2/">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/cover-wide-56ff3ff86a04.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/cover-mobile-b12c579bab7a.webp" width="100%" alt="WeGen2 — Many worlds. One model. Native pixel-space generation, editing and composition. 61B total parameters; approximately 7B activated per generation token. Three unretouched example outputs: a Chinese handwritten letter, a layered paper lantern festival, and an embroidered portrait." decoding="async" loading="eager" fetchpriority="high" />
</picture>
</a>
</p>
<!-- RESEARCH_BYLINE_START -->
<a id="authors"></a>
<p style="text-align:center;font-size:16px;line-height:1.9;margin:20px auto 8px;max-width:850px;text-wrap:balance;">
<span><a href="https://scholar.google.com/citations?user=PGaDirMAAAAJ">Shaobin&nbsp;Zhuang</a><sup>1,*</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?user=_fnuIHUAAAAJ&amp;hl=zh-CN&amp;oi=ao">Zhipeng&nbsp;Huang</a><sup>3,*</sup></span> &ensp;
<span><a href="https://openreview.net/profile?id=%7ECanmiao_Fu1">Canmiao&nbsp;Fu</a><sup>3,†</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?hl=zh-CN&amp;user=Z2BTkNIAAAAJ">Xiaoqiang&nbsp;Zhou</a><sup>3</sup></span> &ensp;
<span><a href="https://openreview.net/profile?id=~Hao_Lu17">Hao&nbsp;Lu</a><sup>3</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?hl=zh-CN&amp;user=R_psgxkAAAAJ">Ying&nbsp;Zhang</a><sup>3</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?hl=zh-CN&amp;user=WDJL3gYAAAAJ">Chen&nbsp;Li</a><sup>3,‡</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?hl=zh-CN&amp;user=MJ2oeCUAAAAJ&amp;view_op=list_works&amp;sortby=pubdate">Jing&nbsp;LYU</a><sup>3</sup></span> &ensp;
<span><a href="https://scholar.google.com/citations?hl=zh-CN&amp;user=hD948dkAAAAJ">Yali&nbsp;Wang</a><sup>2,‡</sup></span>
</p>
<p align="center"><sub><sup>1</sup>&nbsp;SJTU &ensp; <sup>2</sup>&nbsp;MMLab @ SIAT &ensp; <sup>3</sup>&nbsp;WeChat Vision, Tencent Inc.</sub></p>
<p align="center"><strong>* Equal contribution</strong> · Shaobin Zhuang and Zhipeng Huang<br />
<strong>† Project leader</strong> · Canmiao Fu<br />
<strong>‡ Co-corresponding authors</strong> · Chen Li and Yali Wang</p>
<!-- RESEARCH_BYLINE_END -->
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;max-width:520px;margin:18px auto 26px;">
<a href="https://wechatcv.github.io/WeGen2/" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-project.svg?v=20261122" width="160" height="44" alt="Project Page" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://github.com/WeChatCV/WeGen2" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-code.svg?v=20261122" width="160" height="44" alt="Code" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://huggingface.co/GrayShine/WeGen2/tree/main" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-weights.svg?v=20261122" width="160" height="44" alt="Weights" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://wechatcv.github.io/WeGen2/#film" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-film.svg?v=20261122" width="160" height="44" alt="Watch the Film" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/inference.md" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/display/hf-button-guide-57025c79cafc.svg" width="160" height="44" alt="Inference Guide" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://arxiv.org/abs/2612.01618" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-paper-368f72172d7c.svg" width="160" height="44" alt="Paper" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
</div>
**WeGen2 unifies generation, editing and composition in native pixel space.** Text, reference images and earlier outputs share one context. **61B total parameters · approximately 7B activated per generation token.**
[Visual tour](#visual-tour) · [Architecture](#inside-the-model) · [Download](#download-and-create) · [Authors](#authors)
## Visual tour
One shared context for a visual idea—and everything it becomes.
<p>
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/visual-tour.md#create">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/create-wide-280e2df062a7.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/create-mobile-709d875fd5d9.webp" width="100%" alt="Six complete WeGen2 generations: cinematic laundrette, snowy owl in flight, Chinese flower-market poster, English pet-event poster, lighthouse oil painting, and a hand-cut WeGen2 inscription." decoding="async" loading="lazy" />
</picture>
</a>
</p>
<p>
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/visual-tour.md#edit">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/edit-wide-a94a5110a363.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/edit-mobile-a8ac36fc7fa7.webp" width="100%" alt="Image editing: the original fox and heron composition, followed by a two-colour woodcut reinterpretation. Both complete images are shown." decoding="async" loading="lazy" />
</picture>
</a>
</p>
<p>
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/visual-tour.md#combine">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/combine-wide-0f7b71784268.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/combine-mobile-dd26c3c2d463.webp" width="100%" alt="Multi-reference composition: two independent couture portraits are combined into a shared gallery scene. Both reference images and the complete generated result are shown." decoding="async" loading="lazy" />
</picture>
</a>
</p>
<p>
<a href="https://wechatcv.github.io/WeGen2/#references">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/try-on-shopping-wide-405d5b0be35b.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/try-on-shopping-mobile-c66cd64ac3d3.webp" width="100%" alt="Virtual try-on with the source portrait, eight full shopping-page screenshots and the outfit generated by WeGen2." decoding="async" loading="lazy" />
</picture>
</a>
</p>
[Open the full-resolution try-on](assets/tryon-outfit-86fe0524ea3b.jpg)
<p>
<a href="https://wechatcv.github.io/WeGen2/assets/gallery/the-jade-bird-programme.webp">
<picture>
<source media="(min-width: 701px)" srcset="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/sequence-wide-e646fc70cff2.webp" />
<img src="https://huggingface.co/GrayShine/WeGen2/resolve/main/assets/folio/sequence-mobile-26f1e9201b7b.webp" width="100%" alt="An Art Nouveau playbill goes through three edits. A white peacock replaces the phoenix, a new title and subtitle fill the upper cartouche, and a ticket panel adds the venue and performance time." decoding="async" loading="lazy" />
</picture>
</a>
</p>
<details>
<summary>The Jade Bird · full images and original prompts</summary>
**Generated input** · [Open full image](https://wechatcv.github.io/WeGen2/assets/gallery/the-jade-bird-programme-original.webp)
A stunning Art Nouveau theatre playbill, flat vertical print filling the frame, cobalt and gold. A single orange phoenix perches on a curving branch beneath a golden disc, its fiery feathers curling through white lilies. At the top a wide ivory cartouche bears the meticulously typeset dark headline "FIRE BIRD"; at the very bottom a narrow navy ribbon says "ACT I". Only these two inscriptions. Distinct, perfectly legible lettering, crisp rich handmade mosaic pieces and strong composition.
**White peacock** · [Open full image](https://wechatcv.github.io/WeGen2/assets/gallery/the-jade-bird-programme-first-edit.webp)
Replace the orange phoenix illustration with a white peacock with a long emerald train and a delicate white crest on the same branch. Keep the lilies, gold disc, artwork style, and both printed inscriptions FIRE BIRD and ACT I exactly as they are.
**Title and subtitle** · [Open full image](https://wechatcv.github.io/WeGen2/assets/gallery/the-jade-bird-programme-second-edit.webp)
On the upper ivory cartouche replace FIRE BIRD with “THE JADE BIRD”. Set the subtitle “A BALLET IN TWO ACTS” on a smaller line immediately beneath the title. Keep the white peacock, emerald train, gilded border and ACT I footer.
**Venue and time** · [Open full image](https://wechatcv.github.io/WeGen2/assets/gallery/the-jade-bird-programme.webp)
Make the bottom ACT I cartouche a two-line ivory ticket. Print “RIVER HALL” in small caps and “FRIDAY 18 JUNE AT 8 PM” below it. Keep the rest of the playbill exactly as printed.
</details>
[Original prompts and full images](https://github.com/WeChatCV/WeGen2/blob/main/docs/visual-tour.md) · [Explore the project page](https://wechatcv.github.io/WeGen2/)
## Inside the model
<p>
<a href="https://wechatcv.github.io/WeGen2/#method"><img src="assets/display/hf-architecture-bac3051fa460.svg" width="100%" alt="Native pixel-space modeling. A-MoT connects understanding and generation through joint attention. Image and timestep residual pathways are inside generation. A-MoE combines an always-active shared expert with a router-selected subset of experts. Expert count is schematic." decoding="async" loading="lazy" /></a>
</p>
**A-MoT** connects understanding and generation through joint attention, with image and timestep residual pathways inside generation. **A-MoE** combines shared and token-routed experts. Learned patch modules connect RGB images directly to the backbone, without a separate pretrained vision encoder or latent autoencoder at inference.
| Property | WeGen2 |
| --- | --- |
| Parameters | 61B total; approximately 7B activated per generation token |
| Representation | Native RGB pixels |
| Conditioning | Text, reference images and earlier outputs |
| Weight format | BF16 safetensors |
| Visual text | Chinese and English |
[Explore the architecture](https://wechatcv.github.io/WeGen2/#method) · [Results across 11 benchmarks](https://wechatcv.github.io/WeGen2/#results)
## Download and create
<p>
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/inference.md"><img src="assets/display/hf-start-50d2a0f12672.svg" width="100%" alt="Build with WeGen2. Your next idea starts here. Download, install, create." decoding="async" loading="lazy" /></a>
</p>
**Checkpoint access.** The weights are public and can be downloaded without requesting access or logging in. The download contains the WeGen2 image model and the BF16 [Qwen3-VL-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-30B-A3B-Instruct) prompt enhancer. WeGen2 reads its own checkpoint from the root directory and its prompt enhancer from `prompt_enhancer/`. The two sets of weights occupy about 186 GB on disk.
Use Python 3.10 or newer and an appropriate PyTorch build for your environment, then install the standalone inference package:
```bash
git clone https://github.com/WeChatCV/WeGen2.git
cd WeGen2
pip install -e .
hf download GrayShine/WeGen2 --local-dir ./weights/WeGen2
```
If you already have the WeGen2 image model, download the enhancer into the same directory:
```bash
hf download GrayShine/WeGen2 --include 'prompt_enhancer/*' --local-dir ./weights/WeGen2
```
The enhancer runs locally on CPU by default. To accelerate it, pass `pe_device` to `from_pretrained` or use the global CLI option `--pe-device`. Its BF16 weights require about 58 GiB of memory, plus working space.
Generate an image, then use it as the input to a new edit:
```python
from wegen2 import WeGen2Pipeline
pipe = WeGen2Pipeline.from_pretrained(
"./weights/WeGen2", devices="auto"
)
image = pipe.generate(
"An intricate paper mountain city, a red train on a curved bridge, "
"layered jade-green paper, warm studio light."
)
image.save("paper-world.png")
night = pipe.generate(
"Change the scene to night. Light the windows.",
images=[image],
)
night.save("paper-world-night.png")
```
For multiple references, pass an ordered list in `images`. For conversation-based creation, use `session = pipe.session()` and call `session.generate(...)` for each turn. The model uses its standalone inference package, rather than a Diffusers pipeline or Transformers auto class.
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;max-width:520px;margin:18px auto 26px;">
<a href="https://github.com/WeChatCV/WeGen2/blob/main/docs/inference.md" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/display/hf-button-guide-57025c79cafc.svg" width="160" height="44" alt="Inference Guide" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
<a href="https://huggingface.co/GrayShine/WeGen2/tree/main" style="display:flex;align-items:center;justify-content:center;min-height:44px;text-decoration:none;"><img src="assets/hf-button-weights.svg?v=20261122" width="160" height="44" alt="Weights" style="display:block;width:100%;height:auto;max-width:176px;margin:0;" decoding="async" loading="eager" /></a>
</div>
[Inference guide](https://wechatcv.github.io/WeGen2/guide/) · [中文使用说明](https://wechatcv.github.io/WeGen2/guide/zh/)
## Release status
The [project page](https://wechatcv.github.io/WeGen2/) and [standalone inference code](https://github.com/WeChatCV/WeGen2) are public. The [paper](https://arxiv.org/abs/2612.01618) is available on arXiv, and the [BF16 weights](https://huggingface.co/GrayShine/WeGen2/tree/main) are public.
<details>
<summary><b>Evaluation and scope</b></summary>
The accompanying report evaluates generation, editing and composition across 11 benchmarks. Selected gallery images demonstrate capabilities and do not replace aggregate evaluation.
Fine details, exact layouts and consistency across long edit sequences can remain challenging. Architectural outputs are visual concepts rather than dimensionally verified reconstructions. The featured sequence above uses successive image edits. Comic panels on the project page were generated sequentially and assembled; other multi-panel examples are generated as single images. Robot and driving examples are image edits, rather than physical task executions or validated control policies. Text decoding and visual question answering are experimental for the current image checkpoint; repeated punctuation can occur.
Memory requirements depend on image resolution, context length and runtime configuration.
</details>