Skip to content
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
ec9a82f
init
zRzRzRzRzRzRzR Jan 7, 2026
b98decf
add
zRzRzRzRzRzRzR Jan 7, 2026
57fd26d
add 1
zRzRzRzRzRzRzR Jan 7, 2026
bcc9c30
Update __init__.py
zRzRzRzRzRzRzR Jan 7, 2026
e13fb76
rename
zRzRzRzRzRzRzR Jan 7, 2026
adcc532
2
zRzRzRzRzRzRzR Jan 7, 2026
ec678a1
update
zRzRzRzRzRzRzR Jan 7, 2026
22fe6c9
init with encoder
zRzRzRzRzRzRzR Jan 7, 2026
b3d1b55
merge2pipeline
zRzRzRzRzRzRzR Jan 7, 2026
acd13d8
Merge branch 'huggingface:main' into cogview
zRzRzRzRzRzRzR Jan 7, 2026
e2b31f8
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 7, 2026
1cf277d
remove sop
zRzRzRzRzRzRzR Jan 7, 2026
170d0ba
remove useless func
zRzRzRzRzRzRzR Jan 7, 2026
144c075
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 8, 2026
041ddec
Merge branch 'main' into cogview
zRzRzRzRzRzRzR Jan 8, 2026
86f5ce4
up
yiyixuxu Jan 8, 2026
64f3842
Merge branch 'cogview' of https://github.com/zRzRzRzRzRzRzR/diffusers…
zRzRzRzRzRzRzR Jan 8, 2026
c65f224
review for work only
zRzRzRzRzRzRzR Jan 8, 2026
8d80b76
Merge branch 'main' into cogview
zRzRzRzRzRzRzR Jan 8, 2026
e70ebc0
change place
zRzRzRzRzRzRzR Jan 8, 2026
762f9a3
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 8, 2026
5a0a9fa
update
zRzRzRzRzRzRzR Jan 8, 2026
2ae574a
Update transformer_glm_image.py
zRzRzRzRzRzRzR Jan 8, 2026
264f930
1
zRzRzRzRzRzRzR Jan 8, 2026
e9b2c89
no negative_prompt for GLM-Image
zRzRzRzRzRzRzR Jan 8, 2026
e4f6549
remove CogView4LoraLoaderMixin
zRzRzRzRzRzRzR Jan 8, 2026
51f8015
refactor attention processor.
sayakpaul Jan 8, 2026
075b6a9
update
zRzRzRzRzRzRzR Jan 8, 2026
e2d4bda
fix
sayakpaul Jan 8, 2026
854e861
use staticmethod
zRzRzRzRzRzRzR Jan 8, 2026
7862217
update
zRzRzRzRzRzRzR Jan 8, 2026
1226fcb
up
sayakpaul Jan 8, 2026
68ebb42
up
sayakpaul Jan 8, 2026
3b154cf
Merge pull request #4 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 8, 2026
40559ca
update
zRzRzRzRzRzRzR Jan 8, 2026
19fc76b
Update glm_image.md
zRzRzRzRzRzRzR Jan 8, 2026
2c21dad
Merge branch 'main' into cogview
sayakpaul Jan 9, 2026
d2a5146
1
zRzRzRzRzRzRzR Jan 9, 2026
6cfc83b
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 9, 2026
d1373a9
Update transformer_glm_image.py
zRzRzRzRzRzRzR Jan 12, 2026
961fd79
using new transformers impl
zRzRzRzRzRzRzR Jan 12, 2026
6c39bcf
support
zRzRzRzRzRzRzR Jan 12, 2026
c77dee9
resolution change
zRzRzRzRzRzRzR Jan 12, 2026
7aaef79
Merge branch 'main' into cogview
sayakpaul Jan 13, 2026
95b88f9
fix-copies
sayakpaul Jan 13, 2026
c252ba1
Update src/diffusers/pipelines/glm_image/pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 13, 2026
2c9c740
Merge pull request #5 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
404689b
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 13, 2026
908030f
use cogview4
zRzRzRzRzRzRzR Jan 13, 2026
97f85ff
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 13, 2026
906792f
Update pipeline_glm_image.py
zRzRzRzRzRzRzR Jan 13, 2026
2f4c8d9
revert
zRzRzRzRzRzRzR Jan 13, 2026
1520728
update
zRzRzRzRzRzRzR Jan 13, 2026
9631b68
batch support
zRzRzRzRzRzRzR Jan 13, 2026
008e5ea
update
zRzRzRzRzRzRzR Jan 13, 2026
5bb959f
version guard glm image pipeline
sayakpaul Jan 13, 2026
44803f5
Merge pull request #6 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
512529f
validate prompt_embeds and prior_token_ids
sayakpaul Jan 13, 2026
4343f7f
Merge pull request #7 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
707a29a
try docs.
sayakpaul Jan 13, 2026
b20025a
Merge pull request #8 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
b8febaa
4
zRzRzRzRzRzRzR Jan 13, 2026
1633308
up
sayakpaul Jan 13, 2026
c87389b
up
sayakpaul Jan 13, 2026
bebf798
Merge pull request #9 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
1cd6d2d
skip properly
sayakpaul Jan 13, 2026
b71a19f
Merge pull request #10 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
97a751e
Merge branch 'main' into cogview
sayakpaul Jan 13, 2026
8f62cac
fix tests
sayakpaul Jan 13, 2026
b5cc307
Merge pull request #11 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
1636b43
up
sayakpaul Jan 13, 2026
806b232
Merge pull request #12 from huggingface/zRzRzRzRzRzRzR-cogview
zRzRzRzRzRzRzR Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@
title: Flux2Transformer2DModel
- local: api/models/flux_transformer
title: FluxTransformer2DModel
- local: api/models/glm_image_transformer2d
title: GlmImageTransformer2DModel
- local: api/models/hidream_image_transformer
title: HiDreamImageTransformer2DModel
- local: api/models/hunyuan_transformer2d
Expand Down Expand Up @@ -547,6 +549,8 @@
title: Flux2
- local: api/pipelines/control_flux_inpaint
title: FluxControlInpaint
- local: api/pipelines/glm_image
title: GLM-Image
- local: api/pipelines/hidream
title: HiDream-I1
- local: api/pipelines/hunyuandit
Expand Down
18 changes: 18 additions & 0 deletions docs/source/en/api/models/glm_image_transformer2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--Copyright 2025 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License. -->

