Uploaded using `kernel-builder`.
Browse files- build/torch211-cxx11-cu128-x86_64-linux/__init__.py +218 -0
- build/torch211-cxx11-cu128-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so} +2 -2
- build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu128-x86_64-linux/metadata.json +1 -1
- build/torch211-cxx11-cu130-x86_64-linux/__init__.py +218 -0
- build/torch211-cxx11-cu130-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so} +2 -2
- build/torch211-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu130-x86_64-linux/metadata.json +1 -1
- build/torch212-cxx11-cu130-x86_64-linux/__init__.py +218 -0
- build/torch212-cxx11-cu130-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so} +2 -2
- build/torch212-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu130-x86_64-linux/metadata.json +1 -1
- build/torch212-cxx11-cu132-x86_64-linux/__init__.py +218 -0
- build/torch212-cxx11-cu132-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so} +2 -2
- build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu132-x86_64-linux/metadata.json +1 -1
build/torch211-cxx11-cu128-x86_64-linux/__init__.py
CHANGED
|
@@ -94,6 +94,115 @@ def _cast_bf16_to_fp32_fake(src: torch.Tensor, dst: torch.Tensor) -> None:
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 98 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 99 |
|
|
@@ -175,12 +284,121 @@ def cast_bf16_to_fp32(src: torch.Tensor, *, out: Optional[torch.Tensor] = None)
|
|
| 175 |
return out
|
| 176 |
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
__all__ = [
|
| 179 |
"add_bf16",
|
|
|
|
|
|
|
| 180 |
"cast_bf16_to_fp32",
|
| 181 |
"cfg_combine_into_residual_bf16",
|
| 182 |
"cfg_combine_into_residual_fp16",
|
| 183 |
"euler_step_bf16",
|
|
|
|
| 184 |
"motus_decode_postprocess_bf16_to_fp32",
|
|
|
|
| 185 |
"teacher_force_first_frame_bf16",
|
|
|
|
| 186 |
]
|
|
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
| 97 |
+
@torch.library.register_fake(add_op_namespace_prefix("pack_tail_bf16"))
|
| 98 |
+
def _pack_tail_bf16_fake(tail: torch.Tensor, flat_dim: int, out: torch.Tensor) -> None:
|
| 99 |
+
if tail.dim() != 1 or out.shape != (flat_dim,) or flat_dim < tail.numel():
|
| 100 |
+
raise RuntimeError("pack_tail_bf16 expects tail (N,), flat_dim >= N, out (flat_dim,)")
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_zero_tail_bf16"))
|
| 105 |
+
def _add_bias_zero_tail_bf16_fake(
|
| 106 |
+
input: torch.Tensor,
|
| 107 |
+
bias: torch.Tensor,
|
| 108 |
+
valid_cols: int,
|
| 109 |
+
out: torch.Tensor,
|
| 110 |
+
) -> None:
|
| 111 |
+
if (
|
| 112 |
+
input.dim() != 2
|
| 113 |
+
or bias.shape != (input.shape[1],)
|
| 114 |
+
or out.shape != input.shape
|
| 115 |
+
or valid_cols < 0
|
| 116 |
+
or valid_cols > input.shape[1]
|
| 117 |
+
):
|
| 118 |
+
raise RuntimeError(
|
| 119 |
+
"add_bias_zero_tail_bf16 expects input/out (rows, cols), "
|
| 120 |
+
"bias (cols,), valid_cols in [0, cols]"
|
| 121 |
+
)
|
| 122 |
+
return None
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
@torch.library.register_fake(add_op_namespace_prefix("extract_tail_f32_to_bf16"))
|
| 126 |
+
def _extract_tail_f32_to_bf16_fake(
|
| 127 |
+
flat: torch.Tensor,
|
| 128 |
+
tail_numel: int,
|
| 129 |
+
out: torch.Tensor,
|
| 130 |
+
) -> None:
|
| 131 |
+
if flat.dim() != 1 or tail_numel <= 0 or tail_numel > flat.numel() or out.shape != (tail_numel,):
|
| 132 |
+
raise RuntimeError(
|
| 133 |
+
"extract_tail_f32_to_bf16 expects flat (N,), tail_numel in [1, N], out (tail_numel,)"
|
| 134 |
+
)
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_pair_bf16"))
|
| 139 |
+
def _add_bias_pair_bf16_fake(
|
| 140 |
+
input: torch.Tensor,
|
| 141 |
+
bias_a: torch.Tensor,
|
| 142 |
+
bias_b: torch.Tensor,
|
| 143 |
+
out: torch.Tensor,
|
| 144 |
+
) -> None:
|
| 145 |
+
if (
|
| 146 |
+
input.dim() != 2
|
| 147 |
+
or bias_a.shape != (input.shape[1],)
|
| 148 |
+
or bias_b.shape != bias_a.shape
|
| 149 |
+
or out.shape != input.shape
|
| 150 |
+
):
|
| 151 |
+
raise RuntimeError(
|
| 152 |
+
"add_bias_pair_bf16 expects input/out (rows, hidden) and biases (hidden,)"
|
| 153 |
+
)
|
| 154 |
+
return None
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@torch.library.register_fake(add_op_namespace_prefix("unipc_step_f32_bf16"))
|
| 158 |
+
def _unipc_step_f32_bf16_fake(
|
| 159 |
+
sample: torch.Tensor,
|
| 160 |
+
velocity: torch.Tensor,
|
| 161 |
+
prev_m1: torch.Tensor,
|
| 162 |
+
prev_m2: torch.Tensor,
|
| 163 |
+
prev_last_sample: torch.Tensor,
|
| 164 |
+
sigma: float,
|
| 165 |
+
corrector_order: int,
|
| 166 |
+
predictor_order: int,
|
| 167 |
+
c_sample: float,
|
| 168 |
+
c_last: float,
|
| 169 |
+
c_prev_m1: float,
|
| 170 |
+
c_prev_m2: float,
|
| 171 |
+
c_curr_m: float,
|
| 172 |
+
p_sample: float,
|
| 173 |
+
p_curr_m: float,
|
| 174 |
+
p_prev_m1: float,
|
| 175 |
+
next_sample: torch.Tensor,
|
| 176 |
+
current_m: torch.Tensor,
|
| 177 |
+
current_last_sample: torch.Tensor,
|
| 178 |
+
) -> None:
|
| 179 |
+
del (
|
| 180 |
+
sigma,
|
| 181 |
+
corrector_order,
|
| 182 |
+
predictor_order,
|
| 183 |
+
c_sample,
|
| 184 |
+
c_last,
|
| 185 |
+
c_prev_m1,
|
| 186 |
+
c_prev_m2,
|
| 187 |
+
c_curr_m,
|
| 188 |
+
p_sample,
|
| 189 |
+
p_curr_m,
|
| 190 |
+
p_prev_m1,
|
| 191 |
+
)
|
| 192 |
+
for tensor in (
|
| 193 |
+
velocity,
|
| 194 |
+
prev_m1,
|
| 195 |
+
prev_m2,
|
| 196 |
+
prev_last_sample,
|
| 197 |
+
next_sample,
|
| 198 |
+
current_m,
|
| 199 |
+
current_last_sample,
|
| 200 |
+
):
|
| 201 |
+
if tensor.shape != sample.shape:
|
| 202 |
+
raise RuntimeError("all UniPC tensors must have the same shape")
|
| 203 |
+
return None
|
| 204 |
+
|
| 205 |
+
|
| 206 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 207 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 208 |
|
|
|
|
| 284 |
return out
|
| 285 |
|
| 286 |
|
| 287 |
+
def pack_tail_bf16(
|
| 288 |
+
tail: torch.Tensor,
|
| 289 |
+
flat_dim: int,
|
| 290 |
+
*,
|
| 291 |
+
out: Optional[torch.Tensor] = None,
|
| 292 |
+
) -> torch.Tensor:
|
| 293 |
+
"""Place a BF16 tail at the end of a zero-filled flat BF16 tensor."""
|
| 294 |
+
|
| 295 |
+
if out is None:
|
| 296 |
+
out = torch.empty((flat_dim,), device=tail.device, dtype=tail.dtype)
|
| 297 |
+
ops.pack_tail_bf16(tail, int(flat_dim), out)
|
| 298 |
+
return out
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def add_bias_zero_tail_bf16(
|
| 302 |
+
input: torch.Tensor,
|
| 303 |
+
bias: torch.Tensor,
|
| 304 |
+
valid_cols: int,
|
| 305 |
+
*,
|
| 306 |
+
out: Optional[torch.Tensor] = None,
|
| 307 |
+
) -> torch.Tensor:
|
| 308 |
+
"""Add a column bias and zero columns at or beyond ``valid_cols``."""
|
| 309 |
+
|
| 310 |
+
if out is None:
|
| 311 |
+
out = torch.empty_like(input)
|
| 312 |
+
ops.add_bias_zero_tail_bf16(input, bias, int(valid_cols), out)
|
| 313 |
+
return out
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def extract_tail_f32_to_bf16(
|
| 317 |
+
flat: torch.Tensor,
|
| 318 |
+
tail_numel: int,
|
| 319 |
+
*,
|
| 320 |
+
out: Optional[torch.Tensor] = None,
|
| 321 |
+
) -> torch.Tensor:
|
| 322 |
+
"""Extract the final ``tail_numel`` FP32 values and cast them to BF16."""
|
| 323 |
+
|
| 324 |
+
if out is None:
|
| 325 |
+
out = torch.empty((tail_numel,), device=flat.device, dtype=torch.bfloat16)
|
| 326 |
+
ops.extract_tail_f32_to_bf16(flat, int(tail_numel), out)
|
| 327 |
+
return out
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def add_bias_pair_bf16(
|
| 331 |
+
input: torch.Tensor,
|
| 332 |
+
bias_a: torch.Tensor,
|
| 333 |
+
bias_b: torch.Tensor,
|
| 334 |
+
*,
|
| 335 |
+
out: Optional[torch.Tensor] = None,
|
| 336 |
+
) -> torch.Tensor:
|
| 337 |
+
"""Add two BF16 row-broadcast biases with BF16 rounding after each add."""
|
| 338 |
+
|
| 339 |
+
if out is None:
|
| 340 |
+
out = torch.empty_like(input)
|
| 341 |
+
ops.add_bias_pair_bf16(input, bias_a, bias_b, out)
|
| 342 |
+
return out
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def unipc_step_f32_bf16(
|
| 346 |
+
sample: torch.Tensor,
|
| 347 |
+
velocity: torch.Tensor,
|
| 348 |
+
prev_m1: torch.Tensor,
|
| 349 |
+
prev_m2: torch.Tensor,
|
| 350 |
+
prev_last_sample: torch.Tensor,
|
| 351 |
+
sigma: float,
|
| 352 |
+
corrector_order: int,
|
| 353 |
+
predictor_order: int,
|
| 354 |
+
corrector_coefficients: tuple[float, float, float, float, float],
|
| 355 |
+
predictor_coefficients: tuple[float, float, float],
|
| 356 |
+
*,
|
| 357 |
+
next_sample: Optional[torch.Tensor] = None,
|
| 358 |
+
current_m: Optional[torch.Tensor] = None,
|
| 359 |
+
current_last_sample: Optional[torch.Tensor] = None,
|
| 360 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 361 |
+
"""Run one UniPC predictor/corrector update."""
|
| 362 |
+
|
| 363 |
+
if len(corrector_coefficients) != 5:
|
| 364 |
+
raise RuntimeError("corrector_coefficients must have five values")
|
| 365 |
+
if len(predictor_coefficients) != 3:
|
| 366 |
+
raise RuntimeError("predictor_coefficients must have three values")
|
| 367 |
+
if next_sample is None:
|
| 368 |
+
next_sample = torch.empty_like(sample)
|
| 369 |
+
if current_m is None:
|
| 370 |
+
current_m = torch.empty_like(sample)
|
| 371 |
+
if current_last_sample is None:
|
| 372 |
+
current_last_sample = torch.empty_like(sample)
|
| 373 |
+
ops.unipc_step_f32_bf16(
|
| 374 |
+
sample,
|
| 375 |
+
velocity,
|
| 376 |
+
prev_m1,
|
| 377 |
+
prev_m2,
|
| 378 |
+
prev_last_sample,
|
| 379 |
+
float(sigma),
|
| 380 |
+
int(corrector_order),
|
| 381 |
+
int(predictor_order),
|
| 382 |
+
*map(float, corrector_coefficients),
|
| 383 |
+
*map(float, predictor_coefficients),
|
| 384 |
+
next_sample,
|
| 385 |
+
current_m,
|
| 386 |
+
current_last_sample,
|
| 387 |
+
)
|
| 388 |
+
return next_sample, current_m, current_last_sample
|
| 389 |
+
|
| 390 |
+
|
| 391 |
__all__ = [
|
| 392 |
"add_bf16",
|
| 393 |
+
"add_bias_pair_bf16",
|
| 394 |
+
"add_bias_zero_tail_bf16",
|
| 395 |
"cast_bf16_to_fp32",
|
| 396 |
"cfg_combine_into_residual_bf16",
|
| 397 |
"cfg_combine_into_residual_fp16",
|
| 398 |
"euler_step_bf16",
|
| 399 |
+
"extract_tail_f32_to_bf16",
|
| 400 |
"motus_decode_postprocess_bf16_to_fp32",
|
| 401 |
+
"pack_tail_bf16",
|
| 402 |
"teacher_force_first_frame_bf16",
|
| 403 |
+
"unipc_step_f32_bf16",
|
| 404 |
]
|
build/torch211-cxx11-cu128-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:554a62b2ee66742cbb0e0b7ff291d8f0f05f7e796f9c5ee0e0f48761d84ce8cf
|
| 3 |
+
size 1338024
|
build/torch211-cxx11-cu128-x86_64-linux/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _diffusion_step_ops_cuda_7781728
|
| 3 |
+
ops = torch.ops._diffusion_step_ops_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_diffusion_step_ops_cuda_7781728::{op_name}"
|
build/torch211-cxx11-cu128-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
+
"id": "_diffusion_step_ops_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
build/torch211-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -94,6 +94,115 @@ def _cast_bf16_to_fp32_fake(src: torch.Tensor, dst: torch.Tensor) -> None:
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 98 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 99 |
|
|
@@ -175,12 +284,121 @@ def cast_bf16_to_fp32(src: torch.Tensor, *, out: Optional[torch.Tensor] = None)
|
|
| 175 |
return out
|
| 176 |
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
__all__ = [
|
| 179 |
"add_bf16",
|
|
|
|
|
|
|
| 180 |
"cast_bf16_to_fp32",
|
| 181 |
"cfg_combine_into_residual_bf16",
|
| 182 |
"cfg_combine_into_residual_fp16",
|
| 183 |
"euler_step_bf16",
|
|
|
|
| 184 |
"motus_decode_postprocess_bf16_to_fp32",
|
|
|
|
| 185 |
"teacher_force_first_frame_bf16",
|
|
|
|
| 186 |
]
|
|
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
| 97 |
+
@torch.library.register_fake(add_op_namespace_prefix("pack_tail_bf16"))
|
| 98 |
+
def _pack_tail_bf16_fake(tail: torch.Tensor, flat_dim: int, out: torch.Tensor) -> None:
|
| 99 |
+
if tail.dim() != 1 or out.shape != (flat_dim,) or flat_dim < tail.numel():
|
| 100 |
+
raise RuntimeError("pack_tail_bf16 expects tail (N,), flat_dim >= N, out (flat_dim,)")
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_zero_tail_bf16"))
|
| 105 |
+
def _add_bias_zero_tail_bf16_fake(
|
| 106 |
+
input: torch.Tensor,
|
| 107 |
+
bias: torch.Tensor,
|
| 108 |
+
valid_cols: int,
|
| 109 |
+
out: torch.Tensor,
|
| 110 |
+
) -> None:
|
| 111 |
+
if (
|
| 112 |
+
input.dim() != 2
|
| 113 |
+
or bias.shape != (input.shape[1],)
|
| 114 |
+
or out.shape != input.shape
|
| 115 |
+
or valid_cols < 0
|
| 116 |
+
or valid_cols > input.shape[1]
|
| 117 |
+
):
|
| 118 |
+
raise RuntimeError(
|
| 119 |
+
"add_bias_zero_tail_bf16 expects input/out (rows, cols), "
|
| 120 |
+
"bias (cols,), valid_cols in [0, cols]"
|
| 121 |
+
)
|
| 122 |
+
return None
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
@torch.library.register_fake(add_op_namespace_prefix("extract_tail_f32_to_bf16"))
|
| 126 |
+
def _extract_tail_f32_to_bf16_fake(
|
| 127 |
+
flat: torch.Tensor,
|
| 128 |
+
tail_numel: int,
|
| 129 |
+
out: torch.Tensor,
|
| 130 |
+
) -> None:
|
| 131 |
+
if flat.dim() != 1 or tail_numel <= 0 or tail_numel > flat.numel() or out.shape != (tail_numel,):
|
| 132 |
+
raise RuntimeError(
|
| 133 |
+
"extract_tail_f32_to_bf16 expects flat (N,), tail_numel in [1, N], out (tail_numel,)"
|
| 134 |
+
)
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_pair_bf16"))
|
| 139 |
+
def _add_bias_pair_bf16_fake(
|
| 140 |
+
input: torch.Tensor,
|
| 141 |
+
bias_a: torch.Tensor,
|
| 142 |
+
bias_b: torch.Tensor,
|
| 143 |
+
out: torch.Tensor,
|
| 144 |
+
) -> None:
|
| 145 |
+
if (
|
| 146 |
+
input.dim() != 2
|
| 147 |
+
or bias_a.shape != (input.shape[1],)
|
| 148 |
+
or bias_b.shape != bias_a.shape
|
| 149 |
+
or out.shape != input.shape
|
| 150 |
+
):
|
| 151 |
+
raise RuntimeError(
|
| 152 |
+
"add_bias_pair_bf16 expects input/out (rows, hidden) and biases (hidden,)"
|
| 153 |
+
)
|
| 154 |
+
return None
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@torch.library.register_fake(add_op_namespace_prefix("unipc_step_f32_bf16"))
|
| 158 |
+
def _unipc_step_f32_bf16_fake(
|
| 159 |
+
sample: torch.Tensor,
|
| 160 |
+
velocity: torch.Tensor,
|
| 161 |
+
prev_m1: torch.Tensor,
|
| 162 |
+
prev_m2: torch.Tensor,
|
| 163 |
+
prev_last_sample: torch.Tensor,
|
| 164 |
+
sigma: float,
|
| 165 |
+
corrector_order: int,
|
| 166 |
+
predictor_order: int,
|
| 167 |
+
c_sample: float,
|
| 168 |
+
c_last: float,
|
| 169 |
+
c_prev_m1: float,
|
| 170 |
+
c_prev_m2: float,
|
| 171 |
+
c_curr_m: float,
|
| 172 |
+
p_sample: float,
|
| 173 |
+
p_curr_m: float,
|
| 174 |
+
p_prev_m1: float,
|
| 175 |
+
next_sample: torch.Tensor,
|
| 176 |
+
current_m: torch.Tensor,
|
| 177 |
+
current_last_sample: torch.Tensor,
|
| 178 |
+
) -> None:
|
| 179 |
+
del (
|
| 180 |
+
sigma,
|
| 181 |
+
corrector_order,
|
| 182 |
+
predictor_order,
|
| 183 |
+
c_sample,
|
| 184 |
+
c_last,
|
| 185 |
+
c_prev_m1,
|
| 186 |
+
c_prev_m2,
|
| 187 |
+
c_curr_m,
|
| 188 |
+
p_sample,
|
| 189 |
+
p_curr_m,
|
| 190 |
+
p_prev_m1,
|
| 191 |
+
)
|
| 192 |
+
for tensor in (
|
| 193 |
+
velocity,
|
| 194 |
+
prev_m1,
|
| 195 |
+
prev_m2,
|
| 196 |
+
prev_last_sample,
|
| 197 |
+
next_sample,
|
| 198 |
+
current_m,
|
| 199 |
+
current_last_sample,
|
| 200 |
+
):
|
| 201 |
+
if tensor.shape != sample.shape:
|
| 202 |
+
raise RuntimeError("all UniPC tensors must have the same shape")
|
| 203 |
+
return None
|
| 204 |
+
|
| 205 |
+
|
| 206 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 207 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 208 |
|
|
|
|
| 284 |
return out
|
| 285 |
|
| 286 |
|
| 287 |
+
def pack_tail_bf16(
|
| 288 |
+
tail: torch.Tensor,
|
| 289 |
+
flat_dim: int,
|
| 290 |
+
*,
|
| 291 |
+
out: Optional[torch.Tensor] = None,
|
| 292 |
+
) -> torch.Tensor:
|
| 293 |
+
"""Place a BF16 tail at the end of a zero-filled flat BF16 tensor."""
|
| 294 |
+
|
| 295 |
+
if out is None:
|
| 296 |
+
out = torch.empty((flat_dim,), device=tail.device, dtype=tail.dtype)
|
| 297 |
+
ops.pack_tail_bf16(tail, int(flat_dim), out)
|
| 298 |
+
return out
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def add_bias_zero_tail_bf16(
|
| 302 |
+
input: torch.Tensor,
|
| 303 |
+
bias: torch.Tensor,
|
| 304 |
+
valid_cols: int,
|
| 305 |
+
*,
|
| 306 |
+
out: Optional[torch.Tensor] = None,
|
| 307 |
+
) -> torch.Tensor:
|
| 308 |
+
"""Add a column bias and zero columns at or beyond ``valid_cols``."""
|
| 309 |
+
|
| 310 |
+
if out is None:
|
| 311 |
+
out = torch.empty_like(input)
|
| 312 |
+
ops.add_bias_zero_tail_bf16(input, bias, int(valid_cols), out)
|
| 313 |
+
return out
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def extract_tail_f32_to_bf16(
|
| 317 |
+
flat: torch.Tensor,
|
| 318 |
+
tail_numel: int,
|
| 319 |
+
*,
|
| 320 |
+
out: Optional[torch.Tensor] = None,
|
| 321 |
+
) -> torch.Tensor:
|
| 322 |
+
"""Extract the final ``tail_numel`` FP32 values and cast them to BF16."""
|
| 323 |
+
|
| 324 |
+
if out is None:
|
| 325 |
+
out = torch.empty((tail_numel,), device=flat.device, dtype=torch.bfloat16)
|
| 326 |
+
ops.extract_tail_f32_to_bf16(flat, int(tail_numel), out)
|
| 327 |
+
return out
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def add_bias_pair_bf16(
|
| 331 |
+
input: torch.Tensor,
|
| 332 |
+
bias_a: torch.Tensor,
|
| 333 |
+
bias_b: torch.Tensor,
|
| 334 |
+
*,
|
| 335 |
+
out: Optional[torch.Tensor] = None,
|
| 336 |
+
) -> torch.Tensor:
|
| 337 |
+
"""Add two BF16 row-broadcast biases with BF16 rounding after each add."""
|
| 338 |
+
|
| 339 |
+
if out is None:
|
| 340 |
+
out = torch.empty_like(input)
|
| 341 |
+
ops.add_bias_pair_bf16(input, bias_a, bias_b, out)
|
| 342 |
+
return out
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def unipc_step_f32_bf16(
|
| 346 |
+
sample: torch.Tensor,
|
| 347 |
+
velocity: torch.Tensor,
|
| 348 |
+
prev_m1: torch.Tensor,
|
| 349 |
+
prev_m2: torch.Tensor,
|
| 350 |
+
prev_last_sample: torch.Tensor,
|
| 351 |
+
sigma: float,
|
| 352 |
+
corrector_order: int,
|
| 353 |
+
predictor_order: int,
|
| 354 |
+
corrector_coefficients: tuple[float, float, float, float, float],
|
| 355 |
+
predictor_coefficients: tuple[float, float, float],
|
| 356 |
+
*,
|
| 357 |
+
next_sample: Optional[torch.Tensor] = None,
|
| 358 |
+
current_m: Optional[torch.Tensor] = None,
|
| 359 |
+
current_last_sample: Optional[torch.Tensor] = None,
|
| 360 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 361 |
+
"""Run one UniPC predictor/corrector update."""
|
| 362 |
+
|
| 363 |
+
if len(corrector_coefficients) != 5:
|
| 364 |
+
raise RuntimeError("corrector_coefficients must have five values")
|
| 365 |
+
if len(predictor_coefficients) != 3:
|
| 366 |
+
raise RuntimeError("predictor_coefficients must have three values")
|
| 367 |
+
if next_sample is None:
|
| 368 |
+
next_sample = torch.empty_like(sample)
|
| 369 |
+
if current_m is None:
|
| 370 |
+
current_m = torch.empty_like(sample)
|
| 371 |
+
if current_last_sample is None:
|
| 372 |
+
current_last_sample = torch.empty_like(sample)
|
| 373 |
+
ops.unipc_step_f32_bf16(
|
| 374 |
+
sample,
|
| 375 |
+
velocity,
|
| 376 |
+
prev_m1,
|
| 377 |
+
prev_m2,
|
| 378 |
+
prev_last_sample,
|
| 379 |
+
float(sigma),
|
| 380 |
+
int(corrector_order),
|
| 381 |
+
int(predictor_order),
|
| 382 |
+
*map(float, corrector_coefficients),
|
| 383 |
+
*map(float, predictor_coefficients),
|
| 384 |
+
next_sample,
|
| 385 |
+
current_m,
|
| 386 |
+
current_last_sample,
|
| 387 |
+
)
|
| 388 |
+
return next_sample, current_m, current_last_sample
|
| 389 |
+
|
| 390 |
+
|
| 391 |
__all__ = [
|
| 392 |
"add_bf16",
|
| 393 |
+
"add_bias_pair_bf16",
|
| 394 |
+
"add_bias_zero_tail_bf16",
|
| 395 |
"cast_bf16_to_fp32",
|
| 396 |
"cfg_combine_into_residual_bf16",
|
| 397 |
"cfg_combine_into_residual_fp16",
|
| 398 |
"euler_step_bf16",
|
| 399 |
+
"extract_tail_f32_to_bf16",
|
| 400 |
"motus_decode_postprocess_bf16_to_fp32",
|
| 401 |
+
"pack_tail_bf16",
|
| 402 |
"teacher_force_first_frame_bf16",
|
| 403 |
+
"unipc_step_f32_bf16",
|
| 404 |
]
|
build/torch211-cxx11-cu130-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43668c1d48502497e78b67202a14230679bd6db6a1771ab8cf70f55c3b7f546c
|
| 3 |
+
size 1321808
|
build/torch211-cxx11-cu130-x86_64-linux/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _diffusion_step_ops_cuda_7781728
|
| 3 |
+
ops = torch.ops._diffusion_step_ops_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_diffusion_step_ops_cuda_7781728::{op_name}"
|
build/torch211-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
+
"id": "_diffusion_step_ops_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
build/torch212-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -94,6 +94,115 @@ def _cast_bf16_to_fp32_fake(src: torch.Tensor, dst: torch.Tensor) -> None:
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 98 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 99 |
|
|
@@ -175,12 +284,121 @@ def cast_bf16_to_fp32(src: torch.Tensor, *, out: Optional[torch.Tensor] = None)
|
|
| 175 |
return out
|
| 176 |
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
__all__ = [
|
| 179 |
"add_bf16",
|
|
|
|
|
|
|
| 180 |
"cast_bf16_to_fp32",
|
| 181 |
"cfg_combine_into_residual_bf16",
|
| 182 |
"cfg_combine_into_residual_fp16",
|
| 183 |
"euler_step_bf16",
|
|
|
|
| 184 |
"motus_decode_postprocess_bf16_to_fp32",
|
|
|
|
| 185 |
"teacher_force_first_frame_bf16",
|
|
|
|
| 186 |
]
|
|
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
| 97 |
+
@torch.library.register_fake(add_op_namespace_prefix("pack_tail_bf16"))
|
| 98 |
+
def _pack_tail_bf16_fake(tail: torch.Tensor, flat_dim: int, out: torch.Tensor) -> None:
|
| 99 |
+
if tail.dim() != 1 or out.shape != (flat_dim,) or flat_dim < tail.numel():
|
| 100 |
+
raise RuntimeError("pack_tail_bf16 expects tail (N,), flat_dim >= N, out (flat_dim,)")
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_zero_tail_bf16"))
|
| 105 |
+
def _add_bias_zero_tail_bf16_fake(
|
| 106 |
+
input: torch.Tensor,
|
| 107 |
+
bias: torch.Tensor,
|
| 108 |
+
valid_cols: int,
|
| 109 |
+
out: torch.Tensor,
|
| 110 |
+
) -> None:
|
| 111 |
+
if (
|
| 112 |
+
input.dim() != 2
|
| 113 |
+
or bias.shape != (input.shape[1],)
|
| 114 |
+
or out.shape != input.shape
|
| 115 |
+
or valid_cols < 0
|
| 116 |
+
or valid_cols > input.shape[1]
|
| 117 |
+
):
|
| 118 |
+
raise RuntimeError(
|
| 119 |
+
"add_bias_zero_tail_bf16 expects input/out (rows, cols), "
|
| 120 |
+
"bias (cols,), valid_cols in [0, cols]"
|
| 121 |
+
)
|
| 122 |
+
return None
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
@torch.library.register_fake(add_op_namespace_prefix("extract_tail_f32_to_bf16"))
|
| 126 |
+
def _extract_tail_f32_to_bf16_fake(
|
| 127 |
+
flat: torch.Tensor,
|
| 128 |
+
tail_numel: int,
|
| 129 |
+
out: torch.Tensor,
|
| 130 |
+
) -> None:
|
| 131 |
+
if flat.dim() != 1 or tail_numel <= 0 or tail_numel > flat.numel() or out.shape != (tail_numel,):
|
| 132 |
+
raise RuntimeError(
|
| 133 |
+
"extract_tail_f32_to_bf16 expects flat (N,), tail_numel in [1, N], out (tail_numel,)"
|
| 134 |
+
)
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_pair_bf16"))
|
| 139 |
+
def _add_bias_pair_bf16_fake(
|
| 140 |
+
input: torch.Tensor,
|
| 141 |
+
bias_a: torch.Tensor,
|
| 142 |
+
bias_b: torch.Tensor,
|
| 143 |
+
out: torch.Tensor,
|
| 144 |
+
) -> None:
|
| 145 |
+
if (
|
| 146 |
+
input.dim() != 2
|
| 147 |
+
or bias_a.shape != (input.shape[1],)
|
| 148 |
+
or bias_b.shape != bias_a.shape
|
| 149 |
+
or out.shape != input.shape
|
| 150 |
+
):
|
| 151 |
+
raise RuntimeError(
|
| 152 |
+
"add_bias_pair_bf16 expects input/out (rows, hidden) and biases (hidden,)"
|
| 153 |
+
)
|
| 154 |
+
return None
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@torch.library.register_fake(add_op_namespace_prefix("unipc_step_f32_bf16"))
|
| 158 |
+
def _unipc_step_f32_bf16_fake(
|
| 159 |
+
sample: torch.Tensor,
|
| 160 |
+
velocity: torch.Tensor,
|
| 161 |
+
prev_m1: torch.Tensor,
|
| 162 |
+
prev_m2: torch.Tensor,
|
| 163 |
+
prev_last_sample: torch.Tensor,
|
| 164 |
+
sigma: float,
|
| 165 |
+
corrector_order: int,
|
| 166 |
+
predictor_order: int,
|
| 167 |
+
c_sample: float,
|
| 168 |
+
c_last: float,
|
| 169 |
+
c_prev_m1: float,
|
| 170 |
+
c_prev_m2: float,
|
| 171 |
+
c_curr_m: float,
|
| 172 |
+
p_sample: float,
|
| 173 |
+
p_curr_m: float,
|
| 174 |
+
p_prev_m1: float,
|
| 175 |
+
next_sample: torch.Tensor,
|
| 176 |
+
current_m: torch.Tensor,
|
| 177 |
+
current_last_sample: torch.Tensor,
|
| 178 |
+
) -> None:
|
| 179 |
+
del (
|
| 180 |
+
sigma,
|
| 181 |
+
corrector_order,
|
| 182 |
+
predictor_order,
|
| 183 |
+
c_sample,
|
| 184 |
+
c_last,
|
| 185 |
+
c_prev_m1,
|
| 186 |
+
c_prev_m2,
|
| 187 |
+
c_curr_m,
|
| 188 |
+
p_sample,
|
| 189 |
+
p_curr_m,
|
| 190 |
+
p_prev_m1,
|
| 191 |
+
)
|
| 192 |
+
for tensor in (
|
| 193 |
+
velocity,
|
| 194 |
+
prev_m1,
|
| 195 |
+
prev_m2,
|
| 196 |
+
prev_last_sample,
|
| 197 |
+
next_sample,
|
| 198 |
+
current_m,
|
| 199 |
+
current_last_sample,
|
| 200 |
+
):
|
| 201 |
+
if tensor.shape != sample.shape:
|
| 202 |
+
raise RuntimeError("all UniPC tensors must have the same shape")
|
| 203 |
+
return None
|
| 204 |
+
|
| 205 |
+
|
| 206 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 207 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 208 |
|
|
|
|
| 284 |
return out
|
| 285 |
|
| 286 |
|
| 287 |
+
def pack_tail_bf16(
|
| 288 |
+
tail: torch.Tensor,
|
| 289 |
+
flat_dim: int,
|
| 290 |
+
*,
|
| 291 |
+
out: Optional[torch.Tensor] = None,
|
| 292 |
+
) -> torch.Tensor:
|
| 293 |
+
"""Place a BF16 tail at the end of a zero-filled flat BF16 tensor."""
|
| 294 |
+
|
| 295 |
+
if out is None:
|
| 296 |
+
out = torch.empty((flat_dim,), device=tail.device, dtype=tail.dtype)
|
| 297 |
+
ops.pack_tail_bf16(tail, int(flat_dim), out)
|
| 298 |
+
return out
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def add_bias_zero_tail_bf16(
|
| 302 |
+
input: torch.Tensor,
|
| 303 |
+
bias: torch.Tensor,
|
| 304 |
+
valid_cols: int,
|
| 305 |
+
*,
|
| 306 |
+
out: Optional[torch.Tensor] = None,
|
| 307 |
+
) -> torch.Tensor:
|
| 308 |
+
"""Add a column bias and zero columns at or beyond ``valid_cols``."""
|
| 309 |
+
|
| 310 |
+
if out is None:
|
| 311 |
+
out = torch.empty_like(input)
|
| 312 |
+
ops.add_bias_zero_tail_bf16(input, bias, int(valid_cols), out)
|
| 313 |
+
return out
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def extract_tail_f32_to_bf16(
|
| 317 |
+
flat: torch.Tensor,
|
| 318 |
+
tail_numel: int,
|
| 319 |
+
*,
|
| 320 |
+
out: Optional[torch.Tensor] = None,
|
| 321 |
+
) -> torch.Tensor:
|
| 322 |
+
"""Extract the final ``tail_numel`` FP32 values and cast them to BF16."""
|
| 323 |
+
|
| 324 |
+
if out is None:
|
| 325 |
+
out = torch.empty((tail_numel,), device=flat.device, dtype=torch.bfloat16)
|
| 326 |
+
ops.extract_tail_f32_to_bf16(flat, int(tail_numel), out)
|
| 327 |
+
return out
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def add_bias_pair_bf16(
|
| 331 |
+
input: torch.Tensor,
|
| 332 |
+
bias_a: torch.Tensor,
|
| 333 |
+
bias_b: torch.Tensor,
|
| 334 |
+
*,
|
| 335 |
+
out: Optional[torch.Tensor] = None,
|
| 336 |
+
) -> torch.Tensor:
|
| 337 |
+
"""Add two BF16 row-broadcast biases with BF16 rounding after each add."""
|
| 338 |
+
|
| 339 |
+
if out is None:
|
| 340 |
+
out = torch.empty_like(input)
|
| 341 |
+
ops.add_bias_pair_bf16(input, bias_a, bias_b, out)
|
| 342 |
+
return out
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def unipc_step_f32_bf16(
|
| 346 |
+
sample: torch.Tensor,
|
| 347 |
+
velocity: torch.Tensor,
|
| 348 |
+
prev_m1: torch.Tensor,
|
| 349 |
+
prev_m2: torch.Tensor,
|
| 350 |
+
prev_last_sample: torch.Tensor,
|
| 351 |
+
sigma: float,
|
| 352 |
+
corrector_order: int,
|
| 353 |
+
predictor_order: int,
|
| 354 |
+
corrector_coefficients: tuple[float, float, float, float, float],
|
| 355 |
+
predictor_coefficients: tuple[float, float, float],
|
| 356 |
+
*,
|
| 357 |
+
next_sample: Optional[torch.Tensor] = None,
|
| 358 |
+
current_m: Optional[torch.Tensor] = None,
|
| 359 |
+
current_last_sample: Optional[torch.Tensor] = None,
|
| 360 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 361 |
+
"""Run one UniPC predictor/corrector update."""
|
| 362 |
+
|
| 363 |
+
if len(corrector_coefficients) != 5:
|
| 364 |
+
raise RuntimeError("corrector_coefficients must have five values")
|
| 365 |
+
if len(predictor_coefficients) != 3:
|
| 366 |
+
raise RuntimeError("predictor_coefficients must have three values")
|
| 367 |
+
if next_sample is None:
|
| 368 |
+
next_sample = torch.empty_like(sample)
|
| 369 |
+
if current_m is None:
|
| 370 |
+
current_m = torch.empty_like(sample)
|
| 371 |
+
if current_last_sample is None:
|
| 372 |
+
current_last_sample = torch.empty_like(sample)
|
| 373 |
+
ops.unipc_step_f32_bf16(
|
| 374 |
+
sample,
|
| 375 |
+
velocity,
|
| 376 |
+
prev_m1,
|
| 377 |
+
prev_m2,
|
| 378 |
+
prev_last_sample,
|
| 379 |
+
float(sigma),
|
| 380 |
+
int(corrector_order),
|
| 381 |
+
int(predictor_order),
|
| 382 |
+
*map(float, corrector_coefficients),
|
| 383 |
+
*map(float, predictor_coefficients),
|
| 384 |
+
next_sample,
|
| 385 |
+
current_m,
|
| 386 |
+
current_last_sample,
|
| 387 |
+
)
|
| 388 |
+
return next_sample, current_m, current_last_sample
|
| 389 |
+
|
| 390 |
+
|
| 391 |
__all__ = [
|
| 392 |
"add_bf16",
|
| 393 |
+
"add_bias_pair_bf16",
|
| 394 |
+
"add_bias_zero_tail_bf16",
|
| 395 |
"cast_bf16_to_fp32",
|
| 396 |
"cfg_combine_into_residual_bf16",
|
| 397 |
"cfg_combine_into_residual_fp16",
|
| 398 |
"euler_step_bf16",
|
| 399 |
+
"extract_tail_f32_to_bf16",
|
| 400 |
"motus_decode_postprocess_bf16_to_fp32",
|
| 401 |
+
"pack_tail_bf16",
|
| 402 |
"teacher_force_first_frame_bf16",
|
| 403 |
+
"unipc_step_f32_bf16",
|
| 404 |
]
|
build/torch212-cxx11-cu130-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:891d2900b9d28d1a2d383ffa2e633d794c5aa826dd68dc3bf356937f1fe642cf
|
| 3 |
+
size 1332216
|
build/torch212-cxx11-cu130-x86_64-linux/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _diffusion_step_ops_cuda_7781728
|
| 3 |
+
ops = torch.ops._diffusion_step_ops_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_diffusion_step_ops_cuda_7781728::{op_name}"
|
build/torch212-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
+
"id": "_diffusion_step_ops_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
build/torch212-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -94,6 +94,115 @@ def _cast_bf16_to_fp32_fake(src: torch.Tensor, dst: torch.Tensor) -> None:
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 98 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 99 |
|
|
@@ -175,12 +284,121 @@ def cast_bf16_to_fp32(src: torch.Tensor, *, out: Optional[torch.Tensor] = None)
|
|
| 175 |
return out
|
| 176 |
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
__all__ = [
|
| 179 |
"add_bf16",
|
|
|
|
|
|
|
| 180 |
"cast_bf16_to_fp32",
|
| 181 |
"cfg_combine_into_residual_bf16",
|
| 182 |
"cfg_combine_into_residual_fp16",
|
| 183 |
"euler_step_bf16",
|
|
|
|
| 184 |
"motus_decode_postprocess_bf16_to_fp32",
|
|
|
|
| 185 |
"teacher_force_first_frame_bf16",
|
|
|
|
| 186 |
]
|
|
|
|
| 94 |
return None
|
| 95 |
|
| 96 |
|
| 97 |
+
@torch.library.register_fake(add_op_namespace_prefix("pack_tail_bf16"))
|
| 98 |
+
def _pack_tail_bf16_fake(tail: torch.Tensor, flat_dim: int, out: torch.Tensor) -> None:
|
| 99 |
+
if tail.dim() != 1 or out.shape != (flat_dim,) or flat_dim < tail.numel():
|
| 100 |
+
raise RuntimeError("pack_tail_bf16 expects tail (N,), flat_dim >= N, out (flat_dim,)")
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_zero_tail_bf16"))
|
| 105 |
+
def _add_bias_zero_tail_bf16_fake(
|
| 106 |
+
input: torch.Tensor,
|
| 107 |
+
bias: torch.Tensor,
|
| 108 |
+
valid_cols: int,
|
| 109 |
+
out: torch.Tensor,
|
| 110 |
+
) -> None:
|
| 111 |
+
if (
|
| 112 |
+
input.dim() != 2
|
| 113 |
+
or bias.shape != (input.shape[1],)
|
| 114 |
+
or out.shape != input.shape
|
| 115 |
+
or valid_cols < 0
|
| 116 |
+
or valid_cols > input.shape[1]
|
| 117 |
+
):
|
| 118 |
+
raise RuntimeError(
|
| 119 |
+
"add_bias_zero_tail_bf16 expects input/out (rows, cols), "
|
| 120 |
+
"bias (cols,), valid_cols in [0, cols]"
|
| 121 |
+
)
|
| 122 |
+
return None
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
@torch.library.register_fake(add_op_namespace_prefix("extract_tail_f32_to_bf16"))
|
| 126 |
+
def _extract_tail_f32_to_bf16_fake(
|
| 127 |
+
flat: torch.Tensor,
|
| 128 |
+
tail_numel: int,
|
| 129 |
+
out: torch.Tensor,
|
| 130 |
+
) -> None:
|
| 131 |
+
if flat.dim() != 1 or tail_numel <= 0 or tail_numel > flat.numel() or out.shape != (tail_numel,):
|
| 132 |
+
raise RuntimeError(
|
| 133 |
+
"extract_tail_f32_to_bf16 expects flat (N,), tail_numel in [1, N], out (tail_numel,)"
|
| 134 |
+
)
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
@torch.library.register_fake(add_op_namespace_prefix("add_bias_pair_bf16"))
|
| 139 |
+
def _add_bias_pair_bf16_fake(
|
| 140 |
+
input: torch.Tensor,
|
| 141 |
+
bias_a: torch.Tensor,
|
| 142 |
+
bias_b: torch.Tensor,
|
| 143 |
+
out: torch.Tensor,
|
| 144 |
+
) -> None:
|
| 145 |
+
if (
|
| 146 |
+
input.dim() != 2
|
| 147 |
+
or bias_a.shape != (input.shape[1],)
|
| 148 |
+
or bias_b.shape != bias_a.shape
|
| 149 |
+
or out.shape != input.shape
|
| 150 |
+
):
|
| 151 |
+
raise RuntimeError(
|
| 152 |
+
"add_bias_pair_bf16 expects input/out (rows, hidden) and biases (hidden,)"
|
| 153 |
+
)
|
| 154 |
+
return None
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@torch.library.register_fake(add_op_namespace_prefix("unipc_step_f32_bf16"))
|
| 158 |
+
def _unipc_step_f32_bf16_fake(
|
| 159 |
+
sample: torch.Tensor,
|
| 160 |
+
velocity: torch.Tensor,
|
| 161 |
+
prev_m1: torch.Tensor,
|
| 162 |
+
prev_m2: torch.Tensor,
|
| 163 |
+
prev_last_sample: torch.Tensor,
|
| 164 |
+
sigma: float,
|
| 165 |
+
corrector_order: int,
|
| 166 |
+
predictor_order: int,
|
| 167 |
+
c_sample: float,
|
| 168 |
+
c_last: float,
|
| 169 |
+
c_prev_m1: float,
|
| 170 |
+
c_prev_m2: float,
|
| 171 |
+
c_curr_m: float,
|
| 172 |
+
p_sample: float,
|
| 173 |
+
p_curr_m: float,
|
| 174 |
+
p_prev_m1: float,
|
| 175 |
+
next_sample: torch.Tensor,
|
| 176 |
+
current_m: torch.Tensor,
|
| 177 |
+
current_last_sample: torch.Tensor,
|
| 178 |
+
) -> None:
|
| 179 |
+
del (
|
| 180 |
+
sigma,
|
| 181 |
+
corrector_order,
|
| 182 |
+
predictor_order,
|
| 183 |
+
c_sample,
|
| 184 |
+
c_last,
|
| 185 |
+
c_prev_m1,
|
| 186 |
+
c_prev_m2,
|
| 187 |
+
c_curr_m,
|
| 188 |
+
p_sample,
|
| 189 |
+
p_curr_m,
|
| 190 |
+
p_prev_m1,
|
| 191 |
+
)
|
| 192 |
+
for tensor in (
|
| 193 |
+
velocity,
|
| 194 |
+
prev_m1,
|
| 195 |
+
prev_m2,
|
| 196 |
+
prev_last_sample,
|
| 197 |
+
next_sample,
|
| 198 |
+
current_m,
|
| 199 |
+
current_last_sample,
|
| 200 |
+
):
|
| 201 |
+
if tensor.shape != sample.shape:
|
| 202 |
+
raise RuntimeError("all UniPC tensors must have the same shape")
|
| 203 |
+
return None
|
| 204 |
+
|
| 205 |
+
|
| 206 |
def add_bf16(a: torch.Tensor, b: torch.Tensor, *, out: Optional[torch.Tensor] = None) -> torch.Tensor:
|
| 207 |
"""Return ``a + b`` for contiguous BF16 CUDA tensors."""
|
| 208 |
|
|
|
|
| 284 |
return out
|
| 285 |
|
| 286 |
|
| 287 |
+
def pack_tail_bf16(
|
| 288 |
+
tail: torch.Tensor,
|
| 289 |
+
flat_dim: int,
|
| 290 |
+
*,
|
| 291 |
+
out: Optional[torch.Tensor] = None,
|
| 292 |
+
) -> torch.Tensor:
|
| 293 |
+
"""Place a BF16 tail at the end of a zero-filled flat BF16 tensor."""
|
| 294 |
+
|
| 295 |
+
if out is None:
|
| 296 |
+
out = torch.empty((flat_dim,), device=tail.device, dtype=tail.dtype)
|
| 297 |
+
ops.pack_tail_bf16(tail, int(flat_dim), out)
|
| 298 |
+
return out
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def add_bias_zero_tail_bf16(
|
| 302 |
+
input: torch.Tensor,
|
| 303 |
+
bias: torch.Tensor,
|
| 304 |
+
valid_cols: int,
|
| 305 |
+
*,
|
| 306 |
+
out: Optional[torch.Tensor] = None,
|
| 307 |
+
) -> torch.Tensor:
|
| 308 |
+
"""Add a column bias and zero columns at or beyond ``valid_cols``."""
|
| 309 |
+
|
| 310 |
+
if out is None:
|
| 311 |
+
out = torch.empty_like(input)
|
| 312 |
+
ops.add_bias_zero_tail_bf16(input, bias, int(valid_cols), out)
|
| 313 |
+
return out
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def extract_tail_f32_to_bf16(
|
| 317 |
+
flat: torch.Tensor,
|
| 318 |
+
tail_numel: int,
|
| 319 |
+
*,
|
| 320 |
+
out: Optional[torch.Tensor] = None,
|
| 321 |
+
) -> torch.Tensor:
|
| 322 |
+
"""Extract the final ``tail_numel`` FP32 values and cast them to BF16."""
|
| 323 |
+
|
| 324 |
+
if out is None:
|
| 325 |
+
out = torch.empty((tail_numel,), device=flat.device, dtype=torch.bfloat16)
|
| 326 |
+
ops.extract_tail_f32_to_bf16(flat, int(tail_numel), out)
|
| 327 |
+
return out
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def add_bias_pair_bf16(
|
| 331 |
+
input: torch.Tensor,
|
| 332 |
+
bias_a: torch.Tensor,
|
| 333 |
+
bias_b: torch.Tensor,
|
| 334 |
+
*,
|
| 335 |
+
out: Optional[torch.Tensor] = None,
|
| 336 |
+
) -> torch.Tensor:
|
| 337 |
+
"""Add two BF16 row-broadcast biases with BF16 rounding after each add."""
|
| 338 |
+
|
| 339 |
+
if out is None:
|
| 340 |
+
out = torch.empty_like(input)
|
| 341 |
+
ops.add_bias_pair_bf16(input, bias_a, bias_b, out)
|
| 342 |
+
return out
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def unipc_step_f32_bf16(
|
| 346 |
+
sample: torch.Tensor,
|
| 347 |
+
velocity: torch.Tensor,
|
| 348 |
+
prev_m1: torch.Tensor,
|
| 349 |
+
prev_m2: torch.Tensor,
|
| 350 |
+
prev_last_sample: torch.Tensor,
|
| 351 |
+
sigma: float,
|
| 352 |
+
corrector_order: int,
|
| 353 |
+
predictor_order: int,
|
| 354 |
+
corrector_coefficients: tuple[float, float, float, float, float],
|
| 355 |
+
predictor_coefficients: tuple[float, float, float],
|
| 356 |
+
*,
|
| 357 |
+
next_sample: Optional[torch.Tensor] = None,
|
| 358 |
+
current_m: Optional[torch.Tensor] = None,
|
| 359 |
+
current_last_sample: Optional[torch.Tensor] = None,
|
| 360 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 361 |
+
"""Run one UniPC predictor/corrector update."""
|
| 362 |
+
|
| 363 |
+
if len(corrector_coefficients) != 5:
|
| 364 |
+
raise RuntimeError("corrector_coefficients must have five values")
|
| 365 |
+
if len(predictor_coefficients) != 3:
|
| 366 |
+
raise RuntimeError("predictor_coefficients must have three values")
|
| 367 |
+
if next_sample is None:
|
| 368 |
+
next_sample = torch.empty_like(sample)
|
| 369 |
+
if current_m is None:
|
| 370 |
+
current_m = torch.empty_like(sample)
|
| 371 |
+
if current_last_sample is None:
|
| 372 |
+
current_last_sample = torch.empty_like(sample)
|
| 373 |
+
ops.unipc_step_f32_bf16(
|
| 374 |
+
sample,
|
| 375 |
+
velocity,
|
| 376 |
+
prev_m1,
|
| 377 |
+
prev_m2,
|
| 378 |
+
prev_last_sample,
|
| 379 |
+
float(sigma),
|
| 380 |
+
int(corrector_order),
|
| 381 |
+
int(predictor_order),
|
| 382 |
+
*map(float, corrector_coefficients),
|
| 383 |
+
*map(float, predictor_coefficients),
|
| 384 |
+
next_sample,
|
| 385 |
+
current_m,
|
| 386 |
+
current_last_sample,
|
| 387 |
+
)
|
| 388 |
+
return next_sample, current_m, current_last_sample
|
| 389 |
+
|
| 390 |
+
|
| 391 |
__all__ = [
|
| 392 |
"add_bf16",
|
| 393 |
+
"add_bias_pair_bf16",
|
| 394 |
+
"add_bias_zero_tail_bf16",
|
| 395 |
"cast_bf16_to_fp32",
|
| 396 |
"cfg_combine_into_residual_bf16",
|
| 397 |
"cfg_combine_into_residual_fp16",
|
| 398 |
"euler_step_bf16",
|
| 399 |
+
"extract_tail_f32_to_bf16",
|
| 400 |
"motus_decode_postprocess_bf16_to_fp32",
|
| 401 |
+
"pack_tail_bf16",
|
| 402 |
"teacher_force_first_frame_bf16",
|
| 403 |
+
"unipc_step_f32_bf16",
|
| 404 |
]
|
build/torch212-cxx11-cu132-x86_64-linux/{_diffusion_step_ops_cuda_5596053.abi3.so → _diffusion_step_ops_cuda_7781728.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd59ccb9dceaa73fcb48d308cb7d9d4a02df88b02df7a5a868ade9edcd13f71e
|
| 3 |
+
size 1303544
|
build/torch212-cxx11-cu132-x86_64-linux/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _diffusion_step_ops_cuda_7781728
|
| 3 |
+
ops = torch.ops._diffusion_step_ops_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_diffusion_step_ops_cuda_7781728::{op_name}"
|
build/torch212-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 1 |
{
|
| 2 |
"name": "diffusion-step-ops",
|
| 3 |
+
"id": "_diffusion_step_ops_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|