⛰️ The easy way to ship Stan models
Strata is a command line tool. To install, run:
pip install strata-cli
This will give you the strata
command. You can also install it with Homebrew.
Package a model
strata bernoulli.stan
This creates a dist
directory with:
-
bin
- Stan binaries -
lib
- TBB libraries -
licenses
- license files
You can also package multiple models
strata bernoulli.stan regression.stan
Run a model directly
dist/bin/bernoulli sample data ...
Or load it into CmdStanPy
from cmdstanpy import CmdStanModel
model = CmdStanModel(exe_file='dist/bin/bernoulli')
CmdStanR (not on CRAN yet)
library(cmdstanr)
model <- cmdstan_model(exe_file="dist/bin/bernoulli")
Or CmdStan.rb
require "cmdstan"
model = CmdStan::Model.new(exe_file: "dist/bin/bernoulli")
- Linux: package on the oldest platform you support
- Mac: models run on macOS 10.14+ by default (set
MACOSX_DEPLOYMENT_TARGET
to override) - Windows: not supported yet
Cross-compile for a different architecture (on the same OS)
strata --cross-compile ...
On Ubuntu, this requires:
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
Specify the output directory
strata -o dist ...
Show build output
strata --debug ...
Create a static build (experimental, only working on Mac)
strata --static ...
On Mac, you can use:
brew install ankane/brew/strata
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/strata.git
cd strata
pip install -e .
# for tests
pip install -r requirements.txt
pytest