PaddleHub 操作系统错误:(外部)Cublas错误,CUBLAS_STATUS_INVALID_VALUE

tf7tbtn2  于 2个月前  发布在  其他
关注(0)|答案(9)|浏览(44)

由于TensorFlow在我机器上运行得非常好,我假设环境配置正确。可能存在哪些问题以及如何解决?
results = self.detector.object_detection(images = [ori_img], use_gpu = self.use_gpu, score_thresh = self.threshold, visualization=False) File "/home/user/anaconda3/lib/python3.7/site-packages/paddlehub/compat/paddle_utils.py", line 220, in runner return func(*args, **kwargs) File "/home/user/.paddlehub/modules/yolov3_resnet50_vd_coco2017/module.py", line 211, in object_detection [image_tensor, im_size_tensor]) OSError: (External) Cublas error, CUBLAS_STATUS_INVALID_VALUE . An unsupported value or parameter was passed to the function (a negative vector size, for example). (at /paddle/paddle/fluid/platform/cuda_helper.h:93)

xiozqbni

xiozqbni1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

嗨!我们已经收到了您的问题,请耐心等待技术人员的回复。请确保您提供了足够的信息来演示您的请求。您还可以通过查看 APIFAQGithub IssueAI community 来获取答案。祝您度过愉快的一天!

zysjyyx4

zysjyyx42#

这是PaddleHub的问题。
result = predictor.object_detection(images=[cv2.imread('best-face-oil.png')], use_gpu=True)
AttributeError: 'YOLOv3ResNet50Coco2017' 对象没有 'gpu_predictor' 属性
不知道为什么不能使用GPU进行预测。

yfwxisqw

yfwxisqw3#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

你好!我们已经收到了你的问题,请耐心等待技术人员的回复。请确保你提供了足够的信息来演示你的需求。你也可以查看 APIFAQGithub IssueAI community 来获取答案。祝你度过愉快的一天!

开发者,我今天遇到了同样的问题。这是我的日志。我的Paddle版本是2.0.1.post110

2021-03-22 22:45:35,513 - INFO - Found /home/bob/anaconda3/envs/dev/lib/python3.7/site-packages/ppgan/apps/photo2cartoon_genA2B_weight.pdparams
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-6da9bba74531> in <module>
----> 1 a = apps.Photo2CartoonPredictor()

~/anaconda3/envs/dev/lib/python3.7/site-packages/ppgan/apps/photo2cartoon_predictor.py in __init__(self, output_path, weight_path)
     41             weight_path = get_path_from_url(P2C_WEIGHT_URL, cur_path)
     42 
---> 43         self.genA2B = ResnetUGATITP2CGenerator()
     44         params = paddle.load(weight_path)
     45         self.genA2B.set_state_dict(params)

~/anaconda3/envs/dev/lib/python3.7/site-packages/ppgan/models/generators/resnet_ugatit_p2c.py in __init__(self, input_nc, output_nc, ngf, img_size, n_blocks, light)
     41         DownBlock += [
     42             nn.Pad2D([3, 3, 3, 3], 'reflect'),
---> 43             nn.Conv2D(input_nc, ngf, kernel_size=7, stride=1, bias_attr=False),
     44             nn.InstanceNorm2D(ngf, weight_attr=False, bias_attr=False),
     45             nn.ReLU()

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/nn/layer/conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, padding_mode, weight_attr, bias_attr, data_format)
    637             weight_attr=weight_attr,
    638             bias_attr=bias_attr,
--> 639             data_format=data_format)
    640 
    641     def forward(self, x):

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/nn/layer/conv.py in __init__(self, in_channels, out_channels, kernel_size, transposed, dims, stride, padding, padding_mode, output_padding, dilation, groups, weight_attr, bias_attr, data_format)
    133             shape=filter_shape,
    134             attr=self._param_attr,
