23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
|
|
"""Compare every direct H3 block output with one ComfyUI per-block capture."""
|
||
|
|
|
||
|
|
import torch
|
||
|
|
|
||
|
|
from h3_blackwell_runtime.checkpoint import H3Checkpoint
|
||
|
|
from h3_blackwell_runtime.denoiser import H3PackedDenoiser
|
||
|
|
from h3_blackwell_runtime.rope import h3_rope_rotation
|
||
|
|
|
||
|
|
|
||
|
|
capture_dir = "/artifacts/capture"
|
||
|
|
inputs = torch.load(f"{capture_dir}/input.pt", map_location="cuda", weights_only=False)
|
||
|
|
checkpoint = H3Checkpoint("/models/minimax_h3_ref2va_pruned_nvfp4.safetensors")
|
||
|
|
model = H3PackedDenoiser.from_checkpoint(checkpoint).eval()
|
||
|
|
|
||
|
|
hidden = inputs["hidden"]
|
||
|
|
rotation = h3_rope_rotation(inputs["position_ids"], model.backbone.inv_freq, hidden.dtype)
|
||
|
|
with torch.inference_mode():
|
||
|
|
for index, (block, adaln) in enumerate(zip(model.backbone.blocks, model.backbone.adaln, strict=True)):
|
||
|
|
hidden = block(hidden, rotation, *adaln(inputs["timesteps"]), inputs["segments"])
|
||
|
|
expected = torch.load(f"{capture_dir}/blocks/{index:02d}.pt", map_location="cuda", weights_only=False)
|
||
|
|
delta = (hidden.float() - expected.float()).abs()
|
||
|
|
print(f"block={index:02d} max_abs={delta.max().item():.6g} mean_abs={delta.mean().item():.6g}")
|