Toybrick

pytorch权重转换到onnx的错误

yaowei

中级会员

积分
369
发表于 2019-4-29 15:04:30    查看: 2544|回复: 0 | [复制链接]    打印 | 显示全部楼层
本帖最后由 yaowei 于 2019-4-29 15:08 编辑
  1. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  2.   warnings.warn(msg, SourceChangeWarning)
  3. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:404: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  4.   if original_source != current_source:
  5. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  6.   warnings.warn(msg, SourceChangeWarning)
  7. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  8.   warnings.warn(msg, SourceChangeWarning)
  9. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  10.   warnings.warn(msg, SourceChangeWarning)
  11. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  12.   warnings.warn(msg, SourceChangeWarning)
  13. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  14.   warnings.warn(msg, SourceChangeWarning)
  15. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  16.   warnings.warn(msg, SourceChangeWarning)
  17. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  18.   warnings.warn(msg, SourceChangeWarning)
  19. /home/yaowei/.local/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  20.   warnings.warn(msg, SourceChangeWarning)
  21. Traceback (most recent call last):
  22.   File "pth-to-onnx.py", line 47, in <module>
  23.     torch.onnx.export(resnet100_load, resnet100_dummy_input, resnet100_onnx_model, verbose = True)
  24.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/onnx/__init__.py", line 27, in export
  25.     return utils.export(*args, **kwargs)
  26.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/onnx/utils.py", line 104, in export
  27.     operator_export_type=operator_export_type)
  28.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/onnx/utils.py", line 281, in _export
  29.     example_outputs, propagate)
  30.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/onnx/utils.py", line 224, in _model_to_graph
  31.     graph, torch_out = _trace_and_get_graph_from_model(model, args, training)
  32.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/onnx/utils.py", line 192, in _trace_and_get_graph_from_model
  33.     trace, torch_out = torch.jit.get_trace_graph(model, args, _force_outplace=True)
  34.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/jit/__init__.py", line 197, in get_trace_graph
  35.     return LegacyTracedModule(f, _force_outplace)(*args, **kwargs)
  36.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
  37.     result = self.forward(*input, **kwargs)
  38.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/jit/__init__.py", line 252, in forward
  39.     out = self.inner(*trace_inputs)
  40.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 487, in __call__
  41.     result = self._slow_forward(*input, **kwargs)
  42.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in _slow_forward
  43.     result = self.forward(*input, **kwargs)
  44.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 139, in forward
  45.     inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)
  46.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in scatter
  47.     return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim)
  48.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 35, in scatter_kwargs
  49.     inputs = scatter(inputs, target_gpus, dim) if inputs else []
  50.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 28, in scatter
  51.     return scatter_map(inputs)
  52.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 15, in scatter_map
  53.     return list(zip(*map(scatter_map, obj)))
  54.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 13, in scatter_map
  55.     return Scatter.apply(target_gpus, None, dim, obj)
  56.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/_functions.py", line 88, in forward
  57.     streams = [_get_stream(device) for device in target_gpus]
  58.   File "/home/yaowei/.local/lib/python2.7/site-packages/torch/nn/parallel/_functions.py", line 115, in _get_stream
  59.     if _streams[device] is None:
  60. IndexError: list index out of range
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表