Diff Coverage

Diff: origin/master...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
hyper_parallel/codegen/inline/patch_engine.py 90.0% 236
hyper_parallel/components/modules/attention/compressed_sparse_attention2/compressor.py 100%  
hyper_parallel/components/modules/attention/compressed_sparse_attention2/indexer.py 100%  
hyper_parallel/components/modules/attention/grouped_query_attention/grouped_query_attention.py 0.0% 228
hyper_parallel/components/modules/common/rms_norm.py 93.8% 35,93,156
hyper_parallel/components/modules/module_family.py 100%  
hyper_parallel/codegen/inline/patch_engine.py
232
233
234
235
236
237
238
239
    supplied = set(keywords)
    keywords.update({name: value for name, value in defaults.items() if name not in supplied})
    overrides = ast.parse(f"_constructor({', '.join(patch.keyword_args)})", mode="eval").body
    for kw in overrides.keywords:
        keywords[kw.arg] = kw.value
    result = ast.Call(func=ast.Name(id=patch.new_ctor, ctx=ast.Load()), args=[],
                      keywords=[ast.keyword(arg=name, value=value) for name, value in keywords.items()])
    return ast.unparse(result)
hyper_parallel/components/modules/attention/grouped_query_attention/grouped_query_attention.py
224
225
226
227
228
229
230
231
232
            # Retain that kernel as a real child Module so FSDP hooks are not bypassed.
            if norm is not None and hasattr(norm, "variance_epsilon"):
                if set(dict(norm.named_parameters())) != {"weight"}:
                    raise ValueError("GQA direct-scale RMSNorm requires only a weight parameter")
                norm = RMSNorm(module=norm)
            setattr(self, name, norm)

    def __init__(self, *, config: Any = None, module: nn.Module | None = None,
                 fuse_qkv: bool = True) -> None:
hyper_parallel/components/modules/common/rms_norm.py
31
32
33
34
35
36
37
38
    """Validate normalization dimensions and epsilon at construction."""
    if isinstance(hidden_size, bool) or not isinstance(hidden_size, int) or hidden_size <= 0:
        raise ValueError("RMSNorm hidden_size must be a positive integer")
    if isinstance(eps, bool) or not isinstance(eps, (int, float)):
        raise TypeError("RMSNorm eps must be a real scalar")
    if not isfinite(eps) or eps <= 0:
        raise ValueError("RMSNorm eps must be finite and positive")

89
90
91
92
93
94
95
96
97
            if module.weight.ndim != 1:
                raise ValueError("RMSNorm source weight must be one-dimensional")
            _validate_rms_settings(self.hidden_size, self.eps)
            if self.hidden_size != module.weight.numel():
                raise ValueError("RMSNorm source hidden_size must match its weight size")
            self.weight = module.weight
            self.train(module.training)
            return
        _validate_rms_settings(self.hidden_size, self.eps)
152
153
154
155
156
157
158
159
160
        if module.weight.ndim != 1:
            raise ValueError("OffsetRMSNorm source weight must be one-dimensional")
        _validate_rms_settings(self.hidden_size, self.eps)
        if self.hidden_size != module.weight.numel():
            raise ValueError("OffsetRMSNorm source hidden_size must match its weight size")
        self.weight = module.weight
        self.train(module.training)

    def reset_parameters(self) -> None: