Skip to content
Merged
Changes from all commits
Commits
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: 2 additions & 2 deletions lightx2v/shot_runner/rs2v_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def load_audio(audio_path, target_sr):
clip_input_info.overlap_latent = gen_latents[:, -1:]

if clip_input_info.return_result_tensor:
gen_video_list.append(video_seg.clone())
cut_audio_list.append(audio_seg)
gen_video_list.append(video_seg.clone().cpu().float())
cut_audio_list.append(audio_seg.cpu())
Comment on lines +158 to +159
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The implementation can be improved for efficiency and consistency:

  1. Redundant .clone(): On line 158, video_seg.clone() is unnecessary. Moving a tensor to CPU via .cpu() already creates a new copy. Since video_seg is a slice, .cpu() will only transfer the relevant data, making the GPU-side clone redundant.
  2. Consistency with PR description: The PR description mentions converting segments to float format before appending. This is missing for the audio segment on line 159. Adding .float() ensures consistency and aligns with the PR's objective.

Note: Applying these changes will make the subsequent conversions at lines 168 and 170 redundant, which you may want to clean up as well.

Suggested change
gen_video_list.append(video_seg.clone().cpu().float())
cut_audio_list.append(audio_seg.cpu())
gen_video_list.append(video_seg.cpu().float())
cut_audio_list.append(audio_seg.cpu().float())

elif self.va_controller.recorder is not None:
video_seg = torch.clamp(video_seg, -1, 1).to(torch.float).cpu()
video_seg = vae_to_comfyui_image_inplace(video_seg)
Expand Down
Loading