# GlmImageTransformer2DModel

A Diffusion Transformer model for 2D data from [GlmImageTransformer2DModel]()

## GlmImageTransformer2DModel

[[autodoc]] GlmImageTransformer2DModel
31 changes: 31 additions & 0 deletions docs/source/en/api/pipelines/glm_image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->

# GLM-Image

> [!TIP]
> Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines.
This pipeline was contributed by [zRzRzRzRzRzRzR](https://github.com/zRzRzRzRzRzRzR). The original codebase can be found [here](https://huggingface.co/zai-org). The original weights can be found under [hf.co/zai-org](https://huggingface.co/zai-org).

## GlmImagePipeline

[[autodoc]] GlmImagePipeline
- all
- __call__

## GlmImagePipelineOutput

[[autodoc]] pipelines.cogview4.pipeline_output.GlmImagePipelineOutput
4 changes: 4 additions & 0 deletions src/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"FluxControlNetModel",
"FluxMultiControlNetModel",
"FluxTransformer2DModel",
"GlmImageTransformer2DModel",
"HiDreamImageTransformer2DModel",
"HunyuanDiT2DControlNetModel",
"HunyuanDiT2DModel",
Expand Down Expand Up @@ -490,6 +491,7 @@
"FluxKontextPipeline",
"FluxPipeline",
"FluxPriorReduxPipeline",
"GlmImagePipeline",
"HiDreamImagePipeline",
"HunyuanDiTControlNetPipeline",
"HunyuanDiTPAGPipeline",
Expand Down Expand Up @@ -977,6 +979,7 @@
FluxControlNetModel,
FluxMultiControlNetModel,
FluxTransformer2DModel,
GlmImageTransformer2DModel,
HiDreamImageTransformer2DModel,
HunyuanDiT2DControlNetModel,
HunyuanDiT2DModel,
Expand Down Expand Up @@ -1212,6 +1215,7 @@
FluxKontextPipeline,
FluxPipeline,
FluxPriorReduxPipeline,
GlmImagePipeline,
HiDreamImagePipeline,
HunyuanDiTControlNetPipeline,
HunyuanDiTPAGPipeline,
Expand Down
2 changes: 2 additions & 0 deletions src/diffusers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
_import_structure["transformers.transformer_easyanimate"] = ["EasyAnimateTransformer3DModel"]
_import_structure["transformers.transformer_flux"] = ["FluxTransformer2DModel"]
_import_structure["transformers.transformer_flux2"] = ["Flux2Transformer2DModel"]
_import_structure["transformers.transformer_glm_image"] = ["GlmImageTransformer2DModel"]
_import_structure["transformers.transformer_hidream_image"] = ["HiDreamImageTransformer2DModel"]
_import_structure["transformers.transformer_hunyuan_video"] = ["HunyuanVideoTransformer3DModel"]
_import_structure["transformers.transformer_hunyuan_video15"] = ["HunyuanVideo15Transformer3DModel"]
Expand Down Expand Up @@ -208,6 +209,7 @@
EasyAnimateTransformer3DModel,
Flux2Transformer2DModel,
FluxTransformer2DModel,
GlmImageTransformer2DModel,
HiDreamImageTransformer2DModel,
HunyuanDiT2DModel,
HunyuanImageTransformer2DModel,
Expand Down
31 changes: 31 additions & 0 deletions src/diffusers/models/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,37 @@ def forward(
return conditioning


class GlmImageCombinedTimestepSizeEmbeddings(nn.Module):
def __init__(self, embedding_dim: int, condition_dim: int, pooled_projection_dim: int, timesteps_dim: int = 256):
super().__init__()

self.time_proj = Timesteps(num_channels=timesteps_dim, flip_sin_to_cos=True, downscale_freq_shift=0)
self.condition_proj = Timesteps(num_channels=condition_dim, flip_sin_to_cos=True, downscale_freq_shift=0)
self.timestep_embedder = TimestepEmbedding(in_channels=timesteps_dim, time_embed_dim=embedding_dim)
self.condition_embedder = PixArtAlphaTextProjection(pooled_projection_dim, embedding_dim, act_fn="silu")

def forward(
self,
timestep: torch.Tensor,
target_size: torch.Tensor,
crop_coords: torch.Tensor,
hidden_dtype: torch.dtype,
) -> torch.Tensor:
timesteps_proj = self.time_proj(timestep)

crop_coords_proj = self.condition_proj(crop_coords.flatten()).view(crop_coords.size(0), -1)
target_size_proj = self.condition_proj(target_size.flatten()).view(target_size.size(0), -1)

# (B, 2 * condition_dim)
condition_proj = torch.cat([crop_coords_proj, target_size_proj], dim=1)

timesteps_emb = self.timestep_embedder(timesteps_proj.to(dtype=hidden_dtype)) # (B, embedding_dim)
condition_emb = self.condition_embedder(condition_proj.to(dtype=hidden_dtype)) # (B, embedding_dim)

conditioning = timesteps_emb + condition_emb
return conditioning


class HunyuanDiTAttentionPool(nn.Module):
# Copied from https://github.com/Tencent/HunyuanDiT/blob/cb709308d92e6c7e8d59d0dff41b74d35088db6a/hydit/modules/poolers.py#L6

Expand Down
1 change: 1 addition & 0 deletions src/diffusers/models/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .transformer_easyanimate import EasyAnimateTransformer3DModel
from .transformer_flux import FluxTransformer2DModel
from .transformer_flux2 import Flux2Transformer2DModel
from .transformer_glm_image import GlmImageTransformer2DModel
from .transformer_hidream_image import HiDreamImageTransformer2DModel
from .transformer_hunyuan_video import HunyuanVideoTransformer3DModel
from .transformer_hunyuan_video15 import HunyuanVideo15Transformer3DModel
Expand Down
Loading