rlizzo / TuringCLIExample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo of CLI for Turing and Tensorboard

To run on grid:

grid run --config ./config.yml bin/fit.jl --num_samples "[10000, 20000]"

Installation

Do an Then julia --project -e "using Pkg; Pkg.instantiate()"

To build the sysimage

julia --threads auto -e 'using Pkg; Pkg.add(\"PackageCompiler\")'
julia --threads auto ./deps/create_sysimage.jl

CLI Usage

To use with default options

julia --project --threads auto bin/fit.jl

(although the --threads auto may or may not be useful in this example.)

Or if you have a sysimage:

julia --project --threads auto --sysimage JuliaSysimage.dll bin/fit.jl

Or with options

julia --project --threads auto bin/fit.jl --num_samples 1000

To run tensorboard, ensure tensorboard is installed (e.g. with pip install -r requirements.txt ) and

tensorboard --logdir tensorboard_logs

Options

❯ julia --project bin/fit.jl --help
usage: fit.jl [--num_samples NUM_SAMPLES] [--num_adapts NUM_ADAPTS]
              [--target_acceptance_rate TARGET_ACCEPTANCE_RATE]
              [--s_prior_alpha S_PRIOR_ALPHA]
              [--s_prior_theta S_PRIOR_THETA] [-h]

optional arguments:
  --num_samples NUM_SAMPLES
                        samples to draw in chain (type: Int64,
                        default: 10000)
  --num_adapts NUM_ADAPTS
                        number of adaptations for NUTS (type: Int64,
                        default: 100)
  --target_acceptance_rate TARGET_ACCEPTANCE_RATE
                        Target acceptance rate for dual averaging.
                        (type: Float64, default: 0.65)
  --s_prior_alpha S_PRIOR_ALPHA
                        alpha in InverseGamma prior for s (type:
                        Float64, default: 2.0)
  --s_prior_theta S_PRIOR_THETA
                        theta in InverseGamma prior for s (type:
                        Float64, default: 3.0)
  -h, --help            show this help message and exit

Grid

To run on grid, do pip install lightning-grid --upgrade then in this folder,

grid run --instance_type t2.medium --framework julia --name turing-test bin/fit.jl --num_samples 1000

This may take some time to compile the image, so you can check: grid status To see the logs as it executes:

grid logs hmc-test

When it is complete,

grid artifacts hmc-test-exp0

About

License:MIT License


Languages

Language:Julia 100.0%