Installation¶
We strongly recommend using the Conda package manager to create an isolated environment. This simplifies the management of complex dependencies like PyTorch and Pinocchio (for testing).
First, clone the repository:
git clone https://github.com/YueWang996/bard.git
cd bard
Next, follow the instructions for your desired compute device.
CUDA Installation (Recommended for GPU Acceleration)¶
Install a CUDA-enabled build of PyTorch by following the official instructions for your specific platform and CUDA version: https://pytorch.org/get-started/locally/
Once PyTorch is installed, install bard:
pip install -e .
CPU-Only Installation¶
If you do not have an NVIDIA GPU or do not require GPU acceleration, you can install the CPU-only version with a single command. This will automatically install a compatible, CPU-only version of PyTorch.
pip install -e ".[cpu]"
Upgrading from CPU to GPU¶
If you initially installed the CPU-only version and want to switch to the CUDA version, you must manually reinstall PyTorch.
Uninstall the existing CPU-only PyTorch version:
pip uninstall -y torch torchvision torchaudio
Install the correct CUDA-enabled PyTorch build from the official site.
Reinstall bard to ensure all dependencies are correctly linked.
pip install -e . --force-reinstall
Developer and Test Setup¶
The library is rigorously tested against pinocchio to ensure numerical accuracy. To run the full test suite, you will need to install the development dependencies.
# First, install pinocchio
conda install -c conda-forge pinocchio
# From the project root directory, install dev dependencies
pip install -e ".[dev]"
# Run the test suite
pytest
Building the Documentation¶
If you need to build the documentation locally, follow these steps.
Install documentation dependencies from the project’s root directory:
pip install -e .[docs]
Navigate to the `docs` folder and run the build command:
cd docs sphinx-build -b html source build/html
View the documentation by opening the index.html file located in the docs/build/html/ directory in your web browser.