After installing prerequisites as this instruction, we clone Pytorch-Encoding
# Tested with commit ce461da
git clone https://github.com/zhanghang1989/PyTorch-Encoding.git
Then, according to this issue, replace #include <torch/extension.h>
with #include <torch/serialize/tensor.h>
in all encoding/lib/*/*.cpp
and encoding/lib/*/*.cu
files. Also add #include <torch/serialize/tensor.h>
to encoding/lib/gpu/operator.h
.
The Pytorch-Encoding doc requires python setup.py install
. However, it's not necessary. You can just add the package path to $PYTHONPATH
or sys.path
.
Run the examples
export CUDA_HOME=/mnt/data-1/data/houjing.huang/Software/cuda-9.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
python scripts/prepare_pcontext.py
python test.py --dataset PContext --model-zoo Encnet_ResNet50_PContext --eval
- The default ResNet in Pytorch-Encoding is different than pytorch torchvision. The former provides
deep_base
,dilation
,multi_grid
options.