Skip to content

Instantly share code, notes, and snippets.

@lantiga
Last active May 5, 2020
Embed
What would you like to do?
Build RedisAI with PyTorch backend on NVIDIA Jetson
sudo apt update
sudo apt install -y git build-essential ninja-build cmake python3-pip python3-cffi redis unzip wget
git clone https://github.com/RedisAI/RedisAI.git
cd RedisAI
mkdir build
WITH_PT=0 WITH_TF=0 WITH_TFLITE=0 WITH_ORT=0 bash get_deps.sh
mv deps/linux-arm64v8-cpu deps/linux-x64-cpu
mkdir deps/linux-x64-cpu/libtorch
cd deps/linux-x64-cpu/libtorch
# https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-5-0-now-available/72048
# wget https://nvidia.box.com/shared/static/phqe92v26cbhqjohwtvxorrwnmrnfx1o.whl -O torch-1.3.0-cp36-cp36m-linux_aarch64.whl
# unzip torch-1.3.0-cp36-cp36m-linux_aarch64.whl
# mv torch/* .
#wget https://nvidia.box.com/shared/static/ncgzus5o23uck9i5oth2n8n06k340l6k.whl -O torch-1.4.0-cp36-cp36m-linux_aarch64.whl
# sudo apt install -y libopenblas-base
# unzip torch-1.4.0-cp36-cp36m-linux_aarch64.whl
# mv torch/* .
wget https://nvidia.box.com/shared/static/3ibazbiwtkl181n95n9em3wtrca7tdzp.whl -O torch-1.5.0-cp36-cp36m-linux_aarch64.whl
sudo apt install -y libopenblas-base
unzip torch-1.5.0-cp36-cp36m-linux_aarch64.whl
mv torch/* .
cd -
cd build
cmake -DBUILD_TF=OFF -DBUILD_TFLITE=OFF -DBUILD_TORCH=ON -DBUILD_ORT=OFF -DCMAKE_BUILD_TYPE=Release ../
make -j4 && make install
# Put this script inside RedisAi main folder.
# Run with 'bash run_redisai_torch.sh'.
# Before running check that the script is executable 'chmod 755 run_redisai_torch.sh'
redis-server --loadmodule install-cpu/redisai.so
# Put this script inside RedisAi main folder.
# Run only after you started a redisai server (view run_redisai_torch.sh).
set -x
redis-cli -x AI.MODELSET m TORCH GPU < ./test/test_data/pt-minimal.pt
redis-cli AI.TENSORSET a FLOAT 2 2 VALUES 2 3 2 3
redis-cli AI.TENSORSET b FLOAT 2 2 VALUES 2 3 2 3
redis-cli AI.MODELRUN m INPUTS a b OUTPUTS c
redis-cli AI.TENSORGET c VALUES
@FilippoVajana
Copy link

FilippoVajana commented Feb 14, 2020

In test_redisai.sh is the set -x command necessary?

@lantiga
Copy link
Author

lantiga commented Feb 14, 2020

Good point, it isn’t.
Just there to provide some feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment