提交 35fba2f5 编写于 作者: C channingss

fix bug:import torch

上级 14cf068a
......@@ -139,15 +139,6 @@ def caffe2paddle(proto, weight, save_dir, caffe_proto):
def onnx2paddle(model_path, save_dir):
# check onnx installation and version
try:
import onnx
version = onnx.version.version
if version != '1.5.0':
print("onnx==1.5.0 is required")
return
except:
print("onnx is not installed, use \"pip install onnx==1.5.0\".")
return
try:
import torch
version = torch.__version__
......@@ -159,6 +150,15 @@ def onnx2paddle(model_path, save_dir):
"we use caffe2 to inference graph, please use \"pip install torch==1.1.0\"."
)
return
try:
import onnx
version = onnx.version.version
if version != '1.5.0':
print("onnx==1.5.0 is required")
return
except:
print("onnx is not installed, use \"pip install onnx==1.5.0\".")
return
print("Now translating model from onnx to paddle.")
from x2paddle.decoder.onnx_decoder import ONNXDecoder
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册