Merge pull request #536 from modelscope/wan-vace-quant

support vace quant
This commit is contained in:
Zhongjie Duan
2025-04-16 10:43:14 +08:00
committed by GitHub
2 changed files with 19 additions and 1 deletions

View File

@@ -142,6 +142,24 @@ class WanVideoPipeline(BasePipeline):
computation_device=self.device,
),
)
if self.vace is not None:
enable_vram_management(
self.vace,
module_map = {
torch.nn.Linear: AutoWrappedLinear,
torch.nn.Conv3d: AutoWrappedModule,
torch.nn.LayerNorm: AutoWrappedModule,
RMSNorm: AutoWrappedModule,
},
module_config = dict(
offload_dtype=dtype,
offload_device="cpu",
onload_dtype=dtype,
onload_device=self.device,
computation_dtype=self.torch_dtype,
computation_device=self.device,
),
)
self.enable_cpu_offload()

View File

@@ -8,7 +8,7 @@ from PIL import Image
snapshot_download("iic/VACE-Wan2.1-1.3B-Preview", local_dir="models/iic/VACE-Wan2.1-1.3B-Preview")
# Load models
model_manager = ModelManager(device="cuda")
model_manager = ModelManager(device="cpu")
model_manager.load_models(
[
"models/iic/VACE-Wan2.1-1.3B-Preview/diffusion_pytorch_model.safetensors",