Skip to content

Commit 786fd43

Browse files
committed
Format z_image_pipeline.py with pyink
1 parent d067468 commit 786fd43

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/maxdiffusion/pipelines/z_image/z_image_pipeline.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,7 @@ def encode_prompt(self, prompt: Union[str, list[str]], max_sequence_length: int
137137

138138
if self.offload_encoders:
139139
# Restore parameters from CPU back to original device shardings
140-
state = jax.tree_util.tree_map(
141-
lambda x, sharding: jax.device_put(x, sharding),
142-
state,
143-
self._text_encoder_shardings
144-
)
140+
state = jax.tree_util.tree_map(lambda x, sharding: jax.device_put(x, sharding), state, self._text_encoder_shardings)
145141

146142
with self.mesh if self.mesh is not None else nullcontext():
147143
embeddings = encode_step(
@@ -155,6 +151,7 @@ def encode_prompt(self, prompt: Union[str, list[str]], max_sequence_length: int
155151

156152
if self.offload_encoders:
157153
from maxdiffusion import max_logging
154+
158155
s_offload = time.perf_counter()
159156
cpus = jax.devices("cpu")
160157
offloaded_state = jax.tree_util.tree_map(lambda x: jax.device_put(x, device=cpus[0]), state)

0 commit comments

Comments
 (0)