ICWDS Experiment 2B causal residual bottleneck audit
Browse files- .gitattributes +6 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/WaveSemanticHybridCodec_Exp2B.py +414 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/WaveSemanticHybridCodec_Exp2B_best.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/CACHEDIR.TAG +4 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/blobs/9c4623c05be35b459d1790ec4e93fa447c7a0dc5 +348 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/refs/main +1 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/snapshots/a91a365a49141913cfeeeb18d1be8074730e06c9/CNN.py +348 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/snapshots/a91a365a49141913cfeeeb18d1be8074730e06c9/__pycache__/CNN.cpython-312.pyc +0 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c12_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/cache_meta_exp2b.json +12 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/front.u8 +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/parts.u8 +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_capacity_summary.csv +4 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_casewise_summary.csv +36 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_code_audit_bars.png +0 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_condition_full_prior_summary.csv +8 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_condition_part_summary.csv +16 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_training_history.csv +21 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c4_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c8_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_semantic_decoder_exp2b_base.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c12_causal_manual.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c4_causal_manual.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c8_causal_manual.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_semantic_decoder.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/experiment2b_decision.json +28 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latent_utilization_diagnostics.csv +4 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c12_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c4_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c8_causal.pt +3 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/model_summary_exp2b.json +87 -0
- WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/pca_oracle_capacity.png +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/blobs/7fc09a2626207fe45e1d97214008b308c328db785ec0f72ecf6587280763013d filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/front.u8 filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/parts.u8 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/presence.u8 filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_residual_full_prior_gallery.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/training_curves_exp2b.png filter=lfs diff=lfs merge=lfs -text
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/WaveSemanticHybridCodec_Exp2B.py
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ICWDS WaveSemanticHybridCodec — Experiment 2
|
| 3 |
+
=============================================
|
| 4 |
+
Semantic Backbone + Learned Shape Residual Code capacity/rate probe.
|
| 5 |
+
|
| 6 |
+
This experiment deliberately uses deterministic semantic extraction only.
|
| 7 |
+
It compares three learned residual-shape bottlenecks under the same semantic
|
| 8 |
+
backbone and the same shape-refiner architecture:
|
| 9 |
+
|
| 10 |
+
1) continuous4 : 4-D continuous shape code (capacity reference)
|
| 11 |
+
2) vq64 : one learned 64-entry vector codebook (6 bit / wave)
|
| 12 |
+
3) rvq2x32 : two learned 32-entry residual codebooks (10 bit / wave)
|
| 13 |
+
|
| 14 |
+
There is no background residual codec, 30-byte packet allocator, LDM, or
|
| 15 |
+
ControlNet in Experiment 2. The purpose is to isolate the extra information
|
| 16 |
+
needed beyond the deterministic physical semantic backbone.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
import math
|
| 20 |
+
from dataclasses import dataclass, asdict
|
| 21 |
+
from typing import Dict, Optional
|
| 22 |
+
|
| 23 |
+
import torch
|
| 24 |
+
import torch.nn as nn
|
| 25 |
+
import torch.nn.functional as F
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@dataclass
|
| 29 |
+
class SemanticShapeExp2Config:
|
| 30 |
+
n_freqs: int = 47
|
| 31 |
+
n_dirs: int = 72
|
| 32 |
+
semantic_dim: int = 9
|
| 33 |
+
width: int = 48
|
| 34 |
+
shape_feature_dim: int = 32
|
| 35 |
+
continuous_dim: int = 4
|
| 36 |
+
vq_size: int = 64
|
| 37 |
+
rvq_stages: int = 2
|
| 38 |
+
rvq_size: int = 32
|
| 39 |
+
vq_commitment: float = 0.25
|
| 40 |
+
code_width: int = 32
|
| 41 |
+
max_residual_log: float = 0.75
|
| 42 |
+
|
| 43 |
+
def to_dict(self):
|
| 44 |
+
return asdict(self)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class ResBlock(nn.Module):
|
| 48 |
+
def __init__(self, ch: int):
|
| 49 |
+
super().__init__()
|
| 50 |
+
self.net = nn.Sequential(
|
| 51 |
+
nn.Conv2d(ch, ch, 3, padding=1, bias=False),
|
| 52 |
+
nn.GroupNorm(min(8, ch), ch),
|
| 53 |
+
nn.GELU(),
|
| 54 |
+
nn.Conv2d(ch, ch, 3, padding=1, bias=False),
|
| 55 |
+
nn.GroupNorm(min(8, ch), ch),
|
| 56 |
+
)
|
| 57 |
+
self.act = nn.GELU()
|
| 58 |
+
|
| 59 |
+
def forward(self, x):
|
| 60 |
+
return self.act(x + self.net(x))
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class CircularConv2d(nn.Module):
|
| 64 |
+
"""3x3 conv: circular padding in direction, replicate in frequency."""
|
| 65 |
+
def __init__(self, ci: int, co: int, stride: int = 1, bias: bool = False):
|
| 66 |
+
super().__init__()
|
| 67 |
+
self.conv = nn.Conv2d(ci, co, 3, stride=stride, padding=0, bias=bias)
|
| 68 |
+
|
| 69 |
+
def forward(self, x):
|
| 70 |
+
x = torch.cat([x[..., -1:], x, x[..., :1]], dim=-1)
|
| 71 |
+
x = F.pad(x, (0, 0, 1, 1), mode="replicate")
|
| 72 |
+
return self.conv(x)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def coordinate_channels(batch: int, nf: int, nd: int, device, dtype):
|
| 76 |
+
f = torch.linspace(0, 1, nf, device=device, dtype=dtype).view(1, 1, nf, 1)
|
| 77 |
+
f = f.expand(batch, 1, nf, nd)
|
| 78 |
+
th = torch.linspace(0, 2 * math.pi, nd + 1, device=device, dtype=dtype)[:nd]
|
| 79 |
+
th = th.view(1, 1, 1, nd).expand(batch, 1, nf, nd)
|
| 80 |
+
return torch.cat([f, torch.sin(th), torch.cos(th)], dim=1)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
@torch.no_grad()
|
| 84 |
+
def deterministic_semantics(parts: torch.Tensor) -> torch.Tensor:
|
| 85 |
+
"""Compute 9-D internal semantic code from wave-system parts.
|
| 86 |
+
|
| 87 |
+
Logical packet fields remain eight:
|
| 88 |
+
energy, peak frequency, peak direction, frequency spread,
|
| 89 |
+
direction spread, f-theta correlation, frequency skew, direction skew.
|
| 90 |
+
Peak direction is represented internally by sin/cos.
|
| 91 |
+
"""
|
| 92 |
+
leading = parts.shape[:-2]
|
| 93 |
+
H, W = parts.shape[-2:]
|
| 94 |
+
E = parts.reshape(-1, H, W).clamp_min(0)
|
| 95 |
+
N = E.shape[0]
|
| 96 |
+
eps = 1e-8
|
| 97 |
+
|
| 98 |
+
mass = E.sum(dim=(1, 2)).clamp_min(eps)
|
| 99 |
+
log_energy = torch.log1p(mass) / math.log1p(float(H * W))
|
| 100 |
+
|
| 101 |
+
flat = E.reshape(N, -1)
|
| 102 |
+
peak_idx = flat.argmax(dim=-1)
|
| 103 |
+
peak_f = (peak_idx // W).float() / max(H - 1, 1)
|
| 104 |
+
peak_theta = (peak_idx % W).float() / W * 2 * math.pi
|
| 105 |
+
sin_p = torch.sin(peak_theta)
|
| 106 |
+
cos_p = torch.cos(peak_theta)
|
| 107 |
+
|
| 108 |
+
f = torch.linspace(0, 1, H, device=E.device, dtype=E.dtype).view(1, H, 1)
|
| 109 |
+
theta = torch.linspace(0, 2 * math.pi, W + 1, device=E.device, dtype=E.dtype)[:W]
|
| 110 |
+
theta = theta.view(1, 1, W)
|
| 111 |
+
|
| 112 |
+
df = f - peak_f[:, None, None]
|
| 113 |
+
dt = torch.atan2(
|
| 114 |
+
torch.sin(theta - peak_theta[:, None, None]),
|
| 115 |
+
torch.cos(theta - peak_theta[:, None, None]),
|
| 116 |
+
) / math.pi
|
| 117 |
+
|
| 118 |
+
var_f = (E * df.square()).sum(dim=(1, 2)) / mass
|
| 119 |
+
var_t = (E * dt.square()).sum(dim=(1, 2)) / mass
|
| 120 |
+
sigma_f = torch.sqrt(var_f.clamp_min(0)).clamp(0.008, 0.35)
|
| 121 |
+
sigma_t = torch.sqrt(var_t.clamp_min(0)).clamp(0.015, 0.65)
|
| 122 |
+
|
| 123 |
+
cov = (E * df * dt).sum(dim=(1, 2)) / mass
|
| 124 |
+
rho = (cov / (sigma_f * sigma_t + eps)).clamp(-0.95, 0.95)
|
| 125 |
+
|
| 126 |
+
m3f = (E * df.pow(3)).sum(dim=(1, 2)) / mass
|
| 127 |
+
m3t = (E * dt.pow(3)).sum(dim=(1, 2)) / mass
|
| 128 |
+
skew_f = torch.tanh(m3f / (3.0 * sigma_f.pow(3) + eps))
|
| 129 |
+
skew_t = torch.tanh(m3t / (3.0 * sigma_t.pow(3) + eps))
|
| 130 |
+
|
| 131 |
+
sem = torch.stack(
|
| 132 |
+
[log_energy, peak_f, sin_p, cos_p, sigma_f, sigma_t, rho, skew_f, skew_t],
|
| 133 |
+
dim=-1,
|
| 134 |
+
)
|
| 135 |
+
return sem.view(*leading, 9)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class AnalyticSkewRenderer(nn.Module):
|
| 139 |
+
def __init__(self, cfg: Optional[SemanticShapeExp2Config] = None):
|
| 140 |
+
super().__init__()
|
| 141 |
+
self.cfg = cfg or SemanticShapeExp2Config()
|
| 142 |
+
nf, nd = self.cfg.n_freqs, self.cfg.n_dirs
|
| 143 |
+
self.register_buffer("fcoord", torch.linspace(0, 1, nf).view(1, nf, 1))
|
| 144 |
+
th = torch.linspace(0, 2 * math.pi, nd + 1)[:nd].view(1, 1, nd)
|
| 145 |
+
self.register_buffer("theta", th)
|
| 146 |
+
|
| 147 |
+
def forward(self, sem: torch.Tensor) -> torch.Tensor:
|
| 148 |
+
leading = sem.shape[:-1]
|
| 149 |
+
s = sem.reshape(-1, 9)
|
| 150 |
+
log_e = s[:, 0]
|
| 151 |
+
f0 = s[:, 1]
|
| 152 |
+
th0 = torch.atan2(s[:, 2], s[:, 3])
|
| 153 |
+
sf = s[:, 4].clamp(0.008, 0.35)
|
| 154 |
+
st = s[:, 5].clamp(0.015, 0.65)
|
| 155 |
+
rho = s[:, 6].clamp(-0.95, 0.95)
|
| 156 |
+
skew_f = s[:, 7]
|
| 157 |
+
skew_t = s[:, 8]
|
| 158 |
+
|
| 159 |
+
df = (self.fcoord - f0[:, None, None]) / sf[:, None, None]
|
| 160 |
+
dth = torch.atan2(
|
| 161 |
+
torch.sin(self.theta - th0[:, None, None]),
|
| 162 |
+
torch.cos(self.theta - th0[:, None, None]),
|
| 163 |
+
) / math.pi
|
| 164 |
+
dt = dth / st[:, None, None]
|
| 165 |
+
|
| 166 |
+
omr2 = (1.0 - rho.square()).clamp_min(0.08)[:, None, None]
|
| 167 |
+
quad = (df.square() - 2 * rho[:, None, None] * df * dt + dt.square()) / omr2
|
| 168 |
+
base = torch.exp(-0.5 * quad.clamp_max(80.0))
|
| 169 |
+
skew_arg = 1.6 * (skew_f[:, None, None] * df + skew_t[:, None, None] * dt)
|
| 170 |
+
base = base * (2.0 * torch.sigmoid(skew_arg))
|
| 171 |
+
|
| 172 |
+
mass = torch.expm1(
|
| 173 |
+
log_e.clamp(0, 1)
|
| 174 |
+
* math.log1p(float(self.cfg.n_freqs * self.cfg.n_dirs))
|
| 175 |
+
)
|
| 176 |
+
base = base * (
|
| 177 |
+
mass[:, None, None]
|
| 178 |
+
/ base.sum(dim=(1, 2), keepdim=True).clamp_min(1e-8)
|
| 179 |
+
)
|
| 180 |
+
return base.clamp(0, 1).view(
|
| 181 |
+
*leading, self.cfg.n_freqs, self.cfg.n_dirs
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
class FiLMResBlock(nn.Module):
|
| 186 |
+
def __init__(self, ch: int, cond_dim: int):
|
| 187 |
+
super().__init__()
|
| 188 |
+
self.norm1 = nn.GroupNorm(min(8, ch), ch)
|
| 189 |
+
self.norm2 = nn.GroupNorm(min(8, ch), ch)
|
| 190 |
+
self.conv1 = nn.Conv2d(ch, ch, 3, padding=1)
|
| 191 |
+
self.conv2 = nn.Conv2d(ch, ch, 3, padding=1)
|
| 192 |
+
self.cond = nn.Linear(cond_dim, 4 * ch)
|
| 193 |
+
|
| 194 |
+
def forward(self, x, c):
|
| 195 |
+
g1, b1, g2, b2 = self.cond(c).chunk(4, dim=-1)
|
| 196 |
+
h = self.norm1(x) * (1 + 0.15 * g1[:, :, None, None]) + 0.15 * b1[:, :, None, None]
|
| 197 |
+
h = self.conv1(F.gelu(h))
|
| 198 |
+
h = self.norm2(h) * (1 + 0.15 * g2[:, :, None, None]) + 0.15 * b2[:, :, None, None]
|
| 199 |
+
h = self.conv2(F.gelu(h))
|
| 200 |
+
return x + h
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
class SemanticConditionalDecoder(nn.Module):
|
| 204 |
+
"""Experiment-1 semantic-only learned decoder, retained as the fixed baseline."""
|
| 205 |
+
def __init__(self, cfg: Optional[SemanticShapeExp2Config] = None):
|
| 206 |
+
super().__init__()
|
| 207 |
+
self.cfg = cfg or SemanticShapeExp2Config()
|
| 208 |
+
w = self.cfg.width
|
| 209 |
+
self.fc = nn.Sequential(nn.Linear(9, 4 * w * 6 * 9), nn.GELU())
|
| 210 |
+
self.b0 = FiLMResBlock(4 * w, 9)
|
| 211 |
+
self.up1 = nn.Conv2d(4 * w, 4 * w, 3, padding=1)
|
| 212 |
+
self.b1 = FiLMResBlock(w, 9)
|
| 213 |
+
self.up2 = nn.Conv2d(w, 4 * w, 3, padding=1)
|
| 214 |
+
self.b2 = FiLMResBlock(w, 9)
|
| 215 |
+
self.up3 = nn.Conv2d(w, 4 * w, 3, padding=1)
|
| 216 |
+
self.b3 = FiLMResBlock(w, 9)
|
| 217 |
+
|
| 218 |
+
self.prior_stem = nn.Sequential(
|
| 219 |
+
nn.Conv2d(4, w, 3, padding=1),
|
| 220 |
+
nn.GroupNorm(min(8, w), w),
|
| 221 |
+
nn.GELU(),
|
| 222 |
+
ResBlock(w),
|
| 223 |
+
)
|
| 224 |
+
self.fuse = nn.Sequential(
|
| 225 |
+
nn.Conv2d(2 * w, w, 3, padding=1),
|
| 226 |
+
nn.GroupNorm(min(8, w), w),
|
| 227 |
+
nn.GELU(),
|
| 228 |
+
ResBlock(w),
|
| 229 |
+
ResBlock(w),
|
| 230 |
+
nn.Conv2d(w, 1, 1),
|
| 231 |
+
)
|
| 232 |
+
|
| 233 |
+
def forward(self, sem: torch.Tensor, analytic_prior: torch.Tensor) -> torch.Tensor:
|
| 234 |
+
N = sem.shape[0]
|
| 235 |
+
w = self.cfg.width
|
| 236 |
+
h = self.fc(sem).view(N, 4 * w, 6, 9)
|
| 237 |
+
h = self.b0(h, sem)
|
| 238 |
+
h = F.pixel_shuffle(self.up1(h), 2)
|
| 239 |
+
h = self.b1(h, sem)
|
| 240 |
+
h = F.pixel_shuffle(self.up2(h), 2)
|
| 241 |
+
h = self.b2(h, sem)
|
| 242 |
+
h = F.pixel_shuffle(self.up3(h), 2)
|
| 243 |
+
h = self.b3(h, sem)
|
| 244 |
+
h = h[:, :, : self.cfg.n_freqs, :]
|
| 245 |
+
|
| 246 |
+
coords = coordinate_channels(
|
| 247 |
+
N, self.cfg.n_freqs, self.cfg.n_dirs, sem.device, sem.dtype
|
| 248 |
+
)
|
| 249 |
+
p = self.prior_stem(torch.cat([analytic_prior[:, None], coords], dim=1))
|
| 250 |
+
logits = self.fuse(torch.cat([h, p], dim=1)).squeeze(1)
|
| 251 |
+
return torch.sigmoid(logits)
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
class ShapeResidualEncoder(nn.Module):
|
| 256 |
+
"""Encode sample-specific residual information missed by the frozen semantic backbone."""
|
| 257 |
+
def __init__(self, cfg):
|
| 258 |
+
super().__init__()
|
| 259 |
+
self.cfg = cfg
|
| 260 |
+
w = cfg.width
|
| 261 |
+
self.stem = nn.Sequential(
|
| 262 |
+
CircularConv2d(8, w, stride=2),
|
| 263 |
+
nn.GroupNorm(min(8, w), w), nn.GELU(), ResBlock(w),
|
| 264 |
+
CircularConv2d(w, 2*w, stride=2),
|
| 265 |
+
nn.GroupNorm(min(8, 2*w), 2*w), nn.GELU(), ResBlock(2*w),
|
| 266 |
+
CircularConv2d(2*w, 4*w, stride=2),
|
| 267 |
+
nn.GroupNorm(min(8, 4*w), 4*w), nn.GELU(), ResBlock(4*w),
|
| 268 |
+
)
|
| 269 |
+
ch = 4*w
|
| 270 |
+
self.attn = nn.Conv2d(ch, 1, 1)
|
| 271 |
+
self.fuse = nn.Sequential(
|
| 272 |
+
nn.Linear(3*ch, 2*ch), nn.GELU(),
|
| 273 |
+
nn.Linear(2*ch, cfg.shape_feature_dim),
|
| 274 |
+
nn.LayerNorm(cfg.shape_feature_dim),
|
| 275 |
+
)
|
| 276 |
+
|
| 277 |
+
@staticmethod
|
| 278 |
+
def _log_map(x):
|
| 279 |
+
return torch.log1p(100.0*x.clamp_min(0))/math.log1p(100.0)
|
| 280 |
+
|
| 281 |
+
def forward(self, part, semantic_base, analytic_prior):
|
| 282 |
+
N,H,W = part.shape
|
| 283 |
+
r = self._log_map(part) - self._log_map(semantic_base)
|
| 284 |
+
coords = coordinate_channels(N,H,W,part.device,part.dtype)
|
| 285 |
+
x = torch.cat([
|
| 286 |
+
part[:,None], semantic_base[:,None], analytic_prior[:,None],
|
| 287 |
+
F.relu(r)[:,None], F.relu(-r)[:,None], coords,
|
| 288 |
+
], dim=1)
|
| 289 |
+
h = self.stem(x)
|
| 290 |
+
flat = h.flatten(2)
|
| 291 |
+
a = torch.softmax(self.attn(h).flatten(2), dim=-1)
|
| 292 |
+
pa = (flat*a).sum(-1)
|
| 293 |
+
pmax = F.adaptive_max_pool2d(h,1).flatten(1)
|
| 294 |
+
pavg = F.adaptive_avg_pool2d(h,1).flatten(1)
|
| 295 |
+
return self.fuse(torch.cat([pa,pmax,pavg],dim=-1))
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
class ContinuousBottleneck(nn.Module):
|
| 299 |
+
"""d-dimensional continuous code with a zero-preserving expansion to fixed code width."""
|
| 300 |
+
def __init__(self, cfg, latent_dim):
|
| 301 |
+
super().__init__()
|
| 302 |
+
self.latent_dim = int(latent_dim)
|
| 303 |
+
self.to_latent = nn.Sequential(
|
| 304 |
+
nn.Linear(cfg.shape_feature_dim, 32), nn.GELU(),
|
| 305 |
+
nn.Linear(32, self.latent_dim), nn.Tanh(),
|
| 306 |
+
)
|
| 307 |
+
# Bias-free: z=0 maps exactly to code=0.
|
| 308 |
+
self.expand1 = nn.Linear(self.latent_dim, cfg.code_width, bias=False)
|
| 309 |
+
self.expand2 = nn.Linear(cfg.code_width, cfg.code_width, bias=False)
|
| 310 |
+
|
| 311 |
+
def encode(self, h):
|
| 312 |
+
return self.to_latent(h)
|
| 313 |
+
|
| 314 |
+
def expand(self, z):
|
| 315 |
+
return self.expand2(F.gelu(self.expand1(z)))
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
class ResidualFieldDecoder(nn.Module):
|
| 319 |
+
"""Decode a bounded log-domain correction field.
|
| 320 |
+
|
| 321 |
+
Causal construction:
|
| 322 |
+
Delta(z,s) = F(z,s) - F(0,s)
|
| 323 |
+
Therefore Delta(0,s)=0 by construction and zero code returns the semantic base.
|
| 324 |
+
"""
|
| 325 |
+
def __init__(self, cfg):
|
| 326 |
+
super().__init__()
|
| 327 |
+
self.cfg = cfg
|
| 328 |
+
w = cfg.width
|
| 329 |
+
cond_dim = cfg.semantic_dim + cfg.code_width
|
| 330 |
+
self.code_fc = nn.Sequential(nn.Linear(cond_dim, 4*w*6*9), nn.GELU())
|
| 331 |
+
self.b0 = FiLMResBlock(4*w, cond_dim)
|
| 332 |
+
self.up1 = nn.Conv2d(4*w, 4*w, 3, padding=1)
|
| 333 |
+
self.b1 = FiLMResBlock(w, cond_dim)
|
| 334 |
+
self.up2 = nn.Conv2d(w, 4*w, 3, padding=1)
|
| 335 |
+
self.b2 = FiLMResBlock(w, cond_dim)
|
| 336 |
+
self.up3 = nn.Conv2d(w, 4*w, 3, padding=1)
|
| 337 |
+
self.b3 = FiLMResBlock(w, cond_dim)
|
| 338 |
+
self.context = nn.Sequential(
|
| 339 |
+
nn.Conv2d(5, w, 3, padding=1),
|
| 340 |
+
nn.GroupNorm(min(8,w),w), nn.GELU(),
|
| 341 |
+
ResBlock(w), ResBlock(w),
|
| 342 |
+
)
|
| 343 |
+
self.fuse = nn.Sequential(
|
| 344 |
+
nn.Conv2d(2*w, w, 3, padding=1),
|
| 345 |
+
nn.GroupNorm(min(8,w),w), nn.GELU(),
|
| 346 |
+
ResBlock(w), ResBlock(w),
|
| 347 |
+
nn.Conv2d(w,1,1),
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
+
@staticmethod
|
| 351 |
+
def log_map(x):
|
| 352 |
+
return torch.log1p(100.0*x.clamp_min(0))/math.log1p(100.0)
|
| 353 |
+
|
| 354 |
+
@staticmethod
|
| 355 |
+
def inv_log(y):
|
| 356 |
+
return torch.expm1(y.clamp(0,1)*math.log1p(100.0))/100.0
|
| 357 |
+
|
| 358 |
+
def field(self, sem, analytic_prior, semantic_base, code):
|
| 359 |
+
N = sem.shape[0]; w = self.cfg.width
|
| 360 |
+
cond = torch.cat([sem,code],dim=-1)
|
| 361 |
+
h = self.code_fc(cond).view(N,4*w,6,9)
|
| 362 |
+
h = self.b0(h,cond)
|
| 363 |
+
h = F.pixel_shuffle(self.up1(h),2); h = self.b1(h,cond)
|
| 364 |
+
h = F.pixel_shuffle(self.up2(h),2); h = self.b2(h,cond)
|
| 365 |
+
h = F.pixel_shuffle(self.up3(h),2); h = self.b3(h,cond)
|
| 366 |
+
h = h[:,:,:self.cfg.n_freqs,:]
|
| 367 |
+
coords = coordinate_channels(N,self.cfg.n_freqs,self.cfg.n_dirs,sem.device,sem.dtype)
|
| 368 |
+
c = self.context(torch.cat([analytic_prior[:,None],semantic_base[:,None],coords],dim=1))
|
| 369 |
+
return self.fuse(torch.cat([h,c],dim=1)).squeeze(1)
|
| 370 |
+
|
| 371 |
+
def forward(self, sem, analytic_prior, semantic_base, code, raw0=None):
|
| 372 |
+
raw = self.field(sem,analytic_prior,semantic_base,code)
|
| 373 |
+
if raw0 is None:
|
| 374 |
+
zero = torch.zeros_like(code)
|
| 375 |
+
raw0 = self.field(sem,analytic_prior,semantic_base,zero)
|
| 376 |
+
delta = raw - raw0
|
| 377 |
+
corr = self.cfg.max_residual_log * torch.tanh(delta)
|
| 378 |
+
pred_log = (self.log_map(semantic_base)+corr).clamp(0,1)
|
| 379 |
+
return self.inv_log(pred_log), corr, raw0
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
class CausalResidualCodec(nn.Module):
|
| 383 |
+
def __init__(self, cfg, latent_dim):
|
| 384 |
+
super().__init__()
|
| 385 |
+
self.cfg = cfg
|
| 386 |
+
self.latent_dim = int(latent_dim)
|
| 387 |
+
self.encoder = ShapeResidualEncoder(cfg)
|
| 388 |
+
self.bottleneck = ContinuousBottleneck(cfg, latent_dim)
|
| 389 |
+
self.decoder = ResidualFieldDecoder(cfg)
|
| 390 |
+
|
| 391 |
+
def encode(self, part, semantic_base, analytic_prior):
|
| 392 |
+
h = self.encoder(part,semantic_base,analytic_prior)
|
| 393 |
+
z = self.bottleneck.encode(h)
|
| 394 |
+
return h,z
|
| 395 |
+
|
| 396 |
+
def decode_latent(self, z, sem, analytic_prior, semantic_base, raw0=None):
|
| 397 |
+
code = self.bottleneck.expand(z)
|
| 398 |
+
pred,corr,raw0 = self.decoder(sem,analytic_prior,semantic_base,code,raw0=raw0)
|
| 399 |
+
return {'pred':pred,'corr':corr,'code':code,'latent':z,'raw0':raw0}
|
| 400 |
+
|
| 401 |
+
def forward(self, part, sem, analytic_prior, semantic_base, latent_override=None):
|
| 402 |
+
h,z = self.encode(part,semantic_base,analytic_prior)
|
| 403 |
+
use_z = z if latent_override is None else latent_override
|
| 404 |
+
out = self.decode_latent(use_z,sem,analytic_prior,semantic_base)
|
| 405 |
+
out['encoder_feature'] = h
|
| 406 |
+
out['encoded_latent'] = z
|
| 407 |
+
return out
|
| 408 |
+
|
| 409 |
+
def num_params(self):
|
| 410 |
+
return sum(p.numel() for p in self.parameters())
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
Config = SemanticShapeExp2Config
|
| 414 |
+
Model = CausalResidualCodec
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/WaveSemanticHybridCodec_Exp2B_best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f6156d298baf2762d1a3a53f7b510d64da4e80256506021b95ac942396ed391
|
| 3 |
+
size 46202454
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
| 2 |
+
# This file is a cache directory tag created by huggingface_hub.
|
| 3 |
+
# For information about cache directory tags, see:
|
| 4 |
+
# https://bford.info/cachedir/
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/blobs/9c4623c05be35b459d1790ec4e93fa447c7a0dc5
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
WaveSystemGraphParser v4.7b protected real+synthetic core-locked: core-attached support topology graph parser for ICWDS
|
| 3 |
+
===================================================================
|
| 4 |
+
Purpose
|
| 5 |
+
-------
|
| 6 |
+
This model is the next-stage frontend after WaveSystemParser v3.x.
|
| 7 |
+
It does not ask a CNN to draw wave-system masks from scratch. Instead:
|
| 8 |
+
|
| 9 |
+
E(f,theta)
|
| 10 |
+
-> physical peak/basin proposals generated outside the model
|
| 11 |
+
-> node/edge graph reasoning over proposals
|
| 12 |
+
-> learned merge / keep / slot assembly
|
| 13 |
+
-> light CNN boundary refinement
|
| 14 |
+
|
| 15 |
+
This treats watershed-like basins as over-segmentation proposals, not labels.
|
| 16 |
+
The learnable part decides which candidates are physical wave systems, which
|
| 17 |
+
should be merged, and which should be sent to the downstream self-pruning VAE.
|
| 18 |
+
|
| 19 |
+
v4.5 is designed for a double-layer physical teacher: peak-core proposals define
|
| 20 |
+
system identity/count, while valley-constrained support proposals recover the full
|
| 21 |
+
energetic wave-system footprint. Stripe-like bands can be attached as tails but
|
| 22 |
+
are not allowed to become independent systems without a peak core.
|
| 23 |
+
|
| 24 |
+
All operations are lightweight and Colab-friendly. No Transformer blocks.
|
| 25 |
+
"""
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass, asdict
|
| 28 |
+
from typing import Optional, Dict
|
| 29 |
+
|
| 30 |
+
import torch
|
| 31 |
+
import torch.nn as nn
|
| 32 |
+
import torch.nn.functional as F
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@dataclass
|
| 36 |
+
class GraphParserV47Config:
|
| 37 |
+
n_freqs: int = 47
|
| 38 |
+
n_dirs: int = 72
|
| 39 |
+
n_slots: int = 6
|
| 40 |
+
bg_index: int = 6
|
| 41 |
+
p_max: int = 18
|
| 42 |
+
prop_feat_dim: int = 22
|
| 43 |
+
width: int = 32
|
| 44 |
+
depth: int = 4
|
| 45 |
+
node_dim: int = 48
|
| 46 |
+
edge_dim: int = 64
|
| 47 |
+
pair_feat_dim: int = 8
|
| 48 |
+
use_coord: bool = True
|
| 49 |
+
use_physics: bool = True
|
| 50 |
+
rank_temp: float = 0.12
|
| 51 |
+
count_min: float = 1.0
|
| 52 |
+
count_max: float = 6.0
|
| 53 |
+
bg_prior_bias: float = 0.38
|
| 54 |
+
bg_energy_suppress: float = 14.5
|
| 55 |
+
bg_energy_gamma: float = 0.70
|
| 56 |
+
proposal_logit_gain: float = 5.25
|
| 57 |
+
|
| 58 |
+
def to_dict(self):
|
| 59 |
+
return asdict(self)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class DepthwiseSeparable(nn.Module):
|
| 63 |
+
def __init__(self, ci: int, co: int):
|
| 64 |
+
super().__init__()
|
| 65 |
+
self.dw = nn.Conv2d(ci, ci, 3, padding=1, groups=ci, bias=False)
|
| 66 |
+
self.pw = nn.Conv2d(ci, co, 1, bias=False)
|
| 67 |
+
self.norm = nn.GroupNorm(min(8, co), co)
|
| 68 |
+
self.act = nn.GELU()
|
| 69 |
+
|
| 70 |
+
def forward(self, x):
|
| 71 |
+
return self.act(self.norm(self.pw(self.dw(x))))
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class PhysicsAwareModule(nn.Module):
|
| 75 |
+
def __init__(self, ch: int, n_dirs: int):
|
| 76 |
+
super().__init__()
|
| 77 |
+
self.n_dirs = n_dirs
|
| 78 |
+
dirs = torch.linspace(0, 2 * math.pi, n_dirs + 1)[:n_dirs]
|
| 79 |
+
self.register_buffer("cos_d", torch.cos(dirs).view(1, 1, 1, n_dirs))
|
| 80 |
+
self.register_buffer("sin_d", torch.sin(dirs).view(1, 1, 1, n_dirs))
|
| 81 |
+
self.fuse = nn.Conv2d(ch + 3, ch, 1, bias=False)
|
| 82 |
+
self.norm = nn.GroupNorm(min(8, ch), ch)
|
| 83 |
+
self.act = nn.GELU()
|
| 84 |
+
|
| 85 |
+
def _phys_features(self, E):
|
| 86 |
+
eps = 1e-8
|
| 87 |
+
En = torch.nan_to_num(E, nan=0.0, posinf=1.0, neginf=0.0).clamp_min(0)
|
| 88 |
+
En = En / (En.amax(dim=(2, 3), keepdim=True) + eps)
|
| 89 |
+
nf = En.shape[2]
|
| 90 |
+
rev_cumsum = torch.flip(torch.cumsum(torch.flip(En, dims=[2]), dim=2), dims=[2])
|
| 91 |
+
col_sum = En.sum(dim=2, keepdim=True) + eps
|
| 92 |
+
hf_tail = rev_cumsum / col_sum
|
| 93 |
+
cx = (En * self.cos_d).sum(dim=3, keepdim=True)
|
| 94 |
+
cy = (En * self.sin_d).sum(dim=3, keepdim=True)
|
| 95 |
+
row_sum = En.sum(dim=3, keepdim=True) + eps
|
| 96 |
+
dir_conc = torch.sqrt(cx ** 2 + cy ** 2) / row_sum
|
| 97 |
+
dir_conc = dir_conc.expand(-1, -1, -1, self.n_dirs)
|
| 98 |
+
fcoord = torch.linspace(0, 1, nf, device=E.device, dtype=E.dtype).view(1, 1, nf, 1)
|
| 99 |
+
fc = (En * fcoord).sum(dim=2, keepdim=True) / col_sum
|
| 100 |
+
spread = torch.sqrt(((En * (fcoord - fc) ** 2).sum(dim=2, keepdim=True)) / col_sum)
|
| 101 |
+
spread = spread.expand(-1, -1, nf, -1)
|
| 102 |
+
return torch.cat([hf_tail, dir_conc, spread], dim=1)
|
| 103 |
+
|
| 104 |
+
def forward(self, h, E):
|
| 105 |
+
return self.act(self.norm(self.fuse(torch.cat([h, self._phys_features(E)], dim=1))))
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class WaveSystemGraphParserV47(nn.Module):
|
| 109 |
+
"""Proposal graph parser.
|
| 110 |
+
|
| 111 |
+
forward inputs
|
| 112 |
+
--------------
|
| 113 |
+
x: [B,1,47,72], normalized to [-1,1]
|
| 114 |
+
prop_masks: [B,P,47,72], binary/soft physical basin proposals
|
| 115 |
+
prop_feats: [B,P,F], proposal features produced by the training script
|
| 116 |
+
prop_valid: [B,P], 1 if proposal exists
|
| 117 |
+
|
| 118 |
+
outputs include final probability masks, node slot assignments, edge logits,
|
| 119 |
+
count prediction, and diagnostics.
|
| 120 |
+
"""
|
| 121 |
+
def __init__(self, cfg: Optional[GraphParserV47Config] = None):
|
| 122 |
+
super().__init__()
|
| 123 |
+
self.cfg = cfg or GraphParserV47Config()
|
| 124 |
+
c = self.cfg
|
| 125 |
+
in_ch = 1 + (3 if c.use_coord else 0)
|
| 126 |
+
self.stem = nn.Conv2d(in_ch, c.width, 3, padding=1)
|
| 127 |
+
self.stem_norm = nn.GroupNorm(min(8, c.width), c.width)
|
| 128 |
+
self.physics = PhysicsAwareModule(c.width, c.n_dirs) if c.use_physics else None
|
| 129 |
+
self.blocks = nn.ModuleList([DepthwiseSeparable(c.width, c.width) for _ in range(c.depth)])
|
| 130 |
+
self.global_pool = nn.AdaptiveAvgPool2d(1)
|
| 131 |
+
self.residual_head = nn.Conv2d(c.width, c.n_slots + 1, 1)
|
| 132 |
+
nn.init.zeros_(self.residual_head.weight)
|
| 133 |
+
nn.init.zeros_(self.residual_head.bias)
|
| 134 |
+
|
| 135 |
+
self.node_mlp = nn.Sequential(
|
| 136 |
+
nn.Linear(c.width + c.prop_feat_dim, c.node_dim), nn.GELU(),
|
| 137 |
+
nn.Linear(c.node_dim, c.node_dim), nn.GELU(),
|
| 138 |
+
)
|
| 139 |
+
self.node_keep = nn.Linear(c.node_dim, 1)
|
| 140 |
+
self.node_slot = nn.Linear(c.node_dim, c.n_slots)
|
| 141 |
+
self.count_head = nn.Sequential(
|
| 142 |
+
nn.Linear(c.width + c.node_dim, c.width), nn.GELU(), nn.Linear(c.width, c.n_slots)
|
| 143 |
+
)
|
| 144 |
+
# Edge head uses node_i, node_j, absolute difference, product, plus handcrafted physical pair features.
|
| 145 |
+
self.edge_head = nn.Sequential(
|
| 146 |
+
nn.Linear(4 * c.node_dim + c.pair_feat_dim, c.edge_dim), nn.GELU(),
|
| 147 |
+
nn.Linear(c.edge_dim, c.edge_dim), nn.GELU(), nn.Linear(c.edge_dim, 1)
|
| 148 |
+
)
|
| 149 |
+
self._coord_cache = None
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
@staticmethod
|
| 153 |
+
def _clean_tensor(x, fill=0.0, lo=-30.0, hi=30.0):
|
| 154 |
+
return torch.nan_to_num(x, nan=fill, posinf=hi, neginf=lo).clamp(lo, hi)
|
| 155 |
+
|
| 156 |
+
@staticmethod
|
| 157 |
+
def _safe_softmax(logits, dim):
|
| 158 |
+
logits = torch.nan_to_num(logits, nan=0.0, posinf=30.0, neginf=-30.0).clamp(-30.0, 30.0)
|
| 159 |
+
logits = logits - logits.max(dim=dim, keepdim=True).values.detach()
|
| 160 |
+
p = torch.softmax(logits, dim=dim)
|
| 161 |
+
return torch.nan_to_num(p, nan=0.0, posinf=1.0, neginf=0.0)
|
| 162 |
+
|
| 163 |
+
def _coord_channels(self, B, device, dtype):
|
| 164 |
+
c = self.cfg
|
| 165 |
+
if self._coord_cache is None:
|
| 166 |
+
nf, nd = c.n_freqs, c.n_dirs
|
| 167 |
+
fcoord = torch.linspace(0, 1, nf).view(1, 1, nf, 1).expand(1, 1, nf, nd)
|
| 168 |
+
ang = torch.linspace(0, 2 * math.pi, nd + 1)[:nd].view(1, 1, 1, nd).expand(1, 1, nf, nd)
|
| 169 |
+
self._coord_cache = torch.cat([fcoord, torch.sin(ang), torch.cos(ang)], dim=1)
|
| 170 |
+
return self._coord_cache.to(device=device, dtype=dtype).expand(B, -1, -1, -1)
|
| 171 |
+
|
| 172 |
+
def _rank_prune_presence(self, slot_mass, count_soft):
|
| 173 |
+
c = self.cfg
|
| 174 |
+
B, K = slot_mass.shape
|
| 175 |
+
_, order = torch.sort(slot_mass, dim=1, descending=True)
|
| 176 |
+
rank_pos = torch.arange(1, K + 1, device=slot_mass.device, dtype=slot_mass.dtype).view(1, K)
|
| 177 |
+
cs = count_soft.clamp(c.count_min, c.count_max).view(B, 1)
|
| 178 |
+
gate_sorted = torch.sigmoid((cs + 0.5 - rank_pos) / c.rank_temp)
|
| 179 |
+
gate = torch.zeros_like(gate_sorted).scatter(1, order, gate_sorted)
|
| 180 |
+
return gate.clamp(0, 1)
|
| 181 |
+
|
| 182 |
+
def _node_pool(self, h, prop_masks, prop_valid):
|
| 183 |
+
# h: [B,C,H,W], prop_masks [B,P,H,W]
|
| 184 |
+
B, C, H, W = h.shape
|
| 185 |
+
P = prop_masks.shape[1]
|
| 186 |
+
denom = prop_masks.flatten(2).sum(dim=2).clamp_min(1.0) # [B,P]
|
| 187 |
+
pooled = torch.einsum("bchw,bphw->bpc", h, prop_masks) / denom[:, :, None]
|
| 188 |
+
pooled = pooled * prop_valid[:, :, None]
|
| 189 |
+
return pooled
|
| 190 |
+
|
| 191 |
+
def _edge_logits(self, node, prop_feats, prop_valid):
|
| 192 |
+
B, P, D = node.shape
|
| 193 |
+
ni = node[:, :, None, :].expand(B, P, P, D)
|
| 194 |
+
nj = node[:, None, :, :].expand(B, P, P, D)
|
| 195 |
+
# Pair physical features from proposal features: distance in f/theta and mass contrast.
|
| 196 |
+
# feat layout is defined in training script: mass, peak, area, mu_f, sin_t, cos_t, ...
|
| 197 |
+
fi = prop_feats[:, :, 3][:, :, None]
|
| 198 |
+
fj = prop_feats[:, :, 3][:, None, :]
|
| 199 |
+
d_f = (fi - fj).abs()
|
| 200 |
+
si = prop_feats[:, :, 4][:, :, None]; ci = prop_feats[:, :, 5][:, :, None]
|
| 201 |
+
sj = prop_feats[:, :, 4][:, None, :]; cj = prop_feats[:, :, 5][:, None, :]
|
| 202 |
+
dot = (si * sj + ci * cj).clamp(-1.0 + 1e-5, 1.0 - 1e-5)
|
| 203 |
+
d_t = torch.acos(dot) / math.pi
|
| 204 |
+
mi = prop_feats[:, :, 0][:, :, None]
|
| 205 |
+
mj = prop_feats[:, :, 0][:, None, :]
|
| 206 |
+
d_m = (mi - mj).abs()
|
| 207 |
+
sf_i = prop_feats[:, :, 6][:, :, None]; sf_j = prop_feats[:, :, 6][:, None, :]
|
| 208 |
+
st_i = prop_feats[:, :, 7][:, :, None]; st_j = prop_feats[:, :, 7][:, None, :]
|
| 209 |
+
d_sf = (sf_i - sf_j).abs()
|
| 210 |
+
d_st = (st_i - st_j).abs()
|
| 211 |
+
prom_i = prop_feats[:, :, 12][:, :, None]; prom_j = prop_feats[:, :, 12][:, None, :]
|
| 212 |
+
prom_min = torch.minimum(prom_i, prom_j)
|
| 213 |
+
stripe_i = prop_feats[:, :, 13][:, :, None]; stripe_j = prop_feats[:, :, 13][:, None, :]
|
| 214 |
+
stripe_max = torch.maximum(stripe_i, stripe_j)
|
| 215 |
+
qual_i = prop_feats[:, :, 11][:, :, None]; qual_j = prop_feats[:, :, 11][:, None, :]
|
| 216 |
+
qual_min = torch.minimum(qual_i, qual_j)
|
| 217 |
+
pair_phys = torch.stack([d_f, d_t, d_m, d_sf, d_st, prom_min, stripe_max, qual_min], dim=-1)
|
| 218 |
+
inp = torch.cat([ni, nj, (ni - nj).abs(), ni * nj, pair_phys], dim=-1)
|
| 219 |
+
e = self.edge_head(inp).squeeze(-1)
|
| 220 |
+
valid_pair = (prop_valid[:, :, None] * prop_valid[:, None, :]).bool()
|
| 221 |
+
eye = torch.eye(P, device=node.device, dtype=torch.bool).view(1, P, P)
|
| 222 |
+
e = e.masked_fill(~valid_pair | eye, 0.0)
|
| 223 |
+
return e, valid_pair & (~eye)
|
| 224 |
+
|
| 225 |
+
def forward(self, x, prop_masks, prop_feats, prop_valid, prior_w=2.5, residual_w=0.0):
|
| 226 |
+
c = self.cfg
|
| 227 |
+
B, _, H, W = x.shape
|
| 228 |
+
prop_masks = torch.nan_to_num(prop_masks.float(), nan=0.0, posinf=0.0, neginf=0.0).clamp(0, 1)
|
| 229 |
+
prop_feats = torch.nan_to_num(prop_feats.float(), nan=0.0, posinf=5.0, neginf=-5.0).clamp(-5.0, 5.0)
|
| 230 |
+
prop_valid = prop_valid.float().clamp(0, 1)
|
| 231 |
+
h_in = torch.cat([x, self._coord_channels(B, x.device, x.dtype)], dim=1) if c.use_coord else x
|
| 232 |
+
h = self._clean_tensor(F.gelu(self.stem_norm(self.stem(h_in))), lo=-20.0, hi=20.0)
|
| 233 |
+
E01 = torch.nan_to_num((x + 1.0) * 0.5, nan=0.0, posinf=1.0, neginf=0.0).clamp(0, 1)
|
| 234 |
+
if self.physics is not None:
|
| 235 |
+
h = self._clean_tensor(h + self.physics(h, E01), lo=-20.0, hi=20.0)
|
| 236 |
+
for blk in self.blocks:
|
| 237 |
+
h = self._clean_tensor(h + blk(h), lo=-20.0, hi=20.0)
|
| 238 |
+
global_feat = self.global_pool(h).flatten(1)
|
| 239 |
+
node_pool = self._node_pool(h, prop_masks, prop_valid)
|
| 240 |
+
node_in = torch.cat([node_pool, prop_feats], dim=-1)
|
| 241 |
+
node = self._clean_tensor(self.node_mlp(node_in), lo=-20.0, hi=20.0) * prop_valid[:, :, None]
|
| 242 |
+
node_keep_logit = self._clean_tensor(self.node_keep(node).squeeze(-1), lo=-20.0, hi=20.0).masked_fill(prop_valid <= 0, -20.0)
|
| 243 |
+
node_keep = torch.sigmoid(node_keep_logit) * prop_valid
|
| 244 |
+
node_slot_logits = self._clean_tensor(self.node_slot(node), lo=-20.0, hi=20.0).masked_fill(prop_valid[:, :, None] <= 0, -20.0)
|
| 245 |
+
node_slot = self._safe_softmax(node_slot_logits, dim=-1) * prop_valid[:, :, None]
|
| 246 |
+
node_context = (node * node_keep[:, :, None]).sum(dim=1) / node_keep.sum(dim=1, keepdim=True).clamp_min(1.0)
|
| 247 |
+
count_logits = self._clean_tensor(self.count_head(torch.cat([global_feat, node_context], dim=-1)), lo=-20.0, hi=20.0)
|
| 248 |
+
count_probs = torch.sigmoid(count_logits)
|
| 249 |
+
count_soft = count_probs.sum(dim=1).clamp(c.count_min, c.count_max)
|
| 250 |
+
|
| 251 |
+
# Proposal graph edge logits.
|
| 252 |
+
edge_logits, edge_valid = self._edge_logits(node, prop_feats, prop_valid)
|
| 253 |
+
edge_logits = self._clean_tensor(edge_logits, lo=-20.0, hi=20.0)
|
| 254 |
+
# Slot priors from proposal assembly.
|
| 255 |
+
assign = node_slot * node_keep[:, :, None]
|
| 256 |
+
prior_signal = torch.einsum("bpk,bphw->bkhw", assign, prop_masks)
|
| 257 |
+
# Normalize each slot prior but preserve zero slots.
|
| 258 |
+
prior_signal = prior_signal / prior_signal.amax(dim=(2, 3), keepdim=True).clamp_min(1e-6)
|
| 259 |
+
prior_signal = torch.nan_to_num(prior_signal, nan=0.0, posinf=1.0, neginf=0.0).clamp(0.0, 1.0)
|
| 260 |
+
denom = E01.sum(dim=(2, 3)).clamp_min(1e-6)
|
| 261 |
+
slot_mass = (prior_signal * E01).sum(dim=(2, 3)) / denom
|
| 262 |
+
presence = self._rank_prune_presence(slot_mass, count_soft)
|
| 263 |
+
prior_signal = prior_signal * presence[:, :, None, None]
|
| 264 |
+
|
| 265 |
+
En = E01 / E01.amax(dim=(2, 3), keepdim=True).clamp_min(1e-6)
|
| 266 |
+
bg_prior_logit = c.bg_prior_bias - c.bg_energy_suppress * En.pow(c.bg_energy_gamma)
|
| 267 |
+
residual_logits = self.residual_head(h)
|
| 268 |
+
signal_logits = prior_w * (c.proposal_logit_gain * torch.log(prior_signal.clamp_min(1e-6))) + residual_w * residual_logits[:, :c.n_slots]
|
| 269 |
+
bg_logits = prior_w * bg_prior_logit + residual_w * residual_logits[:, c.n_slots:c.n_slots + 1]
|
| 270 |
+
logits = self._clean_tensor(torch.cat([signal_logits, bg_logits], dim=1), lo=-60.0, hi=60.0)
|
| 271 |
+
prob_raw = self._safe_softmax(logits, dim=1)
|
| 272 |
+
prob = prob_raw / prob_raw.sum(dim=1, keepdim=True).clamp_min(1e-6)
|
| 273 |
+
|
| 274 |
+
prior_logits = self._clean_tensor(torch.cat([c.proposal_logit_gain * torch.log(prior_signal.clamp_min(1e-6)), bg_prior_logit], dim=1), lo=-60.0, hi=60.0)
|
| 275 |
+
prior_prob = self._safe_softmax(prior_logits, dim=1)
|
| 276 |
+
return {
|
| 277 |
+
"logits": logits, "prob": prob, "prob_raw": prob_raw,
|
| 278 |
+
"prior_signal": prior_signal, "prior_logits": prior_logits, "prior_prob": prior_prob,
|
| 279 |
+
"residual_logits": residual_logits,
|
| 280 |
+
"node": node, "node_keep_logit": node_keep_logit, "node_keep": node_keep,
|
| 281 |
+
"node_slot_logits": node_slot_logits, "node_slot": node_slot,
|
| 282 |
+
"edge_logits": edge_logits, "edge_valid": edge_valid,
|
| 283 |
+
"count_logits": count_logits, "count_probs": count_probs, "count_soft": count_soft,
|
| 284 |
+
"slot_mass": slot_mass, "presence": presence,
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
@torch.no_grad()
|
| 288 |
+
def prior_foreground_metrics(self, out, E01, high_quantile=0.80):
|
| 289 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 290 |
+
flat = E.flatten(1)
|
| 291 |
+
thr = torch.quantile(flat, high_quantile, dim=1).view(-1, 1, 1)
|
| 292 |
+
mask_hi = E >= thr
|
| 293 |
+
denom = mask_hi.float().sum().clamp_min(1.0)
|
| 294 |
+
prior_prob = out.get("prior_prob", torch.softmax(out["prior_logits"], dim=1))
|
| 295 |
+
fg_prior = prior_prob[:, :self.cfg.n_slots].sum(dim=1)
|
| 296 |
+
bg_prior = prior_prob[:, self.cfg.bg_index]
|
| 297 |
+
return {"prior_fg_hi": (fg_prior * mask_hi).sum() / denom,
|
| 298 |
+
"prior_bg_hi": (bg_prior * mask_hi).sum() / denom}
|
| 299 |
+
|
| 300 |
+
@torch.no_grad()
|
| 301 |
+
def dominance_metrics(self, out, E01, high_quantile=0.80):
|
| 302 |
+
final = out["prob"].argmax(dim=1)
|
| 303 |
+
prior = out["prior_logits"].argmax(dim=1)
|
| 304 |
+
resid = out["residual_logits"].argmax(dim=1)
|
| 305 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 306 |
+
flat = E.flatten(1)
|
| 307 |
+
thr = torch.quantile(flat, high_quantile, dim=1).view(-1, 1, 1)
|
| 308 |
+
mask = E >= thr
|
| 309 |
+
denom = mask.float().sum().clamp_min(1.0)
|
| 310 |
+
return {"prior_agree": ((final == prior) & mask).float().sum() / denom,
|
| 311 |
+
"residual_agree": ((final == resid) & mask).float().sum() / denom}
|
| 312 |
+
|
| 313 |
+
def graph_regularizers(self, out, prop_masks, prop_valid, E01):
|
| 314 |
+
# Slot compactness and smoothness proxies for final masks.
|
| 315 |
+
c = self.cfg
|
| 316 |
+
prob = out["prob"][:, :c.n_slots]
|
| 317 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 318 |
+
nf, nd = c.n_freqs, c.n_dirs
|
| 319 |
+
f = torch.linspace(0, 1, nf, device=E.device, dtype=E.dtype).view(1, 1, nf, 1)
|
| 320 |
+
theta = torch.linspace(0, 2 * math.pi, nd + 1, device=E.device, dtype=E.dtype)[:nd].view(1, 1, 1, nd)
|
| 321 |
+
w = prob * E[:, None]
|
| 322 |
+
mass = w.sum(dim=(2, 3)).clamp_min(1e-8)
|
| 323 |
+
mu_f = (w * f).sum(dim=(2, 3)) / mass
|
| 324 |
+
cx = (w * torch.cos(theta)).sum(dim=(2, 3)) / mass
|
| 325 |
+
cy = (w * torch.sin(theta)).sum(dim=(2, 3)) / mass
|
| 326 |
+
mu_t = torch.atan2(cy, cx)
|
| 327 |
+
df2 = (f - mu_f[:, :, None, None]) ** 2
|
| 328 |
+
dt = torch.atan2(torch.sin(theta - mu_t[:, :, None, None]), torch.cos(theta - mu_t[:, :, None, None])) / math.pi
|
| 329 |
+
radius = ((w * (df2 + dt ** 2)).sum(dim=(2, 3)) / mass).mean()
|
| 330 |
+
tv = (prob[:, :, 1:, :] - prob[:, :, :-1, :]).abs().mean() + (prob[:, :, :, 1:] - prob[:, :, :, :-1]).abs().mean()
|
| 331 |
+
# Encourage node slot assignments to be confident only for valid proposals.
|
| 332 |
+
ns = out["node_slot"].clamp_min(1e-8)
|
| 333 |
+
ent = -(ns * ns.log()).sum(dim=-1)
|
| 334 |
+
ent = (ent * prop_valid).sum() / prop_valid.sum().clamp_min(1.0)
|
| 335 |
+
return {"slot_radius": radius, "slot_tv": tv, "node_slot_entropy": ent}
|
| 336 |
+
|
| 337 |
+
def num_params(self):
|
| 338 |
+
return sum(p.numel() for p in self.parameters())
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
# Backward-compatible alias
|
| 342 |
+
WaveSystemGraphParserV4 = WaveSystemGraphParserV47
|
| 343 |
+
|
| 344 |
+
# v4.8 stable aliases: keep the proven v47b architecture/checkpoint compatibility.
|
| 345 |
+
# The v4.8 fixes are implemented in the training objective and deterministic
|
| 346 |
+
# energy/noise-aware post-processing, not by changing tensor shapes.
|
| 347 |
+
GraphParserV48Config = GraphParserV47Config
|
| 348 |
+
WaveSystemGraphParserV48 = WaveSystemGraphParserV47
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/refs/main
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
a91a365a49141913cfeeeb18d1be8074730e06c9
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/snapshots/a91a365a49141913cfeeeb18d1be8074730e06c9/CNN.py
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
WaveSystemGraphParser v4.7b protected real+synthetic core-locked: core-attached support topology graph parser for ICWDS
|
| 3 |
+
===================================================================
|
| 4 |
+
Purpose
|
| 5 |
+
-------
|
| 6 |
+
This model is the next-stage frontend after WaveSystemParser v3.x.
|
| 7 |
+
It does not ask a CNN to draw wave-system masks from scratch. Instead:
|
| 8 |
+
|
| 9 |
+
E(f,theta)
|
| 10 |
+
-> physical peak/basin proposals generated outside the model
|
| 11 |
+
-> node/edge graph reasoning over proposals
|
| 12 |
+
-> learned merge / keep / slot assembly
|
| 13 |
+
-> light CNN boundary refinement
|
| 14 |
+
|
| 15 |
+
This treats watershed-like basins as over-segmentation proposals, not labels.
|
| 16 |
+
The learnable part decides which candidates are physical wave systems, which
|
| 17 |
+
should be merged, and which should be sent to the downstream self-pruning VAE.
|
| 18 |
+
|
| 19 |
+
v4.5 is designed for a double-layer physical teacher: peak-core proposals define
|
| 20 |
+
system identity/count, while valley-constrained support proposals recover the full
|
| 21 |
+
energetic wave-system footprint. Stripe-like bands can be attached as tails but
|
| 22 |
+
are not allowed to become independent systems without a peak core.
|
| 23 |
+
|
| 24 |
+
All operations are lightweight and Colab-friendly. No Transformer blocks.
|
| 25 |
+
"""
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass, asdict
|
| 28 |
+
from typing import Optional, Dict
|
| 29 |
+
|
| 30 |
+
import torch
|
| 31 |
+
import torch.nn as nn
|
| 32 |
+
import torch.nn.functional as F
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@dataclass
|
| 36 |
+
class GraphParserV47Config:
|
| 37 |
+
n_freqs: int = 47
|
| 38 |
+
n_dirs: int = 72
|
| 39 |
+
n_slots: int = 6
|
| 40 |
+
bg_index: int = 6
|
| 41 |
+
p_max: int = 18
|
| 42 |
+
prop_feat_dim: int = 22
|
| 43 |
+
width: int = 32
|
| 44 |
+
depth: int = 4
|
| 45 |
+
node_dim: int = 48
|
| 46 |
+
edge_dim: int = 64
|
| 47 |
+
pair_feat_dim: int = 8
|
| 48 |
+
use_coord: bool = True
|
| 49 |
+
use_physics: bool = True
|
| 50 |
+
rank_temp: float = 0.12
|
| 51 |
+
count_min: float = 1.0
|
| 52 |
+
count_max: float = 6.0
|
| 53 |
+
bg_prior_bias: float = 0.38
|
| 54 |
+
bg_energy_suppress: float = 14.5
|
| 55 |
+
bg_energy_gamma: float = 0.70
|
| 56 |
+
proposal_logit_gain: float = 5.25
|
| 57 |
+
|
| 58 |
+
def to_dict(self):
|
| 59 |
+
return asdict(self)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class DepthwiseSeparable(nn.Module):
|
| 63 |
+
def __init__(self, ci: int, co: int):
|
| 64 |
+
super().__init__()
|
| 65 |
+
self.dw = nn.Conv2d(ci, ci, 3, padding=1, groups=ci, bias=False)
|
| 66 |
+
self.pw = nn.Conv2d(ci, co, 1, bias=False)
|
| 67 |
+
self.norm = nn.GroupNorm(min(8, co), co)
|
| 68 |
+
self.act = nn.GELU()
|
| 69 |
+
|
| 70 |
+
def forward(self, x):
|
| 71 |
+
return self.act(self.norm(self.pw(self.dw(x))))
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class PhysicsAwareModule(nn.Module):
|
| 75 |
+
def __init__(self, ch: int, n_dirs: int):
|
| 76 |
+
super().__init__()
|
| 77 |
+
self.n_dirs = n_dirs
|
| 78 |
+
dirs = torch.linspace(0, 2 * math.pi, n_dirs + 1)[:n_dirs]
|
| 79 |
+
self.register_buffer("cos_d", torch.cos(dirs).view(1, 1, 1, n_dirs))
|
| 80 |
+
self.register_buffer("sin_d", torch.sin(dirs).view(1, 1, 1, n_dirs))
|
| 81 |
+
self.fuse = nn.Conv2d(ch + 3, ch, 1, bias=False)
|
| 82 |
+
self.norm = nn.GroupNorm(min(8, ch), ch)
|
| 83 |
+
self.act = nn.GELU()
|
| 84 |
+
|
| 85 |
+
def _phys_features(self, E):
|
| 86 |
+
eps = 1e-8
|
| 87 |
+
En = torch.nan_to_num(E, nan=0.0, posinf=1.0, neginf=0.0).clamp_min(0)
|
| 88 |
+
En = En / (En.amax(dim=(2, 3), keepdim=True) + eps)
|
| 89 |
+
nf = En.shape[2]
|
| 90 |
+
rev_cumsum = torch.flip(torch.cumsum(torch.flip(En, dims=[2]), dim=2), dims=[2])
|
| 91 |
+
col_sum = En.sum(dim=2, keepdim=True) + eps
|
| 92 |
+
hf_tail = rev_cumsum / col_sum
|
| 93 |
+
cx = (En * self.cos_d).sum(dim=3, keepdim=True)
|
| 94 |
+
cy = (En * self.sin_d).sum(dim=3, keepdim=True)
|
| 95 |
+
row_sum = En.sum(dim=3, keepdim=True) + eps
|
| 96 |
+
dir_conc = torch.sqrt(cx ** 2 + cy ** 2) / row_sum
|
| 97 |
+
dir_conc = dir_conc.expand(-1, -1, -1, self.n_dirs)
|
| 98 |
+
fcoord = torch.linspace(0, 1, nf, device=E.device, dtype=E.dtype).view(1, 1, nf, 1)
|
| 99 |
+
fc = (En * fcoord).sum(dim=2, keepdim=True) / col_sum
|
| 100 |
+
spread = torch.sqrt(((En * (fcoord - fc) ** 2).sum(dim=2, keepdim=True)) / col_sum)
|
| 101 |
+
spread = spread.expand(-1, -1, nf, -1)
|
| 102 |
+
return torch.cat([hf_tail, dir_conc, spread], dim=1)
|
| 103 |
+
|
| 104 |
+
def forward(self, h, E):
|
| 105 |
+
return self.act(self.norm(self.fuse(torch.cat([h, self._phys_features(E)], dim=1))))
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class WaveSystemGraphParserV47(nn.Module):
|
| 109 |
+
"""Proposal graph parser.
|
| 110 |
+
|
| 111 |
+
forward inputs
|
| 112 |
+
--------------
|
| 113 |
+
x: [B,1,47,72], normalized to [-1,1]
|
| 114 |
+
prop_masks: [B,P,47,72], binary/soft physical basin proposals
|
| 115 |
+
prop_feats: [B,P,F], proposal features produced by the training script
|
| 116 |
+
prop_valid: [B,P], 1 if proposal exists
|
| 117 |
+
|
| 118 |
+
outputs include final probability masks, node slot assignments, edge logits,
|
| 119 |
+
count prediction, and diagnostics.
|
| 120 |
+
"""
|
| 121 |
+
def __init__(self, cfg: Optional[GraphParserV47Config] = None):
|
| 122 |
+
super().__init__()
|
| 123 |
+
self.cfg = cfg or GraphParserV47Config()
|
| 124 |
+
c = self.cfg
|
| 125 |
+
in_ch = 1 + (3 if c.use_coord else 0)
|
| 126 |
+
self.stem = nn.Conv2d(in_ch, c.width, 3, padding=1)
|
| 127 |
+
self.stem_norm = nn.GroupNorm(min(8, c.width), c.width)
|
| 128 |
+
self.physics = PhysicsAwareModule(c.width, c.n_dirs) if c.use_physics else None
|
| 129 |
+
self.blocks = nn.ModuleList([DepthwiseSeparable(c.width, c.width) for _ in range(c.depth)])
|
| 130 |
+
self.global_pool = nn.AdaptiveAvgPool2d(1)
|
| 131 |
+
self.residual_head = nn.Conv2d(c.width, c.n_slots + 1, 1)
|
| 132 |
+
nn.init.zeros_(self.residual_head.weight)
|
| 133 |
+
nn.init.zeros_(self.residual_head.bias)
|
| 134 |
+
|
| 135 |
+
self.node_mlp = nn.Sequential(
|
| 136 |
+
nn.Linear(c.width + c.prop_feat_dim, c.node_dim), nn.GELU(),
|
| 137 |
+
nn.Linear(c.node_dim, c.node_dim), nn.GELU(),
|
| 138 |
+
)
|
| 139 |
+
self.node_keep = nn.Linear(c.node_dim, 1)
|
| 140 |
+
self.node_slot = nn.Linear(c.node_dim, c.n_slots)
|
| 141 |
+
self.count_head = nn.Sequential(
|
| 142 |
+
nn.Linear(c.width + c.node_dim, c.width), nn.GELU(), nn.Linear(c.width, c.n_slots)
|
| 143 |
+
)
|
| 144 |
+
# Edge head uses node_i, node_j, absolute difference, product, plus handcrafted physical pair features.
|
| 145 |
+
self.edge_head = nn.Sequential(
|
| 146 |
+
nn.Linear(4 * c.node_dim + c.pair_feat_dim, c.edge_dim), nn.GELU(),
|
| 147 |
+
nn.Linear(c.edge_dim, c.edge_dim), nn.GELU(), nn.Linear(c.edge_dim, 1)
|
| 148 |
+
)
|
| 149 |
+
self._coord_cache = None
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
@staticmethod
|
| 153 |
+
def _clean_tensor(x, fill=0.0, lo=-30.0, hi=30.0):
|
| 154 |
+
return torch.nan_to_num(x, nan=fill, posinf=hi, neginf=lo).clamp(lo, hi)
|
| 155 |
+
|
| 156 |
+
@staticmethod
|
| 157 |
+
def _safe_softmax(logits, dim):
|
| 158 |
+
logits = torch.nan_to_num(logits, nan=0.0, posinf=30.0, neginf=-30.0).clamp(-30.0, 30.0)
|
| 159 |
+
logits = logits - logits.max(dim=dim, keepdim=True).values.detach()
|
| 160 |
+
p = torch.softmax(logits, dim=dim)
|
| 161 |
+
return torch.nan_to_num(p, nan=0.0, posinf=1.0, neginf=0.0)
|
| 162 |
+
|
| 163 |
+
def _coord_channels(self, B, device, dtype):
|
| 164 |
+
c = self.cfg
|
| 165 |
+
if self._coord_cache is None:
|
| 166 |
+
nf, nd = c.n_freqs, c.n_dirs
|
| 167 |
+
fcoord = torch.linspace(0, 1, nf).view(1, 1, nf, 1).expand(1, 1, nf, nd)
|
| 168 |
+
ang = torch.linspace(0, 2 * math.pi, nd + 1)[:nd].view(1, 1, 1, nd).expand(1, 1, nf, nd)
|
| 169 |
+
self._coord_cache = torch.cat([fcoord, torch.sin(ang), torch.cos(ang)], dim=1)
|
| 170 |
+
return self._coord_cache.to(device=device, dtype=dtype).expand(B, -1, -1, -1)
|
| 171 |
+
|
| 172 |
+
def _rank_prune_presence(self, slot_mass, count_soft):
|
| 173 |
+
c = self.cfg
|
| 174 |
+
B, K = slot_mass.shape
|
| 175 |
+
_, order = torch.sort(slot_mass, dim=1, descending=True)
|
| 176 |
+
rank_pos = torch.arange(1, K + 1, device=slot_mass.device, dtype=slot_mass.dtype).view(1, K)
|
| 177 |
+
cs = count_soft.clamp(c.count_min, c.count_max).view(B, 1)
|
| 178 |
+
gate_sorted = torch.sigmoid((cs + 0.5 - rank_pos) / c.rank_temp)
|
| 179 |
+
gate = torch.zeros_like(gate_sorted).scatter(1, order, gate_sorted)
|
| 180 |
+
return gate.clamp(0, 1)
|
| 181 |
+
|
| 182 |
+
def _node_pool(self, h, prop_masks, prop_valid):
|
| 183 |
+
# h: [B,C,H,W], prop_masks [B,P,H,W]
|
| 184 |
+
B, C, H, W = h.shape
|
| 185 |
+
P = prop_masks.shape[1]
|
| 186 |
+
denom = prop_masks.flatten(2).sum(dim=2).clamp_min(1.0) # [B,P]
|
| 187 |
+
pooled = torch.einsum("bchw,bphw->bpc", h, prop_masks) / denom[:, :, None]
|
| 188 |
+
pooled = pooled * prop_valid[:, :, None]
|
| 189 |
+
return pooled
|
| 190 |
+
|
| 191 |
+
def _edge_logits(self, node, prop_feats, prop_valid):
|
| 192 |
+
B, P, D = node.shape
|
| 193 |
+
ni = node[:, :, None, :].expand(B, P, P, D)
|
| 194 |
+
nj = node[:, None, :, :].expand(B, P, P, D)
|
| 195 |
+
# Pair physical features from proposal features: distance in f/theta and mass contrast.
|
| 196 |
+
# feat layout is defined in training script: mass, peak, area, mu_f, sin_t, cos_t, ...
|
| 197 |
+
fi = prop_feats[:, :, 3][:, :, None]
|
| 198 |
+
fj = prop_feats[:, :, 3][:, None, :]
|
| 199 |
+
d_f = (fi - fj).abs()
|
| 200 |
+
si = prop_feats[:, :, 4][:, :, None]; ci = prop_feats[:, :, 5][:, :, None]
|
| 201 |
+
sj = prop_feats[:, :, 4][:, None, :]; cj = prop_feats[:, :, 5][:, None, :]
|
| 202 |
+
dot = (si * sj + ci * cj).clamp(-1.0 + 1e-5, 1.0 - 1e-5)
|
| 203 |
+
d_t = torch.acos(dot) / math.pi
|
| 204 |
+
mi = prop_feats[:, :, 0][:, :, None]
|
| 205 |
+
mj = prop_feats[:, :, 0][:, None, :]
|
| 206 |
+
d_m = (mi - mj).abs()
|
| 207 |
+
sf_i = prop_feats[:, :, 6][:, :, None]; sf_j = prop_feats[:, :, 6][:, None, :]
|
| 208 |
+
st_i = prop_feats[:, :, 7][:, :, None]; st_j = prop_feats[:, :, 7][:, None, :]
|
| 209 |
+
d_sf = (sf_i - sf_j).abs()
|
| 210 |
+
d_st = (st_i - st_j).abs()
|
| 211 |
+
prom_i = prop_feats[:, :, 12][:, :, None]; prom_j = prop_feats[:, :, 12][:, None, :]
|
| 212 |
+
prom_min = torch.minimum(prom_i, prom_j)
|
| 213 |
+
stripe_i = prop_feats[:, :, 13][:, :, None]; stripe_j = prop_feats[:, :, 13][:, None, :]
|
| 214 |
+
stripe_max = torch.maximum(stripe_i, stripe_j)
|
| 215 |
+
qual_i = prop_feats[:, :, 11][:, :, None]; qual_j = prop_feats[:, :, 11][:, None, :]
|
| 216 |
+
qual_min = torch.minimum(qual_i, qual_j)
|
| 217 |
+
pair_phys = torch.stack([d_f, d_t, d_m, d_sf, d_st, prom_min, stripe_max, qual_min], dim=-1)
|
| 218 |
+
inp = torch.cat([ni, nj, (ni - nj).abs(), ni * nj, pair_phys], dim=-1)
|
| 219 |
+
e = self.edge_head(inp).squeeze(-1)
|
| 220 |
+
valid_pair = (prop_valid[:, :, None] * prop_valid[:, None, :]).bool()
|
| 221 |
+
eye = torch.eye(P, device=node.device, dtype=torch.bool).view(1, P, P)
|
| 222 |
+
e = e.masked_fill(~valid_pair | eye, 0.0)
|
| 223 |
+
return e, valid_pair & (~eye)
|
| 224 |
+
|
| 225 |
+
def forward(self, x, prop_masks, prop_feats, prop_valid, prior_w=2.5, residual_w=0.0):
|
| 226 |
+
c = self.cfg
|
| 227 |
+
B, _, H, W = x.shape
|
| 228 |
+
prop_masks = torch.nan_to_num(prop_masks.float(), nan=0.0, posinf=0.0, neginf=0.0).clamp(0, 1)
|
| 229 |
+
prop_feats = torch.nan_to_num(prop_feats.float(), nan=0.0, posinf=5.0, neginf=-5.0).clamp(-5.0, 5.0)
|
| 230 |
+
prop_valid = prop_valid.float().clamp(0, 1)
|
| 231 |
+
h_in = torch.cat([x, self._coord_channels(B, x.device, x.dtype)], dim=1) if c.use_coord else x
|
| 232 |
+
h = self._clean_tensor(F.gelu(self.stem_norm(self.stem(h_in))), lo=-20.0, hi=20.0)
|
| 233 |
+
E01 = torch.nan_to_num((x + 1.0) * 0.5, nan=0.0, posinf=1.0, neginf=0.0).clamp(0, 1)
|
| 234 |
+
if self.physics is not None:
|
| 235 |
+
h = self._clean_tensor(h + self.physics(h, E01), lo=-20.0, hi=20.0)
|
| 236 |
+
for blk in self.blocks:
|
| 237 |
+
h = self._clean_tensor(h + blk(h), lo=-20.0, hi=20.0)
|
| 238 |
+
global_feat = self.global_pool(h).flatten(1)
|
| 239 |
+
node_pool = self._node_pool(h, prop_masks, prop_valid)
|
| 240 |
+
node_in = torch.cat([node_pool, prop_feats], dim=-1)
|
| 241 |
+
node = self._clean_tensor(self.node_mlp(node_in), lo=-20.0, hi=20.0) * prop_valid[:, :, None]
|
| 242 |
+
node_keep_logit = self._clean_tensor(self.node_keep(node).squeeze(-1), lo=-20.0, hi=20.0).masked_fill(prop_valid <= 0, -20.0)
|
| 243 |
+
node_keep = torch.sigmoid(node_keep_logit) * prop_valid
|
| 244 |
+
node_slot_logits = self._clean_tensor(self.node_slot(node), lo=-20.0, hi=20.0).masked_fill(prop_valid[:, :, None] <= 0, -20.0)
|
| 245 |
+
node_slot = self._safe_softmax(node_slot_logits, dim=-1) * prop_valid[:, :, None]
|
| 246 |
+
node_context = (node * node_keep[:, :, None]).sum(dim=1) / node_keep.sum(dim=1, keepdim=True).clamp_min(1.0)
|
| 247 |
+
count_logits = self._clean_tensor(self.count_head(torch.cat([global_feat, node_context], dim=-1)), lo=-20.0, hi=20.0)
|
| 248 |
+
count_probs = torch.sigmoid(count_logits)
|
| 249 |
+
count_soft = count_probs.sum(dim=1).clamp(c.count_min, c.count_max)
|
| 250 |
+
|
| 251 |
+
# Proposal graph edge logits.
|
| 252 |
+
edge_logits, edge_valid = self._edge_logits(node, prop_feats, prop_valid)
|
| 253 |
+
edge_logits = self._clean_tensor(edge_logits, lo=-20.0, hi=20.0)
|
| 254 |
+
# Slot priors from proposal assembly.
|
| 255 |
+
assign = node_slot * node_keep[:, :, None]
|
| 256 |
+
prior_signal = torch.einsum("bpk,bphw->bkhw", assign, prop_masks)
|
| 257 |
+
# Normalize each slot prior but preserve zero slots.
|
| 258 |
+
prior_signal = prior_signal / prior_signal.amax(dim=(2, 3), keepdim=True).clamp_min(1e-6)
|
| 259 |
+
prior_signal = torch.nan_to_num(prior_signal, nan=0.0, posinf=1.0, neginf=0.0).clamp(0.0, 1.0)
|
| 260 |
+
denom = E01.sum(dim=(2, 3)).clamp_min(1e-6)
|
| 261 |
+
slot_mass = (prior_signal * E01).sum(dim=(2, 3)) / denom
|
| 262 |
+
presence = self._rank_prune_presence(slot_mass, count_soft)
|
| 263 |
+
prior_signal = prior_signal * presence[:, :, None, None]
|
| 264 |
+
|
| 265 |
+
En = E01 / E01.amax(dim=(2, 3), keepdim=True).clamp_min(1e-6)
|
| 266 |
+
bg_prior_logit = c.bg_prior_bias - c.bg_energy_suppress * En.pow(c.bg_energy_gamma)
|
| 267 |
+
residual_logits = self.residual_head(h)
|
| 268 |
+
signal_logits = prior_w * (c.proposal_logit_gain * torch.log(prior_signal.clamp_min(1e-6))) + residual_w * residual_logits[:, :c.n_slots]
|
| 269 |
+
bg_logits = prior_w * bg_prior_logit + residual_w * residual_logits[:, c.n_slots:c.n_slots + 1]
|
| 270 |
+
logits = self._clean_tensor(torch.cat([signal_logits, bg_logits], dim=1), lo=-60.0, hi=60.0)
|
| 271 |
+
prob_raw = self._safe_softmax(logits, dim=1)
|
| 272 |
+
prob = prob_raw / prob_raw.sum(dim=1, keepdim=True).clamp_min(1e-6)
|
| 273 |
+
|
| 274 |
+
prior_logits = self._clean_tensor(torch.cat([c.proposal_logit_gain * torch.log(prior_signal.clamp_min(1e-6)), bg_prior_logit], dim=1), lo=-60.0, hi=60.0)
|
| 275 |
+
prior_prob = self._safe_softmax(prior_logits, dim=1)
|
| 276 |
+
return {
|
| 277 |
+
"logits": logits, "prob": prob, "prob_raw": prob_raw,
|
| 278 |
+
"prior_signal": prior_signal, "prior_logits": prior_logits, "prior_prob": prior_prob,
|
| 279 |
+
"residual_logits": residual_logits,
|
| 280 |
+
"node": node, "node_keep_logit": node_keep_logit, "node_keep": node_keep,
|
| 281 |
+
"node_slot_logits": node_slot_logits, "node_slot": node_slot,
|
| 282 |
+
"edge_logits": edge_logits, "edge_valid": edge_valid,
|
| 283 |
+
"count_logits": count_logits, "count_probs": count_probs, "count_soft": count_soft,
|
| 284 |
+
"slot_mass": slot_mass, "presence": presence,
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
@torch.no_grad()
|
| 288 |
+
def prior_foreground_metrics(self, out, E01, high_quantile=0.80):
|
| 289 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 290 |
+
flat = E.flatten(1)
|
| 291 |
+
thr = torch.quantile(flat, high_quantile, dim=1).view(-1, 1, 1)
|
| 292 |
+
mask_hi = E >= thr
|
| 293 |
+
denom = mask_hi.float().sum().clamp_min(1.0)
|
| 294 |
+
prior_prob = out.get("prior_prob", torch.softmax(out["prior_logits"], dim=1))
|
| 295 |
+
fg_prior = prior_prob[:, :self.cfg.n_slots].sum(dim=1)
|
| 296 |
+
bg_prior = prior_prob[:, self.cfg.bg_index]
|
| 297 |
+
return {"prior_fg_hi": (fg_prior * mask_hi).sum() / denom,
|
| 298 |
+
"prior_bg_hi": (bg_prior * mask_hi).sum() / denom}
|
| 299 |
+
|
| 300 |
+
@torch.no_grad()
|
| 301 |
+
def dominance_metrics(self, out, E01, high_quantile=0.80):
|
| 302 |
+
final = out["prob"].argmax(dim=1)
|
| 303 |
+
prior = out["prior_logits"].argmax(dim=1)
|
| 304 |
+
resid = out["residual_logits"].argmax(dim=1)
|
| 305 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 306 |
+
flat = E.flatten(1)
|
| 307 |
+
thr = torch.quantile(flat, high_quantile, dim=1).view(-1, 1, 1)
|
| 308 |
+
mask = E >= thr
|
| 309 |
+
denom = mask.float().sum().clamp_min(1.0)
|
| 310 |
+
return {"prior_agree": ((final == prior) & mask).float().sum() / denom,
|
| 311 |
+
"residual_agree": ((final == resid) & mask).float().sum() / denom}
|
| 312 |
+
|
| 313 |
+
def graph_regularizers(self, out, prop_masks, prop_valid, E01):
|
| 314 |
+
# Slot compactness and smoothness proxies for final masks.
|
| 315 |
+
c = self.cfg
|
| 316 |
+
prob = out["prob"][:, :c.n_slots]
|
| 317 |
+
E = E01[:, 0] if E01.dim() == 4 else E01
|
| 318 |
+
nf, nd = c.n_freqs, c.n_dirs
|
| 319 |
+
f = torch.linspace(0, 1, nf, device=E.device, dtype=E.dtype).view(1, 1, nf, 1)
|
| 320 |
+
theta = torch.linspace(0, 2 * math.pi, nd + 1, device=E.device, dtype=E.dtype)[:nd].view(1, 1, 1, nd)
|
| 321 |
+
w = prob * E[:, None]
|
| 322 |
+
mass = w.sum(dim=(2, 3)).clamp_min(1e-8)
|
| 323 |
+
mu_f = (w * f).sum(dim=(2, 3)) / mass
|
| 324 |
+
cx = (w * torch.cos(theta)).sum(dim=(2, 3)) / mass
|
| 325 |
+
cy = (w * torch.sin(theta)).sum(dim=(2, 3)) / mass
|
| 326 |
+
mu_t = torch.atan2(cy, cx)
|
| 327 |
+
df2 = (f - mu_f[:, :, None, None]) ** 2
|
| 328 |
+
dt = torch.atan2(torch.sin(theta - mu_t[:, :, None, None]), torch.cos(theta - mu_t[:, :, None, None])) / math.pi
|
| 329 |
+
radius = ((w * (df2 + dt ** 2)).sum(dim=(2, 3)) / mass).mean()
|
| 330 |
+
tv = (prob[:, :, 1:, :] - prob[:, :, :-1, :]).abs().mean() + (prob[:, :, :, 1:] - prob[:, :, :, :-1]).abs().mean()
|
| 331 |
+
# Encourage node slot assignments to be confident only for valid proposals.
|
| 332 |
+
ns = out["node_slot"].clamp_min(1e-8)
|
| 333 |
+
ent = -(ns * ns.log()).sum(dim=-1)
|
| 334 |
+
ent = (ent * prop_valid).sum() / prop_valid.sum().clamp_min(1.0)
|
| 335 |
+
return {"slot_radius": radius, "slot_tv": tv, "node_slot_entropy": ent}
|
| 336 |
+
|
| 337 |
+
def num_params(self):
|
| 338 |
+
return sum(p.numel() for p in self.parameters())
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
# Backward-compatible alias
|
| 342 |
+
WaveSystemGraphParserV4 = WaveSystemGraphParserV47
|
| 343 |
+
|
| 344 |
+
# v4.8 stable aliases: keep the proven v47b architecture/checkpoint compatibility.
|
| 345 |
+
# The v4.8 fixes are implemented in the training objective and deterministic
|
| 346 |
+
# energy/noise-aware post-processing, not by changing tensor shapes.
|
| 347 |
+
GraphParserV48Config = GraphParserV47Config
|
| 348 |
+
WaveSystemGraphParserV48 = WaveSystemGraphParserV47
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/assets/hf_cache/models--wuff-mann--Wave_compress_system/snapshots/a91a365a49141913cfeeeb18d1be8074730e06c9/__pycache__/CNN.cpython-312.pyc
ADDED
|
Binary file (31.8 kB). View file
|
|
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c12_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8591a3879819dac70d660f53b05c135974fdb542a59251e62bce92094552ec97
|
| 3 |
+
size 39890231
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/cache_meta_exp2b.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "wshc_exp2b_core_halo_v1",
|
| 3 |
+
"n": 30000,
|
| 4 |
+
"shape": [
|
| 5 |
+
47,
|
| 6 |
+
72
|
| 7 |
+
],
|
| 8 |
+
"n_slots": 6,
|
| 9 |
+
"field_name": "energy_mem",
|
| 10 |
+
"repo_id": "wuff-mann/ATLAS-WDS-v4",
|
| 11 |
+
"split": "train"
|
| 12 |
+
}
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/front.u8
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f60df2def1febdd0615779f2916dea2f3a0ef1289bc3b52f8474e453c21f5d4
|
| 3 |
+
size 101520000
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/cache/parts.u8
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb6990f74e5b2aa1b0acc30ba9742f55ecba5dbcd950b63942acf7ba6b32fb47
|
| 3 |
+
size 609120000
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_capacity_summary.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
variant,latent_dim,shape_gain_vs_base,mse_gain_vs_base,shuffle_shape_gap,shuffle_mse_gap,zero_shape_gap_vs_base,zero_mse_gap_vs_base
|
| 2 |
+
c4,4,0.2537815677837153,0.22087005516541391,0.27262253749678855,0.47455963659128275,0.0,-2.604918269977219e-08
|
| 3 |
+
c8,8,0.14433410851609063,-0.0049219193897158675,0.006015519547725834,-0.00016044933192560507,0.0,-2.604918269977219e-08
|
| 4 |
+
c12,12,0.29158126897241854,0.2674344565019864,0.2304482413348694,0.7248006418954676,0.0,-2.604918269977219e-08
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_casewise_summary.csv
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,stratum,mse,weighted_l1,log_l1,shape,energy,peak,freq,direction
|
| 2 |
+
semantic_only,regular,0.0025985943881558283,0.049606920471267094,0.026079945887128513,0.22269727360634578,0.02182799932502565,0.00676602456628138,0.006005940389715963,0.002636576725524806
|
| 3 |
+
semantic_only,multi_peak,0.0052225425846815585,0.07157631922099325,0.03562389175215411,0.41304284381488016,0.030963076101172538,0.03756319140158002,0.010309769468943752,0.006200826719462398
|
| 4 |
+
semantic_only,broad,0.005967187388460078,0.0732877662494069,0.04054862813698867,0.5285314406667437,0.04144094473431035,0.050494555413486464,0.014814348019186466,0.008019177287462213
|
| 5 |
+
semantic_only,low_energy,0.007458592617204265,0.08546718517466197,0.052213846986729,0.5709580727039821,0.044259964473663815,0.05502338334918022,0.01608007274095028,0.008485170184738107
|
| 6 |
+
semantic_only,noisy_difficult,0.004599826683896402,0.06178122551904784,0.03243726577668909,0.48062052187465487,0.038659057520803,0.052955839088157056,0.011591229484313063,0.007511320087822184
|
| 7 |
+
c4_true,regular,0.001750548277327436,0.04007956719705983,0.023038747483893993,0.17779369167392217,0.016502398391446425,0.0026166237759522146,0.004245755377240361,0.0021689352015816857
|
| 8 |
+
c4_true,multi_peak,0.004081219124297301,0.06198727848037841,0.03169976461619612,0.35173807778055705,0.03046174031046648,0.03110295378913482,0.007916059345006943,0.005695161904903158
|
| 9 |
+
c4_true,broad,0.004727477928446163,0.06392098407423685,0.03588335650662581,0.4529443936688559,0.035936880324568064,0.04058106789099319,0.011470764801497496,0.0074207594854727625
|
| 10 |
+
c4_true,low_energy,0.006122347045068939,0.07614568467178041,0.0470732469111681,0.5024659652558584,0.03675104362801427,0.04575067540512435,0.013130194211881312,0.008015709821992213
|
| 11 |
+
c4_true,noisy_difficult,0.003783163998926443,0.05475908275397997,0.029419519421127107,0.4205187119188763,0.03527400230190584,0.044168417151677346,0.009245761921481481,0.007020233147260215
|
| 12 |
+
c8_true,regular,0.0026256225897841865,0.04970992930115215,0.026170017286425547,0.2224973395230278,0.013927855854114842,0.006588597680323772,0.006015481427311897,0.0026532862047176984
|
| 13 |
+
c8_true,multi_peak,0.0052493104326819615,0.07181503369458138,0.03630018278601624,0.4143843272375682,0.021518668056362204,0.03765641602258834,0.010344928825303676,0.006229172726827008
|
| 14 |
+
c8_true,broad,0.006000325316563249,0.07347727933573345,0.04248820147698834,0.530890692321081,0.027416478295529647,0.05074360558674449,0.014841591998461693,0.008007965087594967
|
| 15 |
+
c8_true,low_energy,0.007509229823000847,0.0855845505046466,0.054763086258418976,0.5727473350744399,0.02971231725273861,0.055676237325228396,0.016101611364218924,0.008445201345556786
|
| 16 |
+
c8_true,noisy_difficult,0.004604692456297695,0.061930165049575624,0.03347800967712251,0.48357690847109236,0.027170604375738,0.05338449917718886,0.01166673292893739,0.0075303328718753565
|
| 17 |
+
c8_shuffle,regular,0.002609182470699861,0.049567257098498796,0.02647353516566375,0.22322304499527765,0.018273240073569237,0.0067471988505632095,0.0060226513767644525,0.0026523105463840896
|
| 18 |
+
c8_shuffle,multi_peak,0.005240352809547432,0.07156146542420463,0.03688254804601745,0.4147334330611759,0.026365205956002075,0.03830126913944407,0.010339886807496585,0.0062021478522746335
|
| 19 |
+
c8_shuffle,broad,0.006002817095981704,0.07324482423682062,0.04290783015035447,0.5312260166993217,0.031095231957142314,0.05071559226110814,0.014844341632274409,0.007992197160742112
|
| 20 |
+
c8_shuffle,low_energy,0.007522675275270428,0.08548698698480924,0.05535642400620475,0.5733929962392837,0.0344994580373168,0.05549505715154939,0.016105178447942885,0.008424719666234322
|
| 21 |
+
c8_shuffle,noisy_difficult,0.004631232174616012,0.06179454473275987,0.03418547278713612,0.48386859988409375,0.03384054836536211,0.05319602736863234,0.011662909827594246,0.0074958969572825095
|
| 22 |
+
c8_zero,regular,0.002598594369677206,0.04960692126954359,0.02607994553233896,0.2226972747889776,0.021828014566193498,0.006766025436624501,0.006005940441456106,0.002636576758786326
|
| 23 |
+
c8_zero,multi_peak,0.0052225425255499665,0.07157631916186166,0.035623891486061945,0.41304285091067117,0.030963075746382986,0.037563192939001414,0.010309769387637812,0.0062008267120709495
|
| 24 |
+
c8_zero,broad,0.005967187214761026,0.07328776577635417,0.040548627811764916,0.5285314435050601,0.041440949346574524,0.05049455434911781,0.014814348019186466,0.008019177265287865
|
| 25 |
+
c8_zero,low_energy,0.00745859239176507,0.08546718623903063,0.052213846277149895,0.5709580750692458,0.04425996707545386,0.0550233857587926,0.01608007290356216,0.008485170203216728
|
| 26 |
+
c8_zero,noisy_difficult,0.004599826591503289,0.061781225282521474,0.03243726556972852,0.4806205214016021,0.03865906059564579,0.0529558404223136,0.011591229425181471,0.007511320087822184
|
| 27 |
+
c12_true,regular,0.0016693961090548702,0.03897032951788297,0.02326327402676855,0.17260453578025575,0.016850282792888936,0.0026662470927620897,0.004072612327050477,0.0020385036302272173
|
| 28 |
+
c12_true,multi_peak,0.0037808368307730507,0.059014412796213514,0.031622069252152295,0.33567738580325296,0.027095662666455148,0.027748873656881706,0.007171474611534486,0.005401270526890007
|
| 29 |
+
c12_true,broad,0.004444780574727153,0.060746845863168204,0.03544820419379643,0.43100656498046147,0.03307429429084536,0.03942695771536184,0.010783221661334946,0.006979659876032244
|
| 30 |
+
c12_true,low_energy,0.0058760876981689344,0.07322449266674026,0.046781046434290825,0.48282467018044184,0.03651206977369766,0.0415786522928448,0.012615322852359405,0.007672512526845648
|
| 31 |
+
c12_true,noisy_difficult,0.003576403389507461,0.05289943770520271,0.028759426629495998,0.4062339923684559,0.032320794072889146,0.04145704092465282,0.008826089387256947,0.006780359912515869
|
| 32 |
+
pca8_oracle,regular,0.0026271206794291854,0.053721138261376866,0.028357567354327158,0.220411198716315,0.1440648975826445,0.013604843700748114,0.005730482317241175,0.0025589097668195053
|
| 33 |
+
pca8_oracle,multi_peak,0.0048665368951679696,0.07459590181944863,0.03793201817288285,0.40366587184724356,0.27217426730526817,0.05107216276819744,0.009717776100077326,0.005812714360506525
|
| 34 |
+
pca8_oracle,broad,0.005575849840949688,0.07888679194544988,0.04493383622713505,0.5243943924941714,0.304258746050653,0.06101596852143606,0.014040810233425526,0.0077152724436942545
|
| 35 |
+
pca8_oracle,low_energy,0.00682521300641672,0.08948080992651364,0.05630626062315608,0.5667028521734571,0.29939609943401246,0.06465362169085041,0.015323036838145484,0.008175544544226594
|
| 36 |
+
pca8_oracle,noisy_difficult,0.00427876032208876,0.06349643491326816,0.03472367954987382,0.47377346574314055,0.2848894251953988,0.07034084258512371,0.01118021843481868,0.007253474275034572
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_code_audit_bars.png
ADDED
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_condition_full_prior_summary.csv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,mse,weighted_l1,log_l1,shape,energy,peak,freq,direction
|
| 2 |
+
semantic_only,0.005112613041308664,0.06838105820001118,0.036461800987285284,0.435904833532515,0.0347583753958581,0.03923887990060307,0.011485384496313238,0.006472567465925027
|
| 3 |
+
c4_true,0.004017224021640326,0.05921096585336186,0.03250912863702055,0.37283168520246235,0.03106844144326354,0.031943115479652846,0.00890542147681117,0.005954965328176816
|
| 4 |
+
c8_true,0.005140744164467804,0.06856837454769346,0.03759100294065854,0.437550839923677,0.02367679363796635,0.039439244905398005,0.011518598016765382,0.006481514046234744
|
| 5 |
+
c8_shuffle,0.005140389722313673,0.06836396331588428,0.03810743461289103,0.4379725990787385,0.028362938956845374,0.039615790581419355,0.011518013087056932,0.006460506712929124
|
| 6 |
+
c8_zero,0.005112612863913888,0.06838105831827436,0.036461800750758916,0.43590483637083144,0.0347583842655969,0.03923888126062968,0.01148538457022773,0.006472567451142129
|
| 7 |
+
c12_true,0.00378236624353107,0.05671793997051224,0.032291722557847465,0.35725890360181295,0.028688163452205203,0.02957762779283618,0.008337084684402698,0.0056587932483544425
|
| 8 |
+
pca8_oracle,0.004772858790284585,0.071953889041666,0.039408559777906964,0.4295983872716389,0.26294957739966257,0.05121978514251255,0.010886672514653395,0.006182369147796953
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_condition_part_summary.csv
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,mse,weighted_l1,log_l1,shape,energy,peak,freq,direction
|
| 2 |
+
semantic_only,0.0010285928387135741,0.021637129139096017,0.012319819099964604,0.5172249830904461,0.03935279398565254,0.010487283254781413,0.015947777408337784,0.009886239596184284
|
| 3 |
+
c4_true,0.0008014074816841573,0.018743782792062985,0.011000447743941866,0.38596281598484705,0.03225620108700934,0.009629304912532605,0.010181212442971412,0.007311572431631032
|
| 4 |
+
c4_shuffle,0.001181723124953726,0.02352181975803678,0.01295351500194224,0.4911849782580421,0.04587278716147892,0.012455754314682313,0.014908942852228407,0.009115476153850083
|
| 5 |
+
c4_zero,0.0010285928119195713,0.021637129020832833,0.012319819040833012,0.5172249830904461,0.03935279788833762,0.010487283410001842,0.01594777749703517,0.009886239566618488
|
| 6 |
+
c8_true,0.0010336554897505614,0.021696459117626386,0.012644721934246638,0.4425717762538365,0.026729060129986867,0.010529126018463146,0.012699523615458655,0.007733687706705596
|
| 7 |
+
c8_shuffle,0.0010334896404177896,0.02162585664717924,0.01276968778776271,0.44523407542516313,0.030091781080478712,0.01060087312131174,0.012824824242483056,0.007807029115538749
|
| 8 |
+
c8_zero,0.0010285928119195713,0.021637129020832833,0.012319819040833012,0.5172249830904461,0.03935279788833762,0.010487283410001842,0.01594777749703517,0.009886239566618488
|
| 9 |
+
c12_true,0.0007535116719303741,0.017950309263098808,0.010826981227312769,0.3664118661766961,0.03199222775560523,0.009098108680475326,0.009474709312180205,0.0068885886021668
|
| 10 |
+
c12_shuffle,0.001299657415421236,0.0246896855533123,0.01236792795714878,0.4508508363413432,0.038520143441264594,0.012356049166844478,0.013172189069409219,0.008304762491394602
|
| 11 |
+
c12_zero,0.0010285928119195713,0.021637129020832833,0.012319819040833012,0.5172249830904461,0.03935279788833762,0.010487283410001842,0.01594777749703517,0.009886239566618488
|
| 12 |
+
pca0_oracle,0.0010095475322847802,0.021758688998127742,0.012502002160227487,0.5228070313968356,0.0603684905975584,0.010685175908581606,0.016237796934705877,0.010010354413044832
|
| 13 |
+
pca4_oracle,0.001002042039689268,0.022854297052300167,0.01304769538165558,0.5228484187807355,0.12899460868229942,0.013601358950374618,0.01581583396782951,0.009862659277305716
|
| 14 |
+
pca8_oracle,0.0009734327738572444,0.022810132641877447,0.013129668132889839,0.5223747274232289,0.15421648784762337,0.01484525322707163,0.015610851229183258,0.009690681886341836
|
| 15 |
+
pca16_oracle,0.0008975967325063215,0.021937056666328794,0.013048762056444372,0.5171565072877067,0.17199333721683138,0.015217149844540962,0.015089252490609412,0.009471804746204899
|
| 16 |
+
pca32_oracle,0.0007755137113336888,0.020187827359352793,0.012435147864004922,0.5012068757935176,0.17844206307615554,0.015649960642414435,0.014180889131412619,0.009037073169435774
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/causal_training_history.csv
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
variant,latent_dim,epoch,time_sec,train_loss,train_base_loss,train_rate,train_img,train_log,train_shape,train_energy,train_peak,train_freq,train_direction,train_dice,train_total,train_causal,train_diversity,train_gap,val_loss,val_base_loss,val_rate,val_img,val_log,val_shape,val_energy,val_peak,val_freq,val_direction,val_dice,val_causal_gap,val_mean_latent_std,val_score
|
| 2 |
+
c12,12,1,375.356098651886,0.5481291579405466,0.5481291579405466,0.0,0.021798545430103938,0.011613898312052092,0.39119576644897464,0.03188299823304017,0.009141462785502276,0.011446465666095416,0.006927779437353214,0.9020272866884868,0.5489550413290659,0.0014291909973447522,0.016283354456193288,9.426883655029173e-05,0.593629346953498,0.593629346953498,0.0,0.021675404013385847,0.013003891880904872,0.4438971115483178,0.03074153305755721,0.010556126065138314,0.012720933657080408,0.007725672301141516,0.9127110696974254,0.0002822327825549384,0.07434626668691635,0.5939337766347742
|
| 3 |
+
c12,12,2,377.0659532546997,0.5362224791844686,0.5362224791844686,0.0,0.021775506806870303,0.011704953936239083,0.3817618544896444,0.02422823432087898,0.009242385266969601,0.01099314279233416,0.006606705355147521,0.9021022311846415,0.5366523288885753,0.0012177115101367235,0.00018250017805985407,0.0004552785734316179,0.58903211639041,0.58903211639041,0.0,0.021656018105291185,0.012503802318066831,0.44166022822970435,0.02614550514235383,0.010523270061683087,0.012690505914626614,0.007738524220056004,0.9127590012928796,0.0005917721755972635,0.09272179007530212,0.5892591674592216
|
| 4 |
+
c12,12,3,375.340989112854,0.5367248613834381,0.5367248613834381,0.0,0.021699281396965187,0.011626602997382482,0.38420872457822164,0.02185097098350525,0.009100019774710139,0.011132450985411803,0.006694494636108478,0.9019208218256632,0.5371037997404734,0.001075972502740721,0.00011737367528606531,0.0009300101390884568,0.5882984418717642,0.5882984418717642,0.0,0.021635016042088704,0.012553491526179843,0.44156919821860297,0.02498153174325587,0.0104848177113112,0.012679524764063813,0.0077307989288653645,0.9127509981866867,0.0013981061749204638,0.10513827204704285,0.5883239010104278
|
| 5 |
+
c12,12,4,376.1749415397644,0.5354055147171021,0.5354055147171021,0.0,0.021568402563532194,0.011595834230383238,0.38321917899449665,0.021181836920479934,0.00901865469540159,0.01108240385974447,0.006663104412456353,0.902158934434255,0.5357591871420543,0.001009523277791838,1.6993584382968643e-05,0.0013612994182234008,0.5881627817002554,0.5881627817002554,0.0,0.021614655438396666,0.012409283454337764,0.44097392946954755,0.025723386319383743,0.010516412075727231,0.01267807926273062,0.007742256717017245,0.9127898812294006,0.0011150522549296655,0.09482403099536896,0.588259002627014
|
| 6 |
+
c12,12,5,375.2234983444214,0.5297534540494283,0.5297534540494283,0.0,0.021633496743937334,0.011656551035741964,0.3764087144533793,0.021131821237504483,0.008972832853595417,0.01083251591026783,0.00648953548197945,0.9015390345255534,0.5301030071576437,0.0009972691241030892,2.5467515661982056e-05,0.0015420300432791312,0.5867839209617131,0.5867839209617131,0.0,0.021345573373966746,0.012374019102444725,0.4400356922830854,0.025178391515972124,0.010483759980175703,0.012614970598074178,0.0077422610336234645,0.9127489914969792,0.0011839034139282173,0.09554561227560043,0.5868629360119443
|
| 7 |
+
c12,12,6,375.306259393692,0.5305995781421662,0.5305995781421662,0.0,0.021100208756824335,0.011479389895995458,0.37682336378097536,0.022904716956118742,0.009059069167822599,0.010730923041701318,0.006617522978534301,0.9021113249460856,0.5309567918777466,0.001018151861615479,4.3046089044461645e-05,0.0013568060144316405,0.5801971029667627,0.5801971029667627,0.0,0.020873336239703118,0.012237219982558773,0.43186811748005094,0.026357809052107824,0.010548437162051125,0.012147134125587485,0.0077456337444129445,0.912496168462057,0.0012847323281069596,0.10438073426485062,0.5802509128879904
|
| 8 |
+
c12,12,7,377.23606300354004,0.5215828765233358,0.5215828765233358,0.0,0.02049009939779838,0.011223019761343798,0.365291735569636,0.024885773340861003,0.009114339218785366,0.010139540459960699,0.006514762082447608,0.9023147617975871,0.5219489343166351,0.001045882121194154,0.0,0.0014223542384958516,0.5690574768989806,0.5690574768989806,0.0,0.02000873815268278,0.011931078523279183,0.41758731338712907,0.029355664367950153,0.010594115659062351,0.011291667996417908,0.007720940273314241,0.9119829393568493,0.000904778414960241,0.12038547545671463,0.5692062713215258
|
| 9 |
+
c12,12,8,376.7237596511841,0.5100302851994832,0.5100302851994832,0.0,0.01988510761161645,0.010969051909943421,0.3505439485708872,0.027663228770097095,0.00893286546319723,0.009323090452700853,0.006421383836617073,0.9013378702799479,0.510411841392517,0.0010901592516650755,0.0,0.0009557946283215036,0.5634298551650274,0.5634298551650274,0.0,0.019781229958411247,0.011852999912604453,0.41019562785587615,0.03107032132527185,0.010238552118636786,0.010833994588918157,0.007668148016645795,0.9115947286287943,0.0010209099494940823,0.15407392382621765,0.5635496184017551
|
| 10 |
+
c12,12,9,376.85094022750854,0.507263090133667,0.507263090133667,0.0,0.019617830522358416,0.010865601129829884,0.3472577447891235,0.028270018259684244,0.00882062143770357,0.009081354944656292,0.006440112157414357,0.9011601126988729,0.5076305433909098,0.0010498686678086719,0.0,0.0010557570937089623,0.5571970977480449,0.5571970977480449,0.0,0.019513066636309737,0.0115175171503945,0.4024127385919056,0.03196660503153763,0.010277780327236368,0.010512134488967676,0.00767862189945484,0.911656053293319,0.0010454020498039584,0.17266879975795746,0.5573107370623732
|
| 11 |
+
c12,12,10,375.61447954177856,0.5034275888601939,0.5034275888601939,0.0,0.01945827005058527,0.01086595336596171,0.34302596426010135,0.02805961936712265,0.008680547054857015,0.008941962257027626,0.00640202797204256,0.9008666528065999,0.503779356320699,0.0010050510846388837,0.0,0.0013267192649655045,0.5546970977669671,0.5546970977669671,0.0,0.01933484131263362,0.011616076194932537,0.3993587087071131,0.032680437027935,0.010001635866328365,0.010205556165486102,0.007613758623067822,0.9112323588795133,0.001414736350333052,0.19268487393856049,0.554718405005888
|
| 12 |
+
c12,12,11,375.24995708465576,0.5010197977224986,0.5010197977224986,0.0,0.01938673095156749,0.01072282670189937,0.3405762590169907,0.027836419428388277,0.008590539732947945,0.00881740476563573,0.006425728273267547,0.9003096303939819,0.5013628186384836,0.0009800632501331468,0.0,0.0014654783327132464,0.5528195623367552,0.5528195623367552,0.0,0.0191843296356854,0.01143684195325015,0.39693913478699944,0.03328354905049006,0.009874344426428988,0.010215239288906256,0.007620674602332569,0.9113265749007936,0.001349674340980571,0.1880955547094345,0.5528571359738578
|
| 13 |
+
c12,12,12,373.3766739368439,0.4982270418802897,0.4982270418802897,0.0,0.019327664556602637,0.010744002804160118,0.3369953593810399,0.028010406091809274,0.008765921199073394,0.008687555788705746,0.006345666376252969,0.9003536230723063,0.4985640133221944,0.0009627767282848556,0.0,0.0018640609867870807,0.5500121920827835,0.5500121920827835,0.0,0.019020675430222164,0.01139732093978969,0.39259391076981076,0.03487931700452926,0.01010480767766398,0.010063974061123436,0.0075816902006784126,0.9109661739970011,0.0018461983861579071,0.2099224030971527,0.5500121864013463
|
| 14 |
+
c12,12,13,375.4060823917389,0.4929509384632111,0.4929509384632111,0.0,0.018882986719409623,0.010555492761234443,0.3316131766239802,0.027752760390440622,0.008330006399502357,0.008541071416189273,0.006239386618137359,0.9002649874687195,0.4932921314239502,0.0009748362200334668,0.0,0.0019581074891611935,0.5482192564578283,0.5482192564578283,0.0,0.018971675622557835,0.011403986060666659,0.3897369991219233,0.03596245778340196,0.010054939234304049,0.010053900491801045,0.007547523235044782,0.9108573813287039,0.0017904211242224962,0.22663871943950653,0.5482192457705322
|
| 15 |
+
c12,12,14,377.41549587249756,0.49390626017252603,0.49390626017252603,0.0,0.018556087881326674,0.010424449374278387,0.33337370745340983,0.027144863019386928,0.008280318172027668,0.008596581303824982,0.0063180246464908125,0.9015438667933147,0.4942530823548635,0.0009909214425521593,0.0,0.0018746985763621828,0.5442225956727588,0.5442225956727588,0.0,0.018793071457554423,0.011101246781883732,0.38639049681406173,0.034259687044790814,0.010025053351585354,0.009904929961536139,0.007500446719368772,0.9109539077395484,0.0015537958603263611,0.23742897808551788,0.5442225887347751
|
| 16 |
+
c12,12,15,374.57928013801575,0.4879121992588043,0.4879121992588043,0.0,0.018680525173743565,0.01044924617310365,0.32630121620496116,0.026820317228635152,0.008347869131714106,0.00838456108296911,0.006138053042193254,0.9005078458786011,0.4882546723683675,0.0009784934458633265,0.0,0.0018599987762669722,0.5416236288017697,0.5416236288017697,0.0,0.018572068492334986,0.011036009498177067,0.3834992429566762,0.034413220153914556,0.00982488968246986,0.009978582439500661,0.007435119925214658,0.9108078158090985,0.0015780522353163668,0.24796634912490845,0.5416236129197632
|
| 17 |
+
c12,12,16,374.78523564338684,0.48435816121101377,0.48435816121101377,0.0,0.01854543756445249,0.01036274675031503,0.32214861758550006,0.027183233638604483,0.008152601431434352,0.008309419980893533,0.006059537000954151,0.8999115562438965,0.48470149540901186,0.000980953940966477,0.0,0.0018201460336955886,0.5383955074681176,0.5383955074681176,0.0,0.018438149332290606,0.010934829238861327,0.38056029024578275,0.03345783640231405,0.009575375119253757,0.009925686214710511,0.007377515532194622,0.91070005155745,0.0015295867093040475,0.2573261559009552,0.5383954958088459
|
| 18 |
+
c12,12,17,375.4057195186615,0.4858545018831889,0.4858545018831889,0.0,0.01828891504307588,0.010265505398313205,0.3240912417968114,0.0276919092386961,0.00791236455924809,0.008449929422388475,0.006106408959875504,0.9000090823173523,0.4862018145720164,0.0009923230848896006,0.0,0.0015495519357112547,0.5325070912875827,0.5325070912875827,0.0,0.0183464948472286,0.010787804448415362,0.3743760221534305,0.03242616086370415,0.009443070288629287,0.00984728600208958,0.007168316452335271,0.9103870912203713,0.0015570339173935945,0.2719361186027527,0.532507083879503
|
| 19 |
+
c12,12,18,375.6031596660614,0.4815242377122243,0.4815242377122243,0.0,0.018189024036129316,0.010152820467948914,0.3193099800348282,0.027175174946586292,0.007915497479960322,0.008391331683844329,0.005955454832563797,0.8999922814369201,0.4818710346221924,0.0009908461997595926,0.0,0.0015711698761830728,0.5308343280875494,0.5308343280875494,0.0,0.018237237862887837,0.010778898994127909,0.3716696477125561,0.03375963408440825,0.009472961108835916,0.009682698995761928,0.007070973057240721,0.9100759076693702,0.0015071118546147195,0.26563721895217896,0.5308343199251723
|
| 20 |
+
c12,12,19,374.2583611011505,0.47636756841341654,0.47636756841341654,0.0,0.018179396353662013,0.010071316301822663,0.31338094170888264,0.02693996358414491,0.007824280134091775,0.008251137594381968,0.005801114315167069,0.8994708518981933,0.4767124565442403,0.0009853952241440614,0.0,0.0015627151511919996,0.5287075477933126,0.5287075477933126,0.0,0.01807313070942958,0.010788174641747323,0.36796792111699544,0.03570671941316317,0.009486166072920674,0.00966817271407871,0.006985736899964866,0.9098116821712918,0.0015059328168660166,0.27385368943214417,0.5287075346524251
|
| 21 |
+
c12,12,20,376.3787953853607,0.47209075578053794,0.47209075578053794,0.0,0.017972640266021092,0.010004536828647057,0.3088926980495453,0.026397575015823047,0.007601803181692958,0.008173396352678537,0.005698151058206956,0.8995036969184875,0.47243266328175865,0.0009768769474079212,0.0,0.0016348677257386347,0.5249851232483274,0.5249851232483274,0.0,0.017950309263098808,0.010826981227312769,0.3664118661766961,0.03199222775560523,0.009098108680475326,0.009474709312180205,0.0068885886021668,0.9094647736776442,0.0015409467501624945,0.25657251477241516,0.5249851110997418
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c4_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:024d01d13b522add7a9757dd5aeef7dfe936de9ae96daa43eed65edd19cef3e9
|
| 3 |
+
size 13289488
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_c8_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:66fe62dd6e7cb32d3d03e27504c097851dce6d4e115584fdca939890ce7c5413
|
| 3 |
+
size 13290512
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/best_semantic_decoder_exp2b_base.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d474e5e6502778b2a146521058112407943cfe6ec2d0029d00bdef6e6ee4a864
|
| 3 |
+
size 6323841
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c12_causal_manual.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb7b6df37eb14d0a585b90f772cf30439683f5bc3792c85ded38e378e40452da
|
| 3 |
+
size 13292954
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c4_causal_manual.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4751bbcf07da04e4a6032bdfa5e298bcb1bc922350c2dbaf1e08f4a129f037f9
|
| 3 |
+
size 13290713
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c8_causal_manual.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6094c1e7873211b8d22687b89c525811ed82737128129bc2e2ba8d1ff9a4dfd
|
| 3 |
+
size 13291737
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/downloaded_hf_folder/WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_semantic_decoder.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee7cfbb0876514442f658168f8757b086a3f4e8726c82ea5c1c2e8f2eb7e09b2
|
| 3 |
+
size 6323103
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/experiment2b_decision.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"run_sentinel": "ICWDS_WSHC_EXP2B_CAUSAL_RESIDUAL_BOTTLENECK_V1",
|
| 3 |
+
"criteria": {
|
| 4 |
+
"zero_identity_exact": true,
|
| 5 |
+
"pca8_shape_gain_ge_10pct": false,
|
| 6 |
+
"pca32_shape_gain_ge_20pct": false,
|
| 7 |
+
"c8_shape_gain_ge_10pct": true,
|
| 8 |
+
"c8_mse_gain_ge_10pct": false,
|
| 9 |
+
"c8_retains_ge_50pct_of_pca8_shape_gain": true,
|
| 10 |
+
"shuffle_shape_gap_ge_5pct": false,
|
| 11 |
+
"shuffle_mse_gap_ge_5pct": false,
|
| 12 |
+
"complex_gain_ge_regular_gain": false
|
| 13 |
+
},
|
| 14 |
+
"metrics": {
|
| 15 |
+
"c8_shape_gain_vs_semantic_only": 0.14433410851609063,
|
| 16 |
+
"c8_mse_gain_vs_semantic_only": -0.0049219193897158675,
|
| 17 |
+
"pca8_shape_gain_vs_semantic_only": -0.009956487990995466,
|
| 18 |
+
"pca32_shape_gain_vs_semantic_only": 0.030969322481716577,
|
| 19 |
+
"c8_shape_gain_retention_vs_pca8": 74653206836.60959,
|
| 20 |
+
"c8_shuffle_shape_gap": 0.006015519547725834,
|
| 21 |
+
"c8_shuffle_mse_gap": -0.00016044933192560507,
|
| 22 |
+
"regular_shape_gain": 0.0008977841537090026,
|
| 23 |
+
"complex_shape_gain_mean": -0.00462092683500052,
|
| 24 |
+
"max_zero_identity_diff": 2.980232238769531e-07,
|
| 25 |
+
"smallest_passing_continuous_dim": 4
|
| 26 |
+
},
|
| 27 |
+
"recommendation": "Residual manifold appears insufficiently low-dimensional: reconsider or remove per-wave shape code; spend bits on semantic precision/background."
|
| 28 |
+
}
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latent_utilization_diagnostics.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
variant,latent_dim,n,mean_std,min_std,max_std,effective_rank,mean_abs_offdiag_corr
|
| 2 |
+
c4,4,11910,0.30168530344963074,0.23066112399101257,0.3482239842414856,2.9832115173339844,0.28559038043022156
|
| 3 |
+
c8,8,11910,0.1214737668633461,0.06882838904857635,0.2111997902393341,1.0637741088867188,0.9774099588394165
|
| 4 |
+
c12,12,11910,0.25949305295944214,0.19109365344047546,0.37045663595199585,4.088396072387695,0.4084055423736572
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c12_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b5a106dedb2881627356ba376dd2e7a697f6d01725e91d5fa1bb1e8744c2bcf
|
| 3 |
+
size 39891227
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c4_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4751bbcf07da04e4a6032bdfa5e298bcb1bc922350c2dbaf1e08f4a129f037f9
|
| 3 |
+
size 13290713
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/latest_c8_causal.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6094c1e7873211b8d22687b89c525811ed82737128129bc2e2ba8d1ff9a4dfd
|
| 3 |
+
size 13291737
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/model_summary_exp2b.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"run_sentinel": "ICWDS_WSHC_EXP2B_CAUSAL_RESIDUAL_BOTTLENECK_V1",
|
| 3 |
+
"architecture": "Frozen deterministic semantic backbone + continuous causal residual codec Delta(z,s)=F(z,s)-F(0,s)",
|
| 4 |
+
"latent_dims": [
|
| 5 |
+
4,
|
| 6 |
+
8,
|
| 7 |
+
12
|
| 8 |
+
],
|
| 9 |
+
"pca_dims": [
|
| 10 |
+
0,
|
| 11 |
+
4,
|
| 12 |
+
8,
|
| 13 |
+
16,
|
| 14 |
+
32
|
| 15 |
+
],
|
| 16 |
+
"best_checkpoints": {
|
| 17 |
+
"c4": {
|
| 18 |
+
"path": "/content/icwds_wshc_exp2b_causal_residual/best_c4_causal.pt",
|
| 19 |
+
"score": Infinity
|
| 20 |
+
},
|
| 21 |
+
"c8": {
|
| 22 |
+
"path": "/content/icwds_wshc_exp2b_causal_residual/best_c8_causal.pt",
|
| 23 |
+
"score": Infinity
|
| 24 |
+
},
|
| 25 |
+
"c12": {
|
| 26 |
+
"path": "/content/icwds_wshc_exp2b_causal_residual/best_c12_causal.pt",
|
| 27 |
+
"score": 0.5249851110997418
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"zero_identity_sentinels": {
|
| 31 |
+
"c4": 2.980232238769531e-07,
|
| 32 |
+
"c8": 2.980232238769531e-07,
|
| 33 |
+
"c12": 2.980232238769531e-07
|
| 34 |
+
},
|
| 35 |
+
"decision": {
|
| 36 |
+
"run_sentinel": "ICWDS_WSHC_EXP2B_CAUSAL_RESIDUAL_BOTTLENECK_V1",
|
| 37 |
+
"criteria": {
|
| 38 |
+
"zero_identity_exact": true,
|
| 39 |
+
"pca8_shape_gain_ge_10pct": false,
|
| 40 |
+
"pca32_shape_gain_ge_20pct": false,
|
| 41 |
+
"c8_shape_gain_ge_10pct": true,
|
| 42 |
+
"c8_mse_gain_ge_10pct": false,
|
| 43 |
+
"c8_retains_ge_50pct_of_pca8_shape_gain": true,
|
| 44 |
+
"shuffle_shape_gap_ge_5pct": false,
|
| 45 |
+
"shuffle_mse_gap_ge_5pct": false,
|
| 46 |
+
"complex_gain_ge_regular_gain": false
|
| 47 |
+
},
|
| 48 |
+
"metrics": {
|
| 49 |
+
"c8_shape_gain_vs_semantic_only": 0.14433410851609063,
|
| 50 |
+
"c8_mse_gain_vs_semantic_only": -0.0049219193897158675,
|
| 51 |
+
"pca8_shape_gain_vs_semantic_only": -0.009956487990995466,
|
| 52 |
+
"pca32_shape_gain_vs_semantic_only": 0.030969322481716577,
|
| 53 |
+
"c8_shape_gain_retention_vs_pca8": 74653206836.60959,
|
| 54 |
+
"c8_shuffle_shape_gap": 0.006015519547725834,
|
| 55 |
+
"c8_shuffle_mse_gap": -0.00016044933192560507,
|
| 56 |
+
"regular_shape_gain": 0.0008977841537090026,
|
| 57 |
+
"complex_shape_gain_mean": -0.00462092683500052,
|
| 58 |
+
"max_zero_identity_diff": 2.980232238769531e-07,
|
| 59 |
+
"smallest_passing_continuous_dim": 4
|
| 60 |
+
},
|
| 61 |
+
"recommendation": "Residual manifold appears insufficiently low-dimensional: reconsider or remove per-wave shape code; spend bits on semantic precision/background."
|
| 62 |
+
},
|
| 63 |
+
"outputs": [
|
| 64 |
+
"WaveSemanticHybridCodec_Exp2B.py",
|
| 65 |
+
"WaveSemanticHybridCodec_Exp2B_best.pt",
|
| 66 |
+
"best_c12_causal.pt",
|
| 67 |
+
"best_c4_causal.pt",
|
| 68 |
+
"best_c8_causal.pt",
|
| 69 |
+
"best_semantic_decoder_exp2b_base.pt",
|
| 70 |
+
"causal_capacity_summary.csv",
|
| 71 |
+
"causal_casewise_summary.csv",
|
| 72 |
+
"causal_code_audit_bars.png",
|
| 73 |
+
"causal_condition_full_prior_summary.csv",
|
| 74 |
+
"causal_condition_part_summary.csv",
|
| 75 |
+
"causal_residual_full_prior_gallery.png",
|
| 76 |
+
"causal_training_history.csv",
|
| 77 |
+
"experiment2b_decision.json",
|
| 78 |
+
"latent_utilization_diagnostics.csv",
|
| 79 |
+
"latest_c12_causal.pt",
|
| 80 |
+
"latest_c4_causal.pt",
|
| 81 |
+
"latest_c8_causal.pt",
|
| 82 |
+
"latest_semantic_decoder.pt",
|
| 83 |
+
"pca_oracle_capacity.png",
|
| 84 |
+
"residual_pca_oracle.npz",
|
| 85 |
+
"training_curves_exp2b.png"
|
| 86 |
+
]
|
| 87 |
+
}
|
WaveSemanticHybridCodec/Exp2B_CausalResidualBottleneck/pca_oracle_capacity.png
ADDED
|