Open vsenderov opened 10 months ago
I also have some local notes. They are probably outdated, but we can start by testing them and compiling the correct notes to the website.
git clone [https://github.com/miking-lang/miking](https://github.com/miking-lang/miking)
cd miking
make install
git clone [https://github.com/miking-lang/miking-dppl](https://github.com/miking-lang/miking-dppl)
cd miking-dppl
make install
During the installation process, pay attention to the information about the environment variables (shown in red).
git clone [https://github.com/vsenderov/treeppl](https://github.com/vsenderov/treeppl)
cd treeppl
git checkout json-dlunde
make install
Again, during the installation process, pay attention to the information about the environment variables.## Running TreePPLHere’s how you can run TreePPL and work with a sample model from the TreePPL repository, which simulates biased coin flips:1. While in the root directory of the TreePPL repository, run the following command to compile the example model:
tpplc models/lang/coin.tppl --output coin
This command generates an executable file named coin
(you can specify the name of the executable using the --output
flag).2. Run the executable, providing the path to a JSON data file containing values for the model parameters as an argument:
./coin models/data/coin.json
In this case, the model coinModel
(defined in models/lang/coin.tppl
) has a single parameter: coinflips: Bool[]
. The coin.json
file contains the following JSON object:
{"coinflips":[true, true, true, false, true, false, false, true, true, false, false, false, true, false, true, false, false, true, false, false]}
Running the executable will output a JSON object containing samples, weights and the normalization constant to the standard output.
Pre-prerequisites
Prerequisites
sudo apt update
sudo apt upgrade
sudo apt install unzip
sudo apt install bubblewrap
sudo apt install bzip2
sudo apt install python3-pip
sudo apt install gnome-text-editor -y
Opam and OCaml
You can save the following to a script, make it executable and run it.
```bash
#!/usr/bin/env bash
# Tested on Ubuntu 20.04 and 22.04.1 LTS WSL
####################
## Opam and OCaml ##
####################
read -p "Install/reinstall Opam and OCaml? " -n 1 -r; echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
## Clean up
rm -rf ~/.opam
## Install opam
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
## Install required packages
sudo apt install m4 make gcc
## Install Ocaml 5 and standard packages
opam init -y
opam update
opam switch create 5.0.0
eval $(opam env)
opam install -y dune linenoise utop ocp-indent merlin
## Install packages required in Miking
opam pin ocamlformat 0.24.1
opam install -y pyml toml owl
fi
Miking and TreePPL
eval $(opam env)
gh repo clone miking-lang/miking
cd miking
make install
cd ..
gh repo clone miking-lang/miking-dppl
cd miking-dppl
export PATH="$HOME/.local/bin:$PATH"
make install
export MCORE_LIBS=coreppl=$HOME/.local/src/coreppl/
cd ..
gh repo clone https://github.com/treeppl/treeppl.git
cd treeppl
export MCORE_LIBS=$MCORE_LIBS:treeppl=$HOME/.local/src/treeppl/
make install
cd ..
pip install "git+https://github.com/treeppl/treeppl-python#egg=treeppl"
You can put the environment stuff in your .bashrc
. Fire up gnome-text-editor ~/.bashrc
and add
## Customizations for TreePPL
eval $(opam env)
export PATH="$HOME/.local/bin:$PATH"
export MCORE_LIBS="coreppl=$HOME/.local/src/coreppl/"
export MCORE_LIBS="$MCORE_LIBS:treeppl=$HOME/.local/src/treeppl/"
Running an example
pip install matplotlib
pip install seaborn
sudo apt-get install python3-tk
gh repo clone treeppl/treeppl-python
cd treeppl-python/examples
python3 coin.py
Setup dev under vscode
Install WSL Extension and/or Remote-extension-pack
https://code.visualstudio.com/docs/remote/wsl https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack
from a directory that you want to develop from do code .
Installation guide is now live. Asked @vresbok to take a look.
@kudlicka is working on a principled installation pipeline; however the
README.md
in the other repo already gives some hints how to install from source.Eventually the whole installation can be described in detail.