Skip to content

ulpwise 0.3.3

Choose a tag to compare

@github-actions github-actions released this 08 Oct 03:14
· 3 commits to main since this release
  • Two regression corpus cases for peft, both open upstream with a fix PR: peft #3769, add_weighted_adapter with
    combination_type='svd' crashed for Conv1d and Conv3d LoRA layers because only Conv2d deltas were flattened before
    the SVD (the case combines two rank 2 adapters at svd_rank=4 and expects the output of both adapters active, which
    the fix matches to 2e-6), and peft #3830, OFT module_dropout was never applied, so ten training forwards of the
    same input were identical where the fix spreads them by 0.56.
  • ulpwise scan: new where-nan-gradient rule (medium) for where(d > eps, f(d), other) with f a division by d
    or a sqrt, log, acos or asin of it. where evaluates both branches and hands the discarded one a zero
    gradient, and the backward of f at the singularity turns that zero into 0 / 0 = nan, so the guard protects the
    value and not the gradient. kornia #5579, found by the kornia conventions audit, is the example: the mutual
    information losses divided by the range of the signal inside where(diff > eps, ...) and a constant input or
    target got a nan gradient. The condition may be a comparison, a name bound to one, or ~, &, | and a subscript
    of those, and the method form a.where(cond, b) counts. Quiet for numpy.where, which has no autograd, for a
    comparison against a number above 1 (strength < 50 in kornia's JPEG scale is a piecewise definition), for a
    floor named eps, tol, floor, thresh, tiny, bound or limit on the other side of the comparison, and
    once d is re-bound to a where, clamp or maximum of itself, which is the recommended fix and the shape of
    kornia's fit_line and rotation_matrix_to_quaternion. On kornia main d15741e2 the rule reports four lines, on
    ultralytics main 8df3534 two, both in metric code, and nothing in torchvision.
  • ulpwise scan: new clamp-at-singularity rule (medium) for clamp(x, min=0).sqrt(), sqrt(clamp(x, min=0)),
    clamp(c, -1, 1).acos() and the clip, clamp_min, clamp_max, asin and log forms: the bound is the point
    where the next function has an infinite derivative, and clamp's derivative at its own bound is 1 on torch 2.5.1 and
    2.9.1 and 0 on 2.14, so the gradient there is inf or nan on the older half of a supported range. kornia #4229,
    found by the kornia conventions audit, is the example, _cdist's clamp(min=0.0).sqrt() with identical float16
    descriptors, and kornia #5500's clamp(-1, 1).acos() the second. A bound strictly inside the domain, min=1e-8,
    is a floor and is not reported, a bound given by a name is not read, and numpy is quiet. On kornia main d15741e2
    the rule reports the three lines of _solve_cubic_real, on ultralytics main 8df3534 one line of DepthMetrics.
  • ulpwise scan: a finding inside a nested function is reported once, under the nested function, instead of once
    more under the enclosing one, and the enclosing function's call and division counts no longer include it.
  • ulpwise scan: new eps-floor rule (medium) for x * (1 - eps) + eps, in either order and with self.eps too: the
    floor moves every value, 0 becomes eps and 1 stays 1, so the entries of a one-hot sum to 1 + (C - 1) eps and a
    perfect prediction scores a loss that grows with the image. kornia #5538, found by the kornia conventions audit, is
    the example: one_hot floored its zeros with 1e-6 and a perfect prediction of a 256 × 384 image with a one-pixel
    class scored a macro Dice loss of 0.0234. On kornia main 9e188e08 the rule reports that line and nothing else, and
    nothing in ultralytics or torchvision; (p + eps) / (q + eps) is not a floor and stays quiet.
  • ulpwise scan: the hypot-by-hand advice no longer offers norm as the replacement. torch.linalg.vector_norm and
    numpy.linalg.norm square the entries first too, so in float32 both return inf for a vector with two entries of
    1.8e19 while hypot returns 2.5e19; the advice now says to divide a vector by its largest absolute entry when the
    point is a direction. The kornia maintainer caught the case in review of kornia #5505, where v / v.norm() turned
    such vectors into zeros and the angle between them read 0.
  • ulpwise scan: acos-for-angle moves from info to medium and names the mechanism: next to 1 the cosine has no
    digits left for a small angle, so acos recovers the angle with an absolute error of sqrt(eps), 0.02 degrees in
    float32, whatever the angle. The kornia scan listed kornia/metrics/pose.py under this rule, and both functions
    there, angle_error_mat and angle_error_vec, return exactly 0 for every rotation below 0.03 degrees in float32
    and 180.0 for 179.99 degrees (kornia #5500); the rule cites it.
  • Regression corpus case for kornia #5500: a 0.01 degree rotation scores 0.0 in both metrics on kornia main 050ac77f.
  • The kornia #5500 corpus case records its fix, kornia #5505, merged 2026-10-06: angle_error_mat reads the sine from
    the skew part of the relative rotation and angle_error_vec from the cross product of the scaled vectors, and both
    return atan2(sin, cos), so a 0.01 degree rotation scores 0.0099990 in float32. The case stays an expected failure
    until a kornia release carries the fix.
  • ulpwise scan: logsumexp-by-hand no longer fires on the stable form, where every exp argument has its
    maximum subtracted first (log(exp(x - x.max()).sum()), or s = x - m with m bound to a max, amax,
    maximum or torch.max(...).values). The lm-evaluation-harness scan listed the numerically stable _log_softmax
    of lm_eval/models/_onnx_base.py next to a real log(exp(a) + exp(b)); it now reports only the real one.