mirror of
https://github.com/storytold/FineTrainers-Conditioning.git
synced 2026-10-18 07:33:20 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user