RoPE fixes for 1.5, bfloat16 support in prepare_dataset, gradient_accumulation grad norm undefined fix (#107)

* rope scaling fixes for cog 1.5

* grad norm log fix

* bf16 prepare dataset fix

* update

* style
This commit is contained in:
Aryan
2024-12-02 15:12:12 +05:30
committed by GitHub
parent 76a9f2b911
commit 6c41984d8a
5 changed files with 58 additions and 30 deletions
+3 -1
View File
@@ -287,11 +287,13 @@ to_pil_image = transforms.ToPILImage(mode="RGB")
def save_image(image: torch.Tensor, path: pathlib.Path) -> None:
image = to_pil_image(image)
image = image.to(dtype=torch.float32).clamp(-1, 1)
image = to_pil_image(image.float())
image.save(path)
def save_video(video: torch.Tensor, path: pathlib.Path, fps: int = 8) -> None:
video = video.to(dtype=torch.float32).clamp(-1, 1)
video = [to_pil_image(frame) for frame in video]
export_to_video(video, path, fps=fps)