Skip to content

CogView4 (supports different length c and uc) #10649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 88 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
2640bcf
init
zRzRzRzRzRzRzR Jan 14, 2025
eba11fa
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Jan 14, 2025
6163679
encode with glm
zRzRzRzRzRzRzR Jan 14, 2025
6090ea7
draft schedule
zRzRzRzRzRzRzR Jan 15, 2025
c7d1227
feat(scheduler): Add CogView scheduler implementation
OleehyO Jan 16, 2025
e9f6626
Merge remote-tracking branch 'origin/cogview4' into cogview4
OleehyO Jan 16, 2025
549b357
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Jan 16, 2025
004d002
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Jan 16, 2025
f4457fb
feat(embeddings): add CogView 2D rotary positional embedding
OleehyO Jan 17, 2025
5f8d33b
Merge remote-tracking branch 'origin/cogview4' into cogview4
OleehyO Jan 17, 2025
9a93218
1
zRzRzRzRzRzRzR Jan 17, 2025
ca000dd
Update pipeline_cogview4.py
zRzRzRzRzRzRzR Jan 17, 2025
7ab4a3f
fix the timestep init and sigma
zRzRzRzRzRzRzR Jan 18, 2025
56ceaa6
update latent
zRzRzRzRzRzRzR Jan 19, 2025
a7179a2
draft patch(not work)
zRzRzRzRzRzRzR Jan 19, 2025
c9ddf50
Merge branch 'cogview4'
zRzRzRzRzRzRzR Jan 22, 2025
2f30cc1
Merge pull request #2 from zRzRzRzRzRzRzR/main
zRzRzRzRzRzRzR Jan 22, 2025
e6b8907
fix
zRzRzRzRzRzRzR Jan 22, 2025
0ab7260
[WIP][cogview4]: implement initial CogView4 pipeline
OleehyO Jan 23, 2025
f608f82
[WIP][cogview4][refactor]: Split condition/uncondition forward pass i…
OleehyO Jan 23, 2025
b86bfd4
use with -2 hidden state
zRzRzRzRzRzRzR Jan 23, 2025
c4d1e69
remove text_projector
zRzRzRzRzRzRzR Jan 23, 2025
7916140
1
zRzRzRzRzRzRzR Jan 23, 2025
f8945ce
[WIP] Add tensor-reload to align input from transformer block
OleehyO Jan 24, 2025
bf7f322
[WIP] for older glm
zRzRzRzRzRzRzR Jan 24, 2025
dd6568b
use with cogview4 transformers forward twice of u and uc
zRzRzRzRzRzRzR Jan 25, 2025
6f5407e
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Jan 25, 2025
9e5b991
Update convert_cogview4_to_diffusers.py
zRzRzRzRzRzRzR Jan 25, 2025
36b1682
remove this
zRzRzRzRzRzRzR Jan 26, 2025
804f5cc
Merge pull request #3 from zRzRzRzRzRzRzR/main
zRzRzRzRzRzRzR Jan 28, 2025
16c2397
use main example
zRzRzRzRzRzRzR Jan 28, 2025
601696d
change back
zRzRzRzRzRzRzR Jan 28, 2025
84115dc
reset
zRzRzRzRzRzRzR Jan 28, 2025
95a103f
setback
zRzRzRzRzRzRzR Jan 28, 2025
d932f67
back
zRzRzRzRzRzRzR Jan 28, 2025
b04f15d
back 4
zRzRzRzRzRzRzR Jan 28, 2025
5d33f3f
Fix qkv conversion logic for CogView4 to Diffusers format
zRzRzRzRzRzRzR Jan 28, 2025
b889b37
back5
zRzRzRzRzRzRzR Jan 28, 2025
e239c3c
revert to sat to cogview4 version
zRzRzRzRzRzRzR Jan 28, 2025
310da29
update a new convert from megatron
zRzRzRzRzRzRzR Jan 28, 2025
3bd6d30
[WIP][cogview4]: implement CogView4 attention processor
OleehyO Jan 28, 2025
f826aec
[cogview4] implement CogView4 transformer block
OleehyO Jan 28, 2025
8d8ed8b
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Jan 28, 2025
bf1fdc8
with new attn
zRzRzRzRzRzRzR Jan 28, 2025
6a3a07f
[bugfix] fix dimension mismatch in CogView4 attention
OleehyO Jan 28, 2025
de274f3
[cogview4][WIP]: update final normalization in CogView4 transformer
OleehyO Jan 28, 2025
e94999e
Merge remote-tracking branch 'origin/cogview4' into cogview4
OleehyO Jan 28, 2025
e238284
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Feb 1, 2025
a9b1e16
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Feb 5, 2025
46277b2
1
zRzRzRzRzRzRzR Feb 5, 2025
ebbaa5b
put back
zRzRzRzRzRzRzR Feb 5, 2025
f1ccdd2
Update transformer_cogview4.py
zRzRzRzRzRzRzR Feb 5, 2025
030a467
change time_shift
zRzRzRzRzRzRzR Feb 6, 2025
ad40575
Update pipeline_cogview4.py
zRzRzRzRzRzRzR Feb 6, 2025
81d39ee
change timesteps
zRzRzRzRzRzRzR Feb 6, 2025
45f9e88
fix
zRzRzRzRzRzRzR Feb 6, 2025
1dbeaa8
change text_encoder_id
zRzRzRzRzRzRzR Feb 6, 2025
f209600
[cogview4][rope] align RoPE implementation with Megatron
OleehyO Feb 6, 2025
992f5a3
[cogview4][bugfix] apply silu activation to time embeddings in CogView4
OleehyO Feb 6, 2025
03a1c3b
[cogview4][chore] clean up pipeline code
OleehyO Feb 6, 2025
dd34794
Merge remote-tracking branch 'origin/cogview4' into cogview4
OleehyO Feb 6, 2025
3dab073
[cogview4][scheduler] Implement CogView4 scheduler and pipeline
OleehyO Feb 6, 2025
63982d6
now It work
zRzRzRzRzRzRzR Feb 6, 2025
90a5706
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Feb 6, 2025
d4748e0
add timestep
zRzRzRzRzRzRzR Feb 7, 2025
95f851d
batch
zRzRzRzRzRzRzR Feb 7, 2025
cb56282
change convert scipt
zRzRzRzRzRzRzR Feb 7, 2025
fedf325
refactor pt. 1; make style
a-r-r-o-w Feb 10, 2025
90d29c7
Merge branch 'huggingface:main' into cogview4
zRzRzRzRzRzRzR Feb 10, 2025
4c01c9d
refactor pt. 2
a-r-r-o-w Feb 12, 2025
c1b8004
refactor pt. 3
a-r-r-o-w Feb 12, 2025
9d55d0a
add tests
a-r-r-o-w Feb 12, 2025
5e6de42
make fix-copies
a-r-r-o-w Feb 12, 2025
30dd0ad
Merge branch 'main' into cogview4
a-r-r-o-w Feb 12, 2025
2046cf2
update toctree.yml
a-r-r-o-w Feb 12, 2025
39e1198
use flow match scheduler instead of custom
a-r-r-o-w Feb 13, 2025
b566a9f
Merge branch 'main' into cogview4
a-r-r-o-w Feb 13, 2025
b4c9fde
remove scheduling_cogview.py
a-r-r-o-w Feb 13, 2025
a137e17
add tiktoken to test dependencies
a-r-r-o-w Feb 13, 2025
da420fb
Update src/diffusers/models/embeddings.py
a-r-r-o-w Feb 13, 2025
4003b9c
apply suggestions from review
a-r-r-o-w Feb 13, 2025
35c0ec6
use diffusers apply_rotary_emb
a-r-r-o-w Feb 13, 2025
d328c5e
update flow match scheduler to accept timesteps
a-r-r-o-w Feb 14, 2025
d637d3a
Merge branch 'main' into cogview4
a-r-r-o-w Feb 14, 2025
4c37ef0
fix comment
a-r-r-o-w Feb 14, 2025
90c240b
apply review sugestions
a-r-r-o-w Feb 14, 2025
5c11298
Merge branch 'main' into cogview4
a-r-r-o-w Feb 14, 2025
2f12b7a
Update src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py
a-r-r-o-w Feb 14, 2025
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
Prev Previous commit
Next Next commit
remove text_projector
  • Loading branch information
zRzRzRzRzRzRzR committed Jan 23, 2025
commit c4d1e69cbb3bef92703c7b8f603d5973aaf236ce
2 changes: 1 addition & 1 deletion src/diffusers/models/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def forward(
prompt_embeds = self.text_proj(prompt_embeds) # embed_dim: 4096 -> 4096
if negative_prompt_embeds is not None:
negative_prompt_embeds = self.text_proj(negative_prompt_embeds) # embed_dim: 4096 -> 4096

breakpoint()
return hidden_states, prompt_embeds, negative_prompt_embeds


Expand Down
4 changes: 0 additions & 4 deletions src/diffusers/pipelines/cogview4/pipeline_cogview4.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def __init__(
)
self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) if getattr(self, "vae", None) else 8
self.image_factor = 16
self.text_projector = torch.nn.Linear(4096, 4096)
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)

def _get_glm_embeds(
Expand Down Expand Up @@ -218,9 +217,6 @@ def _get_glm_embeds(
)
text_input_ids = torch.cat([pad_ids, text_input_ids], dim=1)
prompt_embeds = self.text_encoder(text_input_ids.to(self.text_encoder.model.device), output_hidden_states=True).hidden_states[-2]
self.text_projector.to(dtype=dtype, device=device)
prompt_embeds = self.text_projector(prompt_embeds)
breakpoint()
prompt_embeds = prompt_embeds.to(dtype=dtype, device=device)
_, seq_len, _= prompt_embeds.shape
prompt_embeds = prompt_embeds.repeat(1, num_images_per_prompt, 1)
Expand Down