[diffusion] refactor: deprecate workloadtype (#15267)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Mick
2025-12-20 11:24:31 +08:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent 5529ab5895
commit c0f9b51992
17 changed files with 130 additions and 129 deletions
-19
View File
@@ -21,12 +21,8 @@ from functools import lru_cache, partial, wraps
from typing import Any, TypeVar, cast
import cloudpickle
import imageio
import numpy as np
import torch
import torchvision
import yaml
from einops import rearrange
from remote_pdb import RemotePdb
from torch.distributed.fsdp import MixedPrecisionPolicy
@@ -788,21 +784,6 @@ def best_output_size(w, h, dw, dh, expected_area):
return ow2, oh2
def save_decoded_latents_as_video(
decoded_latents: list[torch.Tensor], output_path: str, fps: int
):
# Process outputs
videos = rearrange(decoded_latents, "b c t h w -> t b c h w")
frames = []
for x in videos:
x = torchvision.utils.make_grid(x, nrow=6)
x = x.transpose(0, 1).transpose(1, 2).squeeze(-1)
frames.append((x * 255).numpy().astype(np.uint8))
os.makedirs(os.path.dirname(output_path), exist_ok=True)
imageio.mimsave(output_path, frames, fps=fps, format="mp4")
def calculate_dimensions(target_area, ratio):
width = math.sqrt(target_area * ratio)
height = width / ratio