FloodDiffusion 来自论文 FloodDiffusion: Tailored Diffusion Forcing for Streaming Motion Generation,是用于文本驱动、Streaming 人体动作生成的最先进模型。
该模型基于 Latent Diffusion Forcing 框架,能够根据时间变化的文本提示生成对齐的、无缝的动作序列。
| 属性 | 值 |
|---|---|
| 模型类型 | LDFModel (Latent Diffusion Forcing) |
| 参数量 | 131.22 M (Model: 113.72M + VAE: 17.50M) |
| Transformer 维度 | 1024 |
| Transformer 深度 | 12 |
| 潜在空间维度 | 4 |
| 动作维度 | 263 (HumanML3D) |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| 操作系统 | CentOS 7.6+ / Ubuntu 18.04+ | 支持主流 Linux 发行版 |
| CANN | 5.0.RC2+ | 华为昇腾计算架构 |
| Python | 3.8+ | 推荐 3.10+ |
| PyTorch | 2.0.0+ | 推荐 2.12 |
| torch_npu | 与 PyTorch 版本匹配 | 昇腾 PyTorch 扩展 |
| transformers | >=4.30.0 | 模型加载 |
| lightning | >=2.0.0 | 训练框架 |
| diffusers | >=0.20.0 | 扩散模型 |
# 1) 激活已预装 torch / torch_npu 的 conda 环境
conda activate pt2100
# 2) 安装依赖(使用华为云源)
pip install transformers lightning diffusers omegaconf -i https://repo.huaweicloud.com/repository/pypi/simple
# 3) 验证环境
python -c "
import torch, torch_npu
print('torch:', torch.__version__)
print('torch_npu:', torch_npu.__version__)
print('NPU 可用:', torch.npu.is_available())
"# 进入适配目录
cd /workspace/agent4/FloodDiffusion-ascend
# 确认上游权重存在
ls -la /workspace/agent3/ShandaAI/FloodDiffusion/
# 期望输出:config.json model.safetensors (~455MB) vae.safetensors (~70MB) ...# 检查 NPU 设备状态
npu-smi info
# 验证 torch_npu 安装
python -c "import torch; import torch_npu; print('NPU 可用:', torch.npu.is_available())"# 基本用法:默认参数
python inference.py --device npu:0
# 指定其他 NPU 卡
python inference.py --device npu:1
# 自定义序列长度
python inference.py --device npu:0 --seq_len 120conda activate pt2100
cd /workspace/agent4/FloodDiffusion-ascend
python inference.py --device npu:0实际输出:
============================================================
FloodDiffusion 昇腾 NPU 推理
============================================================
[Device] npu:0
[Model Path] /workspace/agent3/ShandaAI/FloodDiffusion
[Config]
model_type: ldf_motion
architectures: ['LDFModel']
[Memory Before Model Load] Allocated: 0.00 GB, Reserved: 0.00 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| npu-smi 25.5.2 Version: 25.5.2 |
+---------------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.9 42 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 4778 / 65536 |
+===========================+===============+====================================================+
[Loading] FloodDiffusion model weights...
[Loading] FloodDiffusion model from ...model.safetensors
Model keys: 231
VAE keys: 108
Total parameters: 131.22 M
[Creating] Simplified FloodDiffusion model...
[Model Created] Allocated: 1.08 GB, Reserved: 1.26 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.9 42 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 4778 / 65536 |
+===========================+===============+====================================================+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| 0 0 | 1704235 | python | 1408 |
+===========================+===============+====================================================+
[Creating] Dummy motion latent input...
Latent input shape: torch.Size([1, 60, 4])
[Running] FloodDiffusion inference...
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 104.8 42 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 4790 / 65536 |
+===========================+===============+====================================================+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| 0 0 | 1704235 | python | 1420 |
+===========================+===============+====================================================+
[Results]
Noise prediction shape: torch.Size([1, 60, 4])
Motion features shape: torch.Size([1, 60, 263])
Motion mean: -0.002162
Motion std: 0.038063
[Weight Statistics]
Sample model weight: 'model.blocks.0.cross_attn.k.bias' shape=torch.Size([1024])
Sample VAE weight: 'mean' shape=torch.Size([263])
[Memory After Inference] Allocated: 1.08 GB, Reserved: 1.26 GB
[Done]| 指标 | 值 |
|---|---|
| 模型参数量 | 131.22 M |
| 权重文件 | model.safetensors (~455 MB) + vae.safetensors (~70 MB) |
| 推理显存峰值 | ~4-5 GB |
| 输出 Motion Shape | (1, 60, 263) |
trust_remote_code=True