--> 135             default_initializer=_get_default_param_initializer())
    136         self.bias = self.create_parameter(
    137             attr=self._bias_attr, shape=[self._out_channels], is_bias=True)

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in create_parameter(self, shape, attr, dtype, is_bias, default_initializer)
    406             temp_attr = None
    407         return self._helper.create_parameter(temp_attr, shape, dtype, is_bias,
--> 408                                              default_initializer)
    409 
    410     @deprecated(

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/layer_helper_base.py in create_parameter(self, attr, shape, dtype, is_bias, default_initializer, stop_gradient, type)
    370                 type=type,
    371                 stop_gradient=stop_gradient,
--> 372                 **attr._to_kwargs(with_initializer=True))
    373         else:
    374             self.startup_program.global_block().create_parameter(

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/framework.py in create_parameter(self, *args, **kwargs)
   2982                 pass
   2983             else:
-> 2984                 initializer(param, self)
   2985         return param
   2986 

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/initializer.py in __call__(self, var, block)
    362                 "use_mkldnn": False
    363             },
--> 364             stop_gradient=True)
    365 
    366         if var.dtype == VarDesc.VarType.FP16:

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/framework.py in _prepend_op(self, *args, **kwargs)
   3098                                        kwargs.get("outputs", {}), attrs
   3099                                        if attrs else {},
-> 3100                                        kwargs.get("stop_gradient", False))
   3101         else:
   3102             op_desc = self.desc._prepend_op()

~/anaconda3/envs/dev/lib/python3.7/site-packages/paddle/fluid/dygraph/tracer.py in trace_op(self, type, inputs, outputs, attrs, stop_gradient)
     43         self.trace(type, inputs, outputs, attrs,
     44                    framework._current_expected_place(), self._has_grad and
---> 45                    not stop_gradient)
     46 
     47     def train_mode(self):

