问题:
ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer'
(D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddle\fluid\initializer.py)
代码:
PaddleX
配置GPU
import matplotlib
matplotlib.use('Agg')
import os
os.environ['CUDA_VISIBLE_DEVICES']='0'
import paddlex as pdx
问题具体描述:
ImportError Traceback (most recent call last)
Cell In[18], line 7
5 import os
6 os.environ['CUDA_VISIBLE_DEVICES']='0'
----> 7 import paddlex as pdx
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex__init__.py:20
17 from paddlex.utils.env import get_environ_info, init_parallel_env
18 init_parallel_env()
---> 20 from . import cv
21 from . import seg
22 from . import cls
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv__init__.py:15
1 # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from . import models
16 from . import transforms
17 from . import datasets
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models__init__.py:15
1 # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from .segmenter import
16 from .classifier import
17 from .detector import *
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models\segmenter.py:28
26 from paddlex.utils import get_single_card_bs, DisablePrint
27 import paddlex.utils.logging as logging
---> 28 from .base import BaseModel
29 from .utils import seg_metrics as metrics
30 from paddlex.utils.checkpoint import seg_pretrain_weights_dict
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models\base.py:25
23 import paddle
24 from paddle.io import DataLoader, DistributedBatchSampler
---> 25 from paddleslim import QAT
26 from paddleslim.analysis import flops
27 from paddleslim import L1NormFilterPruner, FPGMFilterPruner
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim__init.py:16
1 # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from future__ import absolute_import
---> 16 from paddleslim import models
17 from paddleslim import prune
18 from paddleslim import nas
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models__init.py:16
1 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from future__ import absolute_import
---> 16 from .util import image_classification
17 from .slimfacenet import SlimFaceNet_A_x0_60, SlimFaceNet_B_x0_75, SlimFaceNet_C_x0_75
18 from .slim_mobilenet import SlimMobileNet_v1, SlimMobileNet_v2, SlimMobileNet_v3, SlimMobileNet_v4, SlimMobileNet_v5
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\util.py:3
1 from future import absolute_import
2 import paddle.fluid as fluid
----> 3 from ..models import classification_models
5 all = ["image_classification"]
7 model_list = classification_models.model_list
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\classification_models.py:2
1 from future import absolute_import
----> 2 from .mobilenet import MobileNet
3 from .resnet import ResNet34, ResNet50
4 from .mobilenet_v2 import MobileNetV2
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\mobilenet.py:5
3 from future import print_function
4 import paddle.fluid as fluid
----> 5 from paddle.fluid.initializer import MSRA
6 from paddle.fluid.param_attr import ParamAttr
8 all = ['MobileNet']
ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer'
(D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddle\fluid\initializer.py)
请提出你的问题 Please ask your question
问题: ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer' (D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddle\fluid\initializer.py)
代码:
PaddleX
配置GPU
import matplotlib matplotlib.use('Agg') import os os.environ['CUDA_VISIBLE_DEVICES']='0' import paddlex as pdx
问题具体描述:
ImportError Traceback (most recent call last) Cell In[18], line 7 5 import os 6 os.environ['CUDA_VISIBLE_DEVICES']='0' ----> 7 import paddlex as pdx
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex__init__.py:20 17 from paddlex.utils.env import get_environ_info, init_parallel_env 18 init_parallel_env() ---> 20 from . import cv 21 from . import seg 22 from . import cls
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv__init__.py:15 1 # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 15 from . import models 16 from . import transforms 17 from . import datasets
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models__init__.py:15 1 # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 15 from .segmenter import 16 from .classifier import 17 from .detector import *
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models\segmenter.py:28 26 from paddlex.utils import get_single_card_bs, DisablePrint 27 import paddlex.utils.logging as logging ---> 28 from .base import BaseModel 29 from .utils import seg_metrics as metrics 30 from paddlex.utils.checkpoint import seg_pretrain_weights_dict
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddlex\cv\models\base.py:25 23 import paddle 24 from paddle.io import DataLoader, DistributedBatchSampler ---> 25 from paddleslim import QAT 26 from paddleslim.analysis import flops 27 from paddleslim import L1NormFilterPruner, FPGMFilterPruner
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim__init.py:16 1 # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License" (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 15 from future__ import absolute_import ---> 16 from paddleslim import models 17 from paddleslim import prune 18 from paddleslim import nas
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models__init.py:16 1 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License" (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 15 from future__ import absolute_import ---> 16 from .util import image_classification 17 from .slimfacenet import SlimFaceNet_A_x0_60, SlimFaceNet_B_x0_75, SlimFaceNet_C_x0_75 18 from .slim_mobilenet import SlimMobileNet_v1, SlimMobileNet_v2, SlimMobileNet_v3, SlimMobileNet_v4, SlimMobileNet_v5
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\util.py:3 1 from future import absolute_import 2 import paddle.fluid as fluid ----> 3 from ..models import classification_models 5 all = ["image_classification"] 7 model_list = classification_models.model_list
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\classification_models.py:2 1 from future import absolute_import ----> 2 from .mobilenet import MobileNet 3 from .resnet import ResNet34, ResNet50 4 from .mobilenet_v2 import MobileNetV2
File D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddleslim\models\mobilenet.py:5 3 from future import print_function 4 import paddle.fluid as fluid ----> 5 from paddle.fluid.initializer import MSRA 6 from paddle.fluid.param_attr import ParamAttr 8 all = ['MobileNet']
ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer' (D:\environmentalSupport\anaconda3\envs\pdenv\lib\site-packages\paddle\fluid\initializer.py)