eeuuia commited on
Commit
37709cf
·
verified ·
1 Parent(s): edd6b83

Update api/ltx/ltx_aduc_pipeline.py

Browse files
Files changed (1) hide show
  1. api/ltx/ltx_aduc_pipeline.py +19 -19
api/ltx/ltx_aduc_pipeline.py CHANGED
@@ -133,9 +133,8 @@ class LtxAducPipeline:
133
 
134
  temp_latent_paths = []
135
  overlap_condition_item: Optional[LatentConditioningItem] = None
136
-
137
  current_conditions = initial_conditions
138
-
139
  try:
140
  for i, chunk_prompt in enumerate(prompt_list):
141
  logging.info(f"Processing scene {i+1}/{num_chunks}: '{chunk_prompt[:50]}...'")
@@ -143,15 +142,15 @@ class LtxAducPipeline:
143
  current_frames_base = frames_per_chunk if i < num_chunks - 1 else total_frames - ((num_chunks - 1) * frames_per_chunk)
144
  current_frames = current_frames_base + (overlap_frames if i > 0 else 0)
145
  current_frames = self._align(current_frames, alignment_rule='n*8+1')
146
-
147
- current_conditions = initial_conditions if i == 0 else []
148
- if overlap_condition_item: current_conditions.append(overlap_condition_item)
149
-
150
- chunk_latents = self._generate_single_chunk_low(
151
- prompt_x=chunk_prompt, num_frames_x=current_frames, seed_x=used_seed,
152
- conditioning_items_x=current_conditions,
153
- **kwargs
154
- )
155
  if chunk_latents is None: raise RuntimeError(f"Failed to generate latents for scene {i+1}.")
156
 
157
  if is_narrative and i < num_chunks - 1:
@@ -161,8 +160,11 @@ class LtxAducPipeline:
161
  media_frame_number=0,
162
  conditioning_strength=1.0
163
  )
164
- current_conditions=overlap_condition_item
165
-
 
 
 
166
  if i > 0: chunk_latents = chunk_latents[:, :, overlap_frames:, :, :]
167
 
168
  chunk_path = RESULTS_DIR / f"temp_chunk_{i}_{used_seed}.pt"
@@ -221,8 +223,6 @@ class LtxAducPipeline:
221
 
222
  @log_function_io
223
  def _generate_single_chunk_low(
224
- prompt_x:str, num_frames_x:int, seed_x:int,
225
- conditioning_items_x:LatentConditioningItem,
226
  **kwargs
227
  ) -> Optional[torch.Tensor]:
228
  """[WORKER] Calls the pipeline to generate a single chunk of latents."""
@@ -234,13 +234,13 @@ class LtxAducPipeline:
234
 
235
  call_kwargs = {
236
  "cfg_star_rescale": "true",
237
- "prompt": prompt_x,
238
  "negative_prompt": kwargs['negative_prompt'],
239
  "height": downscaled_height,
240
  "width": downscaled_width,
241
- "num_frames": num_frames_x,
242
  "frame_rate": int(DEFAULT_FPS),
243
- "generator": torch.Generator(device=self.main_device).manual_seed(seed_x),
244
  "output_type": "latent",
245
  "media_items": None,
246
  "decode_timestep": self.config["decode_timestep"],
@@ -260,7 +260,7 @@ class LtxAducPipeline:
260
  call_kwargs.update(first_pass_config)
261
  ltx_configs_override = kwargs.get("ltx_configs_override", {}).copy()
262
  call_kwargs.update(ltx_configs_override)
263
- call_kwargs['conditioning_items'] = conditioning_items_x
264
 
265
  with torch.autocast(device_type=self.main_device.type, dtype=self.runtime_autocast_dtype, enabled="cuda" in self.main_device.type):
266
  latents_raw = self.pipeline(**call_kwargs).images
 
133
 
134
  temp_latent_paths = []
135
  overlap_condition_item: Optional[LatentConditioningItem] = None
 
136
  current_conditions = initial_conditions
137
+
138
  try:
139
  for i, chunk_prompt in enumerate(prompt_list):
140
  logging.info(f"Processing scene {i+1}/{num_chunks}: '{chunk_prompt[:50]}...'")
 
142
  current_frames_base = frames_per_chunk if i < num_chunks - 1 else total_frames - ((num_chunks - 1) * frames_per_chunk)
143
  current_frames = current_frames_base + (overlap_frames if i > 0 else 0)
144
  current_frames = self._align(current_frames, alignment_rule='n*8+1')
145
+
146
+ kwargs.pop("prompt", None)
147
+ kwargs.pop("num_frames", None)
148
+ kwargs.pop("seed", None)
149
+
150
+ kwargs["prompt"] = chunk_prompt
151
+ kwargs["num_frames"] = current_frames
152
+
153
+ chunk_latents = self._generate_single_chunk_low(**kwargs)
154
  if chunk_latents is None: raise RuntimeError(f"Failed to generate latents for scene {i+1}.")
155
 
156
  if is_narrative and i < num_chunks - 1:
 
160
  media_frame_number=0,
161
  conditioning_strength=1.0
162
  )
163
+ kwargs.pop("conditioning_items", None)
164
+ kwargs["conditioning_items"] = overlap_condition_item
165
+ else:
166
+ kwargs.pop("conditioning_items", None)
167
+
168
  if i > 0: chunk_latents = chunk_latents[:, :, overlap_frames:, :, :]
169
 
170
  chunk_path = RESULTS_DIR / f"temp_chunk_{i}_{used_seed}.pt"
 
223
 
224
  @log_function_io
225
  def _generate_single_chunk_low(
 
 
226
  **kwargs
227
  ) -> Optional[torch.Tensor]:
228
  """[WORKER] Calls the pipeline to generate a single chunk of latents."""
 
234
 
235
  call_kwargs = {
236
  "cfg_star_rescale": "true",
237
+ "prompt": kwargs["prompt"],
238
  "negative_prompt": kwargs['negative_prompt'],
239
  "height": downscaled_height,
240
  "width": downscaled_width,
241
+ "num_frames": kwargs["num_frames_x"],
242
  "frame_rate": int(DEFAULT_FPS),
243
+ "generator": torch.Generator(device=self.main_device).manual_seed(kwargs['seed_x']),
244
  "output_type": "latent",
245
  "media_items": None,
246
  "decode_timestep": self.config["decode_timestep"],
 
260
  call_kwargs.update(first_pass_config)
261
  ltx_configs_override = kwargs.get("ltx_configs_override", {}).copy()
262
  call_kwargs.update(ltx_configs_override)
263
+ call_kwargs['conditioning_items'] = kwargs["conditioning_items"]
264
 
265
  with torch.autocast(device_type=self.main_device.type, dtype=self.runtime_autocast_dtype, enabled="cuda" in self.main_device.type):
266
  latents_raw = self.pipeline(**call_kwargs).images