/learn-tch-rs

A copy from tch-rs DCGAN example.

Primary LanguageRust

Learn tch-rs

PyTorch at Rust programming language.

Environment

Requirements:

Extract libtorch zip file to /usr/local/libtorch or somewhere else.

Update environment variables in .bashrc or equivalent. Check cuda via using nvcc command.

export PATH="/usr/local/cuda/bin:$PATH"
export LIBTORCH="/usr/local/libtorch"
export LD_LIBRARY_PATH="$LIBTORCH/lib":$LD_LIBRARY_PATH

For Windows users, we need to update PATH and LIBTORCH environment variables from the Control Panel. As shown in the following commands, the location of each variable can be temporarily specified.

$Env:LIBTORCH = "C:\libtorch"
$Env:Path += ";C:\libtorch\lib"

Command Line Interface

Dataset: https://github.com/AlexiaJM/RelativisticGAN (/images)

Training:

cargo run --release -- train images/ model/ demo/

Testing:

cargo run --release -- eval model/gen_8000.pt demo/