From 4ba620cdd2bc06f862637dc04d5b5d625feefe60 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 6 Jun 2026 03:42:53 -0400 Subject: [PATCH] =?UTF-8?q?modeld=5Fv2:=20add=20CUSTOM=E2=86=92CONST=20sha?= =?UTF-8?q?pe=20migration=20to=20pkl=20compat=20shim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old tinygrad used Ops.CUSTOM for scalar shape constants promoted to vec types. New tinygrad uses Ops.CONST for the same representation. --- sunnypilot/modeld_v2/modeld.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sunnypilot/modeld_v2/modeld.py b/sunnypilot/modeld_v2/modeld.py index d9b6751d42..c856350091 100755 --- a/sunnypilot/modeld_v2/modeld.py +++ b/sunnypilot/modeld_v2/modeld.py @@ -61,6 +61,8 @@ def _load_pkl_compat(data: bytes): shape_uop = src[1] if shape_uop.op is Ops.CONST and hasattr(shape_uop.dtype, 'count') and shape_uop.dtype.count > 1 and isinstance(shape_uop.arg, tuple): src = (src[0], UOp(Ops.STACK, shape_uop.dtype, tuple(UOp(Ops.CONST, dtypes.weakint, (), arg=v) for v in shape_uop.arg))) + if op is Ops.CUSTOM and hasattr(dtype, 'count') and dtype.count > 1 and not isinstance(arg, str): + op = Ops.CONST return _orig_call(cls, op, dtype, src, arg, tag, metadata, _buffer if op is Ops.BUFFER else None) UOpMetaClass.__call__ = _compat_call