| import math | |
| from typing import Any | |
| import torch | |
| import torch.nn.functional as F | |
| COND = 0 | |
| UNCOND = 1 | |
| CondLike = list[tuple[torch.Tensor, dict[str, Any]]] | |
| def lcm_for_list(numbers: list): | |
| current_lcm = numbers[0] | |
| for number in numbers[1:]: | |
| current_lcm = math.lcm(current_lcm, number) | |
| return current_lcm | |
| def reshape_mask(mask: torch.Tensor, size: tuple[int, int], bs: int, num_tokens: int) -> torch.Tensor: | |
| num_conds = mask.shape[0] | |
| mask_downsample = F.interpolate(mask, size=size, mode="nearest") | |
| mask_downsample_reshaped = mask_downsample.view(num_conds, num_tokens, 1).repeat_interleave(bs, dim=0) | |
| return mask_downsample_reshaped | |
Xet Storage Details
- Size:
- 675 Bytes
- Xet hash:
- 36ac2d4c49a97eab463ee2219b8c8c6938ba03fedf04caebc0eb436ba88860a6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.