Harden V3.2.1 release contracts

This commit is contained in:
ukr8b3g-cmyk
2026-08-13 21:55:51 +09:00
parent a3c8151c96
commit 683ad512a7
19 changed files with 617 additions and 145 deletions
+6 -7
View File
@@ -38,13 +38,12 @@ class IdentityAssets:
def _tensor_fingerprint(tensor: torch.Tensor | None) -> str:
if tensor is None:
return "none"
sample = tensor.detach().to("cpu", dtype=torch.float32).contiguous()
# Hash a deterministic downsampled view rather than several gigabytes of bytes.
if sample.ndim == 4:
sample = sample[:1].movedim(-1, 1)
sample = torch.nn.functional.interpolate(sample, size=(64, 64), mode="area")
raw = sample.numpy().tobytes(order="C")
return hashlib.sha256(raw).hexdigest()
sample = tensor.detach().to("cpu").contiguous()
digest = hashlib.sha256()
digest.update(str(tuple(int(value) for value in sample.shape)).encode("ascii"))
digest.update(str(sample.dtype).encode("ascii"))
digest.update(sample.view(torch.uint8).numpy().tobytes(order="C"))
return digest.hexdigest()
def resize_h3_image(image: torch.Tensor, width: int, height: int, crop: str) -> torch.Tensor: