Skip to content

Commit 8ff6bc5

Browse files
committed
pyink tests
1 parent 42f8dfb commit 8ff6bc5

8 files changed

Lines changed: 1996 additions & 1973 deletions

File tree

src/maxdiffusion/generate_flux2klein.py

Lines changed: 497 additions & 490 deletions
Large diffs are not rendered by default.

src/maxdiffusion/models/embeddings_flax.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,21 +510,26 @@ def __call__(self, timestep, guidance, pooled_projection=None):
510510
)(timesteps_proj.astype(dtype))
511511

512512
if self.guidance_embeds and guidance is not None:
513-
guidance_proj = FlaxTimesteps(dim=256, flip_sin_to_cos=True, freq_shift=0)(guidance)
514-
guidance_emb = FlaxTimestepEmbedding(
515-
time_embed_dim=self.embedding_dim, dtype=self.dtype, weights_dtype=self.weights_dtype
516-
)(guidance_proj.astype(dtype))
517-
time_guidance_emb = timestep_emb + guidance_emb
513+
guidance_proj = FlaxTimesteps(dim=256, flip_sin_to_cos=True, freq_shift=0)(guidance)
514+
guidance_emb = FlaxTimestepEmbedding(
515+
time_embed_dim=self.embedding_dim, dtype=self.dtype, weights_dtype=self.weights_dtype
516+
)(guidance_proj.astype(dtype))
517+
time_guidance_emb = timestep_emb + guidance_emb
518518
else:
519-
time_guidance_emb = timestep_emb
520-
521-
if pooled_projection is not None and hasattr(self, "pooled_projection_dim") and self.pooled_projection_dim and self.pooled_projection_dim > 0:
522-
pooled_projections = PixArtAlphaTextProjection(
523-
self.embedding_dim, act_fn="silu", dtype=self.dtype, weights_dtype=self.weights_dtype, precision=self.precision
524-
)(pooled_projection)
525-
conditioning = time_guidance_emb + pooled_projections
519+
time_guidance_emb = timestep_emb
520+
521+
if (
522+
pooled_projection is not None
523+
and hasattr(self, "pooled_projection_dim")
524+
and self.pooled_projection_dim
525+
and self.pooled_projection_dim > 0
526+
):
527+
pooled_projections = PixArtAlphaTextProjection(
528+
self.embedding_dim, act_fn="silu", dtype=self.dtype, weights_dtype=self.weights_dtype, precision=self.precision
529+
)(pooled_projection)
530+
conditioning = time_guidance_emb + pooled_projections
526531
else:
527-
conditioning = time_guidance_emb
532+
conditioning = time_guidance_emb
528533

529534
return conditioning
530535

0 commit comments

Comments
 (0)