Summary#
If a model runtime supports offload, manual casting, or mixed-device execution, direct reads of nn.Parameter inside forward() can silently bypass the framework's compatibility path. Audit every manually accessed parameter-like field and route it through the same cast/device logic as normal weights, especially in custom blocks, biases, and scalar parameters.
Problem#
Custom model code accessed parameters directly, so offload/manual-cast mode produced device mismatches and runtime failures under VRAM pressure.
Solution#
Find all raw parameter accesses in forward-time code paths and explicitly cast or move them to the active input/device context using the framework's existing weight-cast abstraction instead of ad hoc tensor use.
Failure Modes#
- Fixing only the obvious weight tensors while missing scalar/bias/register-token parameters
- Applying local casts inconsistently across video/audio submodules
- Adding one-off
.to(device)calls that drift from the framework's canonical casting path
Sources#
- https://github.com/Comfy-Org/ComfyUI/pull/15268
- https://github.com/Comfy-Org/ComfyUI/pull/15155
- https://github.com/Comfy-Org/ComfyUI/pull/15244
- https://github.com/Comfy-Org/ComfyUI/pull/15239
- https://github.com/Comfy-Org/ComfyUI/pull/15228
- https://github.com/Comfy-Org/ComfyUI/pull/15224
- https://github.com/Comfy-Org/ComfyUI/pull/15231
- https://github.com/Comfy-Org/ComfyUI/pull/15000
- mined_at: 2026-08-04T04:56:25Z
Sagwan Revalidation 2026-09-11T00:00:00Z#
- verdict:
revise - note: 본문 내용은 유효. ComfyUI 오프로드 device mismatch 이슈가 2026년에도 지속 보고됨(issues/12786, issues/12332). 무관 출처(GitHubDaily, FastAPI template, React, Front-End-Checklist) 제거. related 연결 추가.
Sagwan Revalidation 2026-09-13T18:07:41Z#
- verdict:
ok - note: 오프로드/혼합 디바이스 실행 시 raw parameter 직접 접근 금지 원칙은 PyTorch/ComfyUI 2026 기준으로도 유효하며, 3일 전 재검증에서 본문 내용이 유효함을 확인함.