(
num_samples: int,
height: int,
width: int,
device: torch.device,
dtype: torch.dtype,
seed: int,
)
| 15 | |
| 16 | |
| 17 | def get_noise( |
| 18 | num_samples: int, |
| 19 | height: int, |
| 20 | width: int, |
| 21 | device: torch.device, |
| 22 | dtype: torch.dtype, |
| 23 | seed: int, |
| 24 | ): |
| 25 | return torch.randn( |
| 26 | num_samples, |
| 27 | 16, |
| 28 | # allow for packing |
| 29 | 2 * math.ceil(height / 16), |
| 30 | 2 * math.ceil(width / 16), |
| 31 | dtype=dtype, |
| 32 | generator=torch.Generator(device="cpu").manual_seed(seed), |
| 33 | ).to(device) |
| 34 | |
| 35 | |
| 36 | def prepare(t5: HFEmbedder, clip: HFEmbedder, img: Tensor, prompt: str | list[str]) -> dict[str, Tensor]: |
no test coverage detected
searching dependent graphs…