"tests/git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "a47451b47a1c88668c8284c885be92b5965e5447"
Unverified Commit 9fcb2cf8 authored by gushiqiao's avatar gushiqiao Committed by GitHub
Browse files

update config and fix wan22 lora bug (#396)

parent b56dbb85
{
"infer_steps": 4,
"target_video_length": 81,
"text_len": 512,
"target_height": 720,
"target_width": 1280,
"self_attn_1_type": "sage_attn2",
"cross_attn_1_type": "sage_attn2",
"cross_attn_2_type": "sage_attn2",
"sample_guide_scale": [
3.5,
3.5
],
"sample_shift": 5.0,
"enable_cfg": false,
"cpu_offload": true,
"offload_granularity": "block",
"t5_cpu_offload": false,
"vae_cpu_offload": false,
"use_image_encoder": false,
"boundary_step_index": 2,
"denoising_step_list": [
1000,
750,
500,
250
],
"lora_configs": [
{
"name": "high_noise_model",
"path": "lightx2v/Wan2.2-Distill-Loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_1022.safetensors",
"strength": 1.0
},
{
"name": "low_noise_model",
"path": "lightx2v/Wan2.2-Distill-Loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_1022.safetensors",
"strength": 1.0
}
]
}
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
"dit_quantized": true, "dit_quantized": true,
"dit_quant_scheme": "fp8-sgl", "dit_quant_scheme": "fp8-sgl",
"t5_quantized": true, "t5_quantized": true,
"t5_quant_scheme": "fp8" "t5_quant_scheme": "fp8-sgl"
} }
...@@ -107,7 +107,7 @@ class WanModel(CompiledMethodsMixin): ...@@ -107,7 +107,7 @@ class WanModel(CompiledMethodsMixin):
return False return False
def _should_init_empty_model(self): def _should_init_empty_model(self):
if self.config.get("lora_configs") and self.config.lora_configs: if self.config.get("lora_configs") and self.config["lora_configs"]:
if self.model_type in ["wan2.1"]: if self.model_type in ["wan2.1"]:
return True return True
if self.model_type in ["wan2.2_moe_high_noise"]: if self.model_type in ["wan2.2_moe_high_noise"]:
......
...@@ -715,10 +715,11 @@ def convert_weights(args): ...@@ -715,10 +715,11 @@ def convert_weights(args):
index["metadata"]["total_size"] += os.path.getsize(output_path) index["metadata"]["total_size"] += os.path.getsize(output_path)
# Save index file # Save index file
index_path = os.path.join(args.output, "diffusion_pytorch_model.safetensors.index.json") if not args.single_file:
with open(index_path, "w", encoding="utf-8") as f: index_path = os.path.join(args.output, "diffusion_pytorch_model.safetensors.index.json")
json.dump(index, f, indent=2) with open(index_path, "w", encoding="utf-8") as f:
logger.info(f"Index file written to: {index_path}") json.dump(index, f, indent=2)
logger.info(f"Index file written to: {index_path}")
if os.path.isdir(args.source) and args.copy_no_weight_files: if os.path.isdir(args.source) and args.copy_no_weight_files:
copy_non_weight_files(args.source, args.output) copy_non_weight_files(args.source, args.output)
...@@ -783,7 +784,7 @@ def main(): ...@@ -783,7 +784,7 @@ def main():
parser.add_argument( parser.add_argument(
"--device", "--device",
type=str, type=str,
default="cpu", default="cuda",
help="Device to use for quantization (cpu/cuda)", help="Device to use for quantization (cpu/cuda)",
) )
parser.add_argument( parser.add_argument(
......
...@@ -48,7 +48,7 @@ A powerful model weight conversion tool that supports format conversion, quantiz ...@@ -48,7 +48,7 @@ A powerful model weight conversion tool that supports format conversion, quantiz
- `torch.bfloat16`: BF16 - `torch.bfloat16`: BF16
- `torch.float16`: FP16 - `torch.float16`: FP16
- `torch.float32`: FP32 (default) - `torch.float32`: FP32 (default)
- `--device`: Device for quantization, `cpu` (default) or `cuda` - `--device`: Device for quantization, `cpu` or `cuda` (default)
- `--comfyui_mode`: ComfyUI compatible mode - `--comfyui_mode`: ComfyUI compatible mode
- `--full_quantized`: Full quantization mode (effective in ComfyUI mode) - `--full_quantized`: Full quantization mode (effective in ComfyUI mode)
...@@ -391,7 +391,8 @@ python converter.py \ ...@@ -391,7 +391,8 @@ python converter.py \
--source /path/to/model.pth \ --source /path/to/model.pth \
--output /path/to/output \ --output /path/to/output \
--output_ext .safetensors \ --output_ext .safetensors \
--output_name model --output_name model \
--single_file
``` ```
#### 4.2 Multiple .safetensors → Single File #### 4.2 Multiple .safetensors → Single File
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
- `torch.bfloat16`: BF16 - `torch.bfloat16`: BF16
- `torch.float16`: FP16 - `torch.float16`: FP16
- `torch.float32`: FP32(默认) - `torch.float32`: FP32(默认)
- `--device`: 量化使用的设备,可选 `cpu`(默认)`cuda` - `--device`: 量化使用的设备,可选 `cpu` `cuda`(默认)
- `--comfyui_mode`: ComfyUI 兼容模式 - `--comfyui_mode`: ComfyUI 兼容模式
- `--full_quantized`: 全量化模式(ComfyUI 模式下有效) - `--full_quantized`: 全量化模式(ComfyUI 模式下有效)
...@@ -391,7 +391,8 @@ python converter.py \ ...@@ -391,7 +391,8 @@ python converter.py \
--source /path/to/model.pth \ --source /path/to/model.pth \
--output /path/to/output \ --output /path/to/output \
--output_ext .safetensors \ --output_ext .safetensors \
--output_name model --output_name model \
--single_file
``` ```
#### 4.2 多个 .safetensors → 单文件 #### 4.2 多个 .safetensors → 单文件
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment