文档首页/ AI开发平台ModelArts/ 最佳实践/ GPU业务迁移至昇腾训练推理/ 基于LLM模型的GPU训练业务迁移至昇腾指导/ 常见问题/ 训练运行报错AttributeError: 'torch_npu._C._NPUDeviceProperties' object has no attribute 'multi_processor_count'
更新时间:2024-08-17 GMT+08:00
分享

训练运行报错AttributeError: 'torch_npu._C._NPUDeviceProperties' object has no attribute 'multi_processor_count'

问题现象

训练运行报错“AttributeError: 'torch_npu._C._NPUDeviceProperties' object has no attribute 'multi_processor_count'”。

图1 报错信息

原因分析

这是因为torch_npu当前不支持DataParallel(DP)并行模式。

处理方法

如果是运行单卡模式,在训练脚本中加入export ASCEND_RT_VISIBLE_DEVICES=0(指定 0 号卡对当前进程可见)。多卡环境模式需要运行DDP并行模式。

相关文档