参考:https://ai.gitcode.com/Ascend-SACT/MOVA-X86-pytorch 部署环境
gpu保存随机数,代码位置:mova/diffusion/pipelines/pipeline_mova.py 399行
torch.save(latents.to("cpu"), "/home/MOVA/output/latents.pt")将该pt文件传到npu环境,在mova/diffusion/pipelines/pipeline_mova.py 389行加载
latents = torch.load("/home/MOVA/gpu-pre/latents.pt", weights_only=False, map_location='cpu').to("npu")同时gpu也在mova/diffusion/pipelines/pipeline_mova.py 399行加载该文件;注释 torch.save操作
latents = torch.load("/home/MOVA/gpu-pre/latents.pt", weights_only=False, map_location='cpu').to("cuda")修改npu,mova/utils/adapter.py
def apply_rotary_pos_emb_adapter(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
return _apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim)whl包下载链接:http://gitcode.com/Ascend/MindIE-SD/releases?presetConfig={%22tags%22:3,%22release%22:2}
pip install mindiesd-*.whlgit clone https://atomgit.com/Ascend-SACT/MOVA-720p.git
cd MOVA-720p
git checkout ascend_910B1)下载量化工具
git clone https://gitcode.com/Ascend/msmodelslim.git
cd msmodelslim
bash install.sh2)下载wan2.2量化脚本
git clone https://modelers.cn/MindIE/Wan2.2 quant_dit_model(
model_path=args.ckpt_dir,
subfolder="video_dit",
dtype=config.param_dtype,
save_path=args.quant_dit_path,
disable_name_list=disable_name_list
)
quant_dit_model(
model_path=args.ckpt_dir,
subfolder="video_dit_2",
dtype=config.param_dtype,
save_path=args.quant_dit_path,
disable_name_list=disable_name_list
)4)执行量化命令
python quant_wan22.py --task i2v-A14B --ckpt_dir /root/work/filestorage/gh/ckpts/MOVA-720p-test --quant_dit_path ./quant_w8a8_dynamic --quant_type W8A8 --is_dynamic
RMSNorm、layernorm_scale_shift、rope