Skip to content

Commit

Permalink
Update import
Browse files Browse the repository at this point in the history
  • Loading branch information
vectornguyen76 committed Oct 30, 2023
1 parent a6ec996 commit 69955de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
16 changes: 6 additions & 10 deletions image-search-engine/model_repository/convert_onnx_to_tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@

import numpy as np

# ONNX: pip install onnx, onnxruntime
import onnx
import onnxruntime as rt
import tensorrt as trt

# Torch
import torch
import torchvision.datasets as datasets
import torchvision.models as models
import torchvision.transforms as transforms
from torchvision.utils import save_image

# ONNX: pip install onnx, onnxruntime
try:
import onnx
import onnxruntime as rt
except ImportError as e:
raise ImportError(f"Please install onnx and onnxruntime first. {e}")

import tensorrt as trt

# CUDA & TensorRT
# import pycuda.driver as cuda
from cuda import cuda
from torchvision.utils import save_image

TRT_LOGGER = trt.Logger()

Expand Down
11 changes: 4 additions & 7 deletions image-search-engine/model_repository/convert_torch_to_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@

import numpy as np

# ONNX: pip install onnx, onnxruntime
import onnx
import onnxruntime as rt

# Torch
import torch
import torchvision.datasets as datasets
import torchvision.models as models
import torchvision.transforms as transforms
from torchvision.utils import save_image

# ONNX: pip install onnx, onnxruntime
try:
import onnx
import onnxruntime as rt
except ImportError as e:
raise ImportError(f"Please install onnx and onnxruntime first. {e}")


def parse_args():
parser = argparse.ArgumentParser(description="Convert Pytorch models to ONNX")
Expand Down

0 comments on commit 69955de

Please sign in to comment.