Skip to content
/ pnnx Public
forked from pnnx/pnnx

PyTorch Neural Network eXchange

Notifications You must be signed in to change notification settings

Yeargod/pnnx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

pnnx

download

PyTorch Neural Network eXchange

Note: The current WIP implementation is in Tencent/ncnn#3262

Download PNNX Windows/Linux/MacOS Executable

https://github.com/pnnx/pnnx/releases

This package includes all the binaries required. It is portable, so no CUDA or PyTorch runtime environment is needed :)

Usages

Example Command

pnnx.exe mobilenet_v2.pt inputshape=[1,3,224,224]
pnnx.exe yolov5s.pt inputshape=[1,3,640,640] inputshape2=[1,3,320,320]

Full Usages

Usage: pnnx [model.pt] [(key=value)...]
  pnnxparam=model.pnnx.param
  pnnxbin=model.pnnx.bin
  pnnxpy=model_pnnx.py
  ncnnparam=model.ncnn.param
  ncnnbin=model.ncnn.bin
  ncnnpy=model_ncnn.py
  optlevel=2
  device=cpu/gpu
  inputshape=[1,3,224,224],...
  inputshape2=[1,3,320,320],...
  customop=/home/nihui/.cache/torch_extensions/fused/fused.so,...
  moduleop=models.common.Focus,models.yolo.Detect,...

Build from Source

  1. Download and setup the libtorch from https://pytorch.org/

  2. Clone pnnx (inside nihui/ncnn pnnx branch atm)

git clone https://github.com/nihui/ncnn.git
cd ncnn
git checkout pnnx
  1. Build with CMake
mkdir tools/pnnx/build
cd tools/pnnx/build
cmake -DCMAKE_INSTALL_PREFIX=install -DTorch_INSTALL_DIR=<your libtorch dir> ..
cmake --build . --config Release -j 2
cmake --build . --config Release --target install

About

PyTorch Neural Network eXchange

Resources

Stars

Watchers

Forks

Packages

No packages published