The vendored group-offloading helper (see the "Modified from .../diffusers/v0.36.0"
header) resolved its data-transfer stream by probing for CUDA/XPU only, so
`gpu_memory_mode="model_group_offload"`, which calls `apply_group_offloading(..., use_stream=True)`,
raised on a host whose accelerator is neither of those:
ValueError: Using streams for data transfer requires a CUDA device, or an Intel XPU device.
even when the accelerator's backend implements streams (for example Ascend NPU, where
`torch.cuda.is_available()` is False while `torch.npu` is available and provides `Stream`).
Resolve the stream from the onload device's own backend instead, and keep rejecting devices
whose backend cannot stream, with a message that names the device type. This is the same
policy upstream diffusers applies in the function this file is derived from.
Signed-off-by: li-lizhe <147392333@qq.com>
LoadZImageTransformerModel.loadmodel decides whether to run convert_state_dict
by looking for a bare `x_embedder.weight` key, and the converter itself assumes
bare keys. ComfyUI-native checkpoints (e.g. CivitAI Z-Image fine-tunes) store
every tensor under a `model.diffusion_model.` prefix, so the gate never fired,
the prefix survived, and the strict load_state_dict failed with
"Missing key(s): x_pad_token ... / Unexpected key(s): model.diffusion_model...".
Strip the prefix when every key carries it, then convert as before. Bare-key
checkpoints are untouched.
Signed-off-by: li-lizhe <147392333@qq.com>
* fix: use dtype instead of deprecated torch_dtype for transformers >= 4.56
config.torch_dtype and the torch_dtype keyword argument were deprecated in transformers 4.56 (PR #39782). Use dtype when accepted and fall back to torch_dtype via try/except TypeError for older versions.
* fix: use dtype instead of deprecated torch_dtype for transformers >= 4.56
config.torch_dtype and the torch_dtype keyword argument were deprecated in transformers 4.56 (PR #39782). Pass dtype based on the installed transformers version (packaging.version), falling back to torch_dtype on older versions.
---------
Co-authored-by: 谢翊凡 <xyf5432@users.noreply.github.com>
- Update predict_s2v.py with improved inference configuration
- Align pipeline_flashhead.py with official streaming, scheduling, conditioning, and motion-cache behavior