Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug of i2v finetune #657

Merged
merged 3 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions finetune/datasets/i2v_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def __getitem__(self, index: int) -> Dict[str, Any]:
frames, image = self.preprocess(video, image)
frames = frames.to(self.device)
image = image.to(self.device)
image = self.image_transform(image)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also transform the image after line 146, thank you ~

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, to speed up the process, I'll add this line of code myself. Thank you for your contribution.

# Current shape of frames: [F, C, H, W]
frames = self.video_transform(frames)

Expand Down
2 changes: 1 addition & 1 deletion finetune/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def validate(self, step: int) -> None:
video, self.state.train_frames, self.state.train_height, self.state.train_width
)
# Convert video tensor (F, C, H, W) to list of PIL images
video = (video * 255).round().clamp(0, 255).to(torch.uint8)
video = video.round().clamp(0, 255).to(torch.uint8)
video = [Image.fromarray(frame.permute(1, 2, 0).cpu().numpy()) for frame in video]

logger.debug(
Expand Down