OSError: (External)  Cublas error, `CUBLAS_STATUS_INVALID_VALUE`. An unsupported value or parameter was passed to the function (a negative vector size, for example).  (at /paddle/paddle/fluid/platform/cuda_helper.h:93)
  [operator < gaussian_random > error]`
jvlzgdj9

jvlzgdj94#

你好,大家好,我只是想发一个备忘录,PyTorch在我机器上运行得很好。顺便说一下,我发现叶教授和我都使用了python3.7或conda环境。这会不会导致这个问题?叶教授,你之前尝试过用docker运行这段代码吗?最后,非常感谢:)

2021-03-23 19:39:14,"Jeffery Ye" ***@***.***>写道:既然TensorFlow在我机器上运行得很好,我假设环境配置正确。可能存在什么问题,我该如何解决?

results = self.detector.object_detection(images = [ori_img], use_gpu = self.use_gpu, score_thresh = self.threshold, visualization=False)

文件 "/home/user/anaconda3/lib/python3.7/site-packages/paddlehub/compat/paddle_utils.py",第220行,在runner中返回func(*args, **kwargs)

文件 "/home/user/.paddlehub/modules/yolov3_resnet50_vd_coco2017/module.py",第211行,在object_detection函数中[image_tensor, im_size_tensor])

OSError: (External) Cublas错误,CUBLAS_STATUS_INVALID_VALUE。传递给函数的参数或值不受支持(例如,传递了一个负向量大小)。(at /paddle/paddle/fluid/platform/cuda_helper.h:93)——你收到这个错误是因为你注解了。直接回复此邮件、查看GitHub或取消订阅。

xggvc2p6

xggvc2p65#

请问您使用的是PaddlePaddle、PaddleHub、Python、cuDNN和CUDA的哪个版本呢?

我验证时使用的是paddlepaddle-gpu=2.0.1, paddlehub=2.0.0, cuda=10.2, cudnn=7.6.5, python=3.8.5,没有出现您说的问题。验证脚本及验证方法:

import paddlehub as hub
import cv2

object_detector = hub.Module(name="yolov3_resnet50_vd_coco2017")
result = object_detector.object_detection(images=[cv2.imread('2007_000175.jpg')],use_gpu=True)
print(result)

在命令行输入 CUDA_VISIBLE_DEVICES=0 python test.py
目前您存在的问题初步判定有两个方面,环境配置有问题,PaddlePaddle和CUDA的版本及cuDNN版本不匹配,第二种是在执行时没有设定好CUDA_VISIBLE_DEVICES。

bvk5enib

bvk5enib6#

这个问题确实是由于版本不匹配导致的。版本号不能有较大的差异,即使是次要版本号也不行。请仔细阅读其文档,并按照文档中的说明进行操作,因为文档的编写并不是很好。总的来说,它的配置比TensorFlow要难得多。我认为平台有责任输出更多有用的信息来进行调试(我想检查不匹配很容易)。

exdqitrt

exdqitrt7#

这个问题实际上是由于版本不匹配导致的。版本号不能有较大的差异,即使是次要版本号也不行。请仔细阅读其文档,并按照文档中的说明进行操作,因为文档的编写并不是很好。总的来说,配置方面比TensorFlow要难得多。我认为平台有责任输出更多有用的信息来进行调试(我想检查不匹配很容易)。虽然这个问题已经解决了,但这个帖子无法为其他用户提供任何有用的信息。当你遇到问题时,这会让Paddle变得难以使用。

ewm0tg9j

ewm0tg9j8#

这个问题是由于在PaddlePaddle框架中使用CuBLAS库时,传入了一个不支持的参数导致的。具体来说,是在创建参数时,传入了一个负向量大小。为了解决这个问题,你需要检查你的代码,确保传入的参数是正确的。如果你使用的是预训练模型,你可以尝试更新PaddlePaddle和相关依赖库到最新版本。

9vw9lbht

9vw9lbht9#

我遇到了相同的问题:
2022-04-29 18:05:40 [INFO] Starting to read file list from dataset... 2022-04-29 18:05:40 [INFO] 1981 samples in file MyDataset/train.json, including 1981 positive samples and 0 negative samples. loading annotations into memory... Done (t=0.07s) creating index... index created! 2022-04-29 18:05:40 [INFO] Starting to read file list from dataset... 2022-04-29 18:05:40 [INFO] 495 samples in file MyDataset/val.json, including 495 positive samples and 0 negative samples. W0429 18:05:40.970075 12979 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.0, Runtime API Version: 11.0 W0429 18:05:40.975056 12979 device_context.cc:422] device: 0, cuDNN Version: 7.6. Traceback (most recent call last): File "train.py", line 38, in model = pdx.det.FasterRCNN(num_classes=num_classes, backbone='ResNet101') File "/root/.local/lib/python3.7/site-packages/paddlex/cv/models/detector.py", line 854, in init dcn_v2_stages=dcn_v2_stages) File "/root/.local/lib/python3.7/site-packages/paddlex/cv/models/detector.py", line 100, in _get_backbone backbone = getattr(ppdet.modeling, backbone_name)(**params) File "/root/.local/lib/python3.7/site-packages/paddlex/ppdet/modeling/backbones/resnet.py", line 528, in init lr=1.0)) File "/root/.local/lib/python3.7/site-packages/paddlex/ppdet/modeling/backbones/resnet.py", line 69, in init bias_attr=False) File "/root/.local/lib/python3.7/site-packages/paddle/nn/layer/conv.py", line 646, in init data_format=data_format) File "/root/.local/lib/python3.7/site-packages/paddle/nn/layer/conv.py", line 135, in init default_initializer=_get_default_param_initializer()) File "/root/.local/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 412, in create_parameter default_initializer) File "/root/.local/lib/python3.7/site-packages/paddle/fluid/layer_helper_base.py", line 374, in create_parameter **attr._to_kwargs(with_initializer=True)) File "/root/.local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2895, in create_parameter initializer(param, self) File "/root/.local/lib/python3.7/site-packages/paddle/fluid/initializer.py", line 366, in call stop_gradient=True) File "/root/.local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2925, in append_op kwargs.get("stop_gradient", False)) File "

相关问题