Skip to content

Commit

Permalink
Fix the bug of compile model to tensorrt
Browse files Browse the repository at this point in the history
Closes #491

Signed-off-by: zhangkaili <zhang.kaili@zte.com.cn>
  • Loading branch information
KellyZhang2020 committed Jul 19, 2021
1 parent 3436030 commit 93b852f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model_compiler/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run(self):
'tensorflow==2.4.0',
'torch==1.7.1',
'onnx-tf',
'onnx-caffe2==1.0.0',
'onnx-caffe2',
'paddlepaddle',
'paddle2onnx',
'tensorflow_addons',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from tempfile import NamedTemporaryFile
import onnx
import onnx.utils
from paddle2onnx.command import program2onnx
from . import repository
from .. import utilities

Expand Down Expand Up @@ -43,6 +42,7 @@ def from_env(env: Mapping[str, str]) -> 'Config':

@repository.REPOSITORY.register(source_type=PaddlePaddleModelFile, target_type=OnnxModel, config_type=Config)
def compile_source(source: PaddlePaddleModelFile, config: Config) -> OnnxModel:
from paddle2onnx.command import program2onnx # pylint: disable=import-outside-toplevel
with NamedTemporaryFile(suffix='.onnx') as onnx_file:
program2onnx(model_dir=source.model_path,
save_file=onnx_file.name,
Expand Down

0 comments on commit 93b852f

Please sign in to comment.