急求!使用Pycharm+Modelarts插件训练时报错:AttributeError: module 'mindspore.train' has no attribute 'Metric'
收藏回复举报
急求!使用Pycharm+Modelarts插件训练时报错:AttributeError: module 'mindspore.train' has no attribute 'Metric'
t('forum.solved') 已解决
新人帖
发表于2024-06-20 12:43:32
0 查看

报错内容如下,mindspore 1.7.0,python 3.7.2

 C:\Users\xxxx\AppData\Local\Programs\Python\Python37\python.exe "D:/xxxx/models-master/official/cv/ResNet/train.py" --net_name=resnet50 --dataset=imagenet2012 --data_path=../../../dataset/flower_photos/ --class_num=5 --config_path=./config/resnet50_imagenet2012_config.yaml --epoch_size=1 --device_target=CPU 

{'enable_modelarts': 'Whether training on modelarts, default: False', 'data_url': 'Dataset url for obs', 'checkpoint_url': 'The location of checkpoint for obs', 'data_path': 'Dataset path for local', 'output_path': 'Training output path for local', 'load_path': 'The location of checkpoint for obs', 'device_target': 'Target device type, available: [Ascend, GPU, CPU]', 'enable_profiling': 'Whether enable profiling while training, default: False', 'num_classes': 'Class for dataset', 'batch_size': 'Batch size for training and evaluation', 'epoch_size': 'Total training epochs.', 'checkpoint_path': 'The location of the checkpoint file.', 'checkpoint_file_path': 'The location of the checkpoint file.', 'save_graphs': 'Whether save graphs during training, default: False.', 'save_graphs_path': 'Path to save graphs.', 'img_path': 'image file path.'} 

Please check the above information for the configurations 

Traceback (most recent call last): 

  File "D:/xxxx/models-master/official/cv/ResNet/train.py", line 31, in <module> 

    from src.metric import DistAccuracy, ClassifyCorrectCell 

  File "D:\xxxx\models-master\official\cv\ResNet\src\metric.py", line 65, in <module> 

    class DistAccuracy(train.Metric): 

AttributeError: module 'mindspore.train' has no attribute 'Metric' 

 进程已结束,退出代码1 

我要发帖子