Phase 2
This commit is contained in:
1 parent
9ed2e0b8e7
commit
9113420b61
13 files changed
+799
-76
No files matched your search
@@ -11,13 +11,36 @@ class QwenImageTransformer2DModel(
|
||||
aitk_subfolder = "transformer"
|
||||
aitk_config_repo = "Qwen/Qwen-Image"
|
||||
|
||||
aitk_comfy_repo = "Comfy-Org/Qwen-Image_ComfyUI"
|
||||
# the comfy files use the diffusers key layout directly (no conversion);
|
||||
# fp8mixed carries float8_e4m3fn comfy_quant markers that attach straight
|
||||
# onto this class's modules
|
||||
aitk_comfy_weight_names = {
|
||||
"Qwen/Qwen-Image": [
|
||||
"split_files/diffusion_models/qwen_image_fp8mixed.safetensors",
|
||||
# raw fp8 cast (no markers, diffusers keys) — loads via from_single_file
|
||||
"split_files/diffusion_models/qwen_image_fp8_e4m3fn.safetensors",
|
||||
"split_files/diffusion_models/qwen_image_bf16.safetensors",
|
||||
],
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_transformer_block_names(cls):
|
||||
return ["transformer_blocks"]
|
||||
|
||||
@classmethod
|
||||
def _load_single_file(cls, file_path, dtype, config_path=None, subfolder=None):
|
||||
# single-file checkpoints in the wild carry diffusers or original key
|
||||
from safetensors import safe_open
|
||||
|
||||
with safe_open(file_path, framework="pt") as f:
|
||||
has_markers = any(k.endswith(".comfy_quant") for k in f.keys())
|
||||
if has_markers:
|
||||
# comfy prequantized checkpoint (diffusers key layout): the mixin
|
||||
# path attaches the quantized layers
|
||||
return super()._load_single_file(
|
||||
file_path, dtype, config_path=config_path, subfolder=subfolder
|
||||
)
|
||||
# other single-file checkpoints carry diffusers or original key
|
||||
# layouts; diffusers' single-file machinery owns that conversion
|
||||
model = cls.from_single_file(
|
||||
file_path,
|
||||
|
||||
Reference in new issue
Block a user