Giter VIP home page Giter VIP logo

model_convert's Introduction

model_convert

Description

{When you're done, you can delete the content in this README and update the file with details for others getting started with your repository}

Software Architecture

Software architecture description

Installation

bellow is the installation instruction for configuration of CUDA 11.1 + cudnn 8.0 + TensorRT 7.2.2.3 for cuda11.1 cudnn 8.0 + conda with python 3.8 (lj_torch)+ pytorch1.8.1 for cuda11.1. You can adopt other configurations and accordingly modify the version name in the following commands.

(1) CUDA 11.1 + cudnn 8.0 sudo ln -s cuda-11.1 cuda # for all users, do this only once export PATH=/usr/local/cuda-11.1/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:$LD_LIBRARY_PATH export CUDA_DEVICE=0 # may be needed for some codes

(2) TensorRT 7.2.2.3 for cuda11.1 cudnn 8.0

take care to select the TensorRT version, make sure TensorRT must assist your CUDA and cuddnn version, which you can find out in the TensorRT install file name.

tar -xzvf TensorRT-7.2.2.3.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.0.tar.gz (for all users, do this only once) sudo cp -r TensorRT-7.2.2.3 /usr/local # for all users, do this only once export PATH=/usr/local/TensorRT-7.2.2.3/bin:$PATH export LD_LIBRARY_PATH=/usr/local/TensorRT-7.2.2.3/lib:$LD_LIBRARY_PATH

cd /usr/local/TensorRT-7.2.2.3/samples/trtexec sudo make clean & sudo make # for all users, do this only once

(3) conda environment(python3.8 + pytorch1.8.1 for cuda11.1 + TensorRT-7.2.2.3 for python) conda create -n lj_torch python=3.8 conda activate lj_torch pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html cd /usr/local/TensorRT-7.2.2.3/python pip3 install tensorrt-7.2.2.3-cp38-none-linux_x86_64.whl # copy the .whl file to a folder needs no sudo cd /usr/local/TensorRT-7.2.2.3/graphsurgeon pip3 install graphsurgeon-0.4.5-py2.py3-none-any.whl # copy the .whl file to a folder needs no sudo cd /usr/local/TensorRT-7.2.2.3/onnx_graphsurgeon pip3 install onnx_graphsurgeon-0.2.6-py2.py3-none-any.whl # copy the .whl file to a folder needs no sudo pip3 install pycuda

Instructions

  1. (Optional) create an onnx model to test, run the follong code in python in your prepared conda enrionment: import torchvision.models as models resnext50_32x4d = models.resnext50_32x4d(pretrained=True) import torch BATCH_SIZE = 64 dummy_input=torch.randn(BATCH_SIZE, 3, 224, 224) import torch.onnx torch.onnx.export(resnext50_32x4d, dummy_input, "test.onnx", verbose=False)

  2. (Optional) use trtexec to compare with this project, or to check if TensorRT installed correctly, e.g. [TensorRT install path]/trtexec --onnx=test.onnx --saveEngine=test.trt --explicitBatch --verbose

  3. do the test and make sure no error appear python test_model_convertor.py (before running, modify paths in this script) python test_mmdet_ssd.py (before running, modify paths in this script)

  4. (Optional) to test your other models, modify in load_test_model in file test_model_convertor.py

  5. call ModelConvertor from your codes

Contribution

  1. Fork the repository
  2. Create Feat_xxx branch
  3. Commit your code
  4. Create Pull Request

Gitee Feature

  1. You can use Readme_XXX.md to support different languages, such as Readme_en.md, Readme_zh.md
  2. Gitee blog blog.gitee.com
  3. Explore open source project https://gitee.com/explore
  4. The most valuable open source project GVP
  5. The manual of Gitee https://gitee.com/help
  6. The most popular members https://gitee.com/gitee-stars/

model_convert's People

Contributors

mengpanqingyun avatar

Watchers

 avatar  avatar

Forkers

wangyuehy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.