[Bugfix] fix layer-wise offload incompatible with cache-dit (#1786)

Signed-off-by: Lancer <maruixiang6688@gmail.com>
This commit is contained in:
Lancer authored and GitHub committed 2026-03-13 15:28:13 +08:00
1 parent 75056b2db2
commit 53a3df7309
1 file changed
+4 -1
+4 -1
View File
@@ -8,6 +8,7 @@ and modifying model forward passes without invasive changes to model code.
from __future__ import annotations
import inspect
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
@@ -166,7 +167,9 @@ class HookRegistry:
# `_original_forward` attribute on the same module.
if not hasattr(module, "_omni_original_forward"):
module._omni_original_forward = module.forward # type: ignore[attr-defined]
module.forward = _WrappedForward(module) # type: ignore[assignment]
wrapped = _WrappedForward(module)
wrapped.__signature__ = inspect.signature(module.forward) # type: ignore[attr-defined]
module.forward = wrapped # type: ignore[assignment]
return registry