Torchvision错误TypeError:_resolve_type_from_object()

我最近创建了一个conda环境并安装了PyTorch。我收到此错误:

-------------------------------------------------- ------------------------- TypeError跟踪(最近的呼叫   最后)   ----> 1进口火炬         2打印(torchvision.version)      〜/ .local / lib / python3.5 / site-packages / torchvision / init.py在            1进口警告         2   ---->从Torchvision中导入3个模型         4从Torchvision导入数据集         5来自Torchvision导入操作      〜/ .local / lib / python3.5 / site-packages / torchvision / models / init.py在           10从.shufflenetv2导入*        来自的11。进口细分   ---> 12。进口检测        来自的13。导入视频        来自的14。导入量化      〜/ .local / lib / python3.5 / site-packages / torchvision / models / detection / init.py   在   ----> 1从.faster_rcnn导入*         2从.mask_rcnn导入*         3从.keypoint_rcnn导入*      〜/ .local / lib / python3.5 / site-packages / torchvision / models / detection / faster_rcnn.py   在        来自.generalized_rcnn的12导入GeneralizedRCNN        从.rpn中导入13 AnchorGenerator,RPNHead,RegionProposalNetwork   ---> 14从.roi_heads导入RoIHeads        15从.transform导入GeneralizedRCNNTransform        从.backbone_utils 16导入resnet_fpn_backbone      〜/ .local / lib / python3.5 / site-packages / torchvision / models / detection / roi_heads.py   在       208       209   -> 210 @ torch.jit.script       211 def _onnx_heatmaps_to_keypoints_loop(地图,rois,widths_ceil,heights_ceil,       212个宽度,高度,offset_x,offset_y,num_keypoints):      〜/ .local / lib / python3.5 / site-packages / torch / jit / init.py在   1288如果_rcb是脚本(obj,优化,_frames_up,_rcb)   无:1289 _rcb =   _jit_internal.createResolutionCallbackFromClosure(obj)   -> 1290 fn =火炬._C._jit_script_compile(qualified_name,ast,_rcb,get_default_args(obj))1291#转发文档字符串1292 fn.doc = obj.doc      〜/ .local / lib / python3.5 / site-packages / torch / jit / _recursive.py在   try_compile_fn(fn,loc)       566#对象       567 rcb = _jit_internal.createResolutionCallbackFromClosure(fn)   -> 568返回torch.jit.script(fn,_rcb = rcb)       569       570 def wrap_cpp_module(cpp_module):      〜/ .local / lib / python3.5 / site-packages / torch / jit / init.py在   1288如果_rcb是脚本(obj,优化,_frames_up,_rcb)   无:1289 _rcb =   _jit_internal.createResolutionCallbackFromClosure(obj)   -> 1290 fn =火炬._C._jit_script_compile(qualified_name,ast,_rcb,get_default_args(obj))1291#转发文档字符串1292 fn.doc = obj.doc      〜/ .local / lib / python3.5 / site-packages / torch / jit / init.py在   _get_overloads(obj)2028对于未编译的过载中的过载_fn,[2029]已编译_fns = []:   -> 2030编译后的fns.append(_compile_function_with_overload(overload_fn,   qual_name,obj))2031 2032(如果现存的comfled_fns:      〜/ .local / lib / python3.5 / site-packages / torch / jit / init.py在   _compile_function_with_overload(overload_fn,qual_name,impl_fn)2008 def _compile_function_with_overload(overload_fn,qual_name,   (impl_fn):2009重载_decl =   torch.jit.get_jit_def(overload_fn).decl()   -> 2010重载签名= torch.jit.annotations.get_signature(overload_fn,无,无,   inspect.ismethod(overload_fn))2011 impl_ast =   torch.jit.get_jit_def(impl_fn)2012重载默认值=   get_default_args(overload_fn)      〜/ .local / lib / python3.5 / site-packages / torch / jit / annotations.py在   get_signature(fn,rcb,loc,is_method)        77#因为它没有任何注释。        78如果type_line不是None:   ---> 79签名= parse_type_line(type_line,rcb,loc)        80        81返回签名      〜/ .local / lib / python3.5 / site-packages / torch / jit / annotations.py在   parse_type_line(type_line,rcb,loc)       163引发RuntimeError(“未能解析类型注释的返回类型:{}”。format(str(e)))       164   -> 165 arg_types = [arg_ann中的an的ann_to_type(ann,loc)]       166返回arg_types,ann_to_type(ret_ann,loc)       167      〜/ .local / lib / python3.5 / site-packages / torch / jit / annotations.py在   (.0)       163引发RuntimeError(“未能解析类型注释的返回类型:{}”。format(str(e)))       164   -> 165 arg_types = [arg_ann中的an的ann_to_type(ann,loc)]       166返回arg_types,ann_to_type(ret_ann,loc)       167      〜/ .local / lib / python3.5 / site-packages / torch / jit / annotations.py在   ann_to_type(ann,loc)       301       302 def ann_to_type(ann,loc):   -> 303 the_type = try_ann_to_type(ann,loc)       304如果the_type不为None:       305返回the_type      〜/ .local / lib / python3.5 / site-packages / torch / jit / annotations.py在   try_ann_to_type(ann,loc)       294 def fake_rcb(密钥):       295返回无   -> 296 the_type =火炬._C._resolve_type_from_object(ann,loc,fake_rcb)       297如果the_type不是None:       298返回the_type      TypeError:_resolve_type_from_object():不兼容的函数   论点。支持以下参数类型:       1.(arg0:对象,arg1:torch._C._jit_tree_views.SourceRange,arg2:Callable [[str],function])-> torch._C.Type      调用:打字。联合[int,NoneType],无,.fake_rcb at 0x7f55d8974ea0>

能否请大家提出我应该怎么做?谢谢!

评论