ReAgent CLI & Python API¶
We have CLI to launch training & Python API to use programmatically, e.g., in your own script or Jupyter Notebook. To install this component, you will need to have Python 3.7+ installed on your system. If you don’t have that, you can either install it via pyenv or conda. To verify that you have the right version, type the following command on your shell:
Once you make sure you have the right version, you can simply clone this repo and pip install
git clone https://github.com/facebookresearch/ReAgent.git cd ReAgent pip install ".[gym]" # install nightly torch (change cpu to cu101/102 if fit) pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
If you don’t want need gym dependencies, you can remove
To verify your setup please run tox.
pip install tox tox
Spark preprocessing JAR¶
To build from source, you’ll need JDK, Scala, & Maven. We will use SDKMAN! to install them.
curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk version sdk install java 8.0.252.hs-adpt sdk install scala sdk install maven
If you are testing locally, you can also install Spark
sdk install spark 2.4.6
Now, you can build our preprocessing JAR
mvn -f preprocessing/pom.xml clean package
RASP (ReAgent Serving Platform) is a decision-serving library. It also has standlone binary. It depends on libtorch, which cannot be statically linked at the moment. Therefore, we don’t have a pre-built version.
To build the CLI, you’ll need CMake and the following libraries:
If you don’t have those requirements, one easy way to get them is through conda. We recommend miniconda for this purpose. If you want to install those requirements via conda, you can type this in the shell:
conda install --file rasp_requirements.txt
To get libtorch, please go to pytorch.
Please make sure to download the “Preview (Nightly)” since our code is tested with that version.
Below, we assumed you put the extracted file at
You will also need to make sure to init git submodules
git submodule update --force --recursive --init --remote
Now, you are ready to build
mkdir -p serving/build cd serving/build cmake -DCMAKE_PREFIX_PATH=$HOME/libtorch -DCMAKE_CXX_STANDARD=17 .. make