feat: Enhanced compatibility and performance in ShotRS2VPipeline#970
Merged
helloyongyang merged 1 commit intomainfrom Mar 31, 2026
Merged
feat: Enhanced compatibility and performance in ShotRS2VPipeline#970helloyongyang merged 1 commit intomainfrom
helloyongyang merged 1 commit intomainfrom
Conversation
…oving generated video/audio segments to CPU and converting to float format before appending.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates rs2v_infer.py to move video and audio segments to the CPU and cast video segments to float before appending them to result lists. The review feedback points out a redundant .clone() call on the video segment and recommends adding a .float() conversion to the audio segment for consistency.
Comment on lines
+158
to
+159
| gen_video_list.append(video_seg.clone().cpu().float()) | ||
| cut_audio_list.append(audio_seg.cpu()) |
Contributor
There was a problem hiding this comment.
The implementation can be improved for efficiency and consistency:
- Redundant
.clone(): On line 158,video_seg.clone()is unnecessary. Moving a tensor to CPU via.cpu()already creates a new copy. Sincevideo_segis a slice,.cpu()will only transfer the relevant data, making the GPU-side clone redundant. - 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()) |
helloyongyang
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
by moving generated video/audio segments to CPU and converting to float format before